mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- Start of soundfont refactoring. This does not compile yet!
This commit is contained in:
parent
0688d53ea8
commit
542d3431ff
5 changed files with 72 additions and 2 deletions
|
@ -16,7 +16,8 @@ public:
|
|||
{
|
||||
OM_FILEORLUMP = 0,
|
||||
OM_LUMP,
|
||||
OM_FILE
|
||||
OM_FILE,
|
||||
OM_ARCHIVE
|
||||
};
|
||||
|
||||
PathExpander(int om = OM_FILEORLUMP)
|
||||
|
|
|
@ -150,7 +150,37 @@ struct FExternalLump : public FResourceLump
|
|||
|
||||
};
|
||||
|
||||
struct FMemoryFile : public FUncompressedFile
|
||||
{
|
||||
MemoryArrayReader mr;
|
||||
|
||||
FMemoryFile(const char *_filename, const void *sdata, int length)
|
||||
: FUncompressedFile(_filename, nullptr), mr((const char *)sdata, length)
|
||||
{
|
||||
Reader = &mr;
|
||||
}
|
||||
|
||||
bool Open(bool quiet)
|
||||
{
|
||||
FString name(ExtractFileBase(Filename));
|
||||
FString fname(ExtractFileBase(Filename, true));
|
||||
|
||||
Lumps = new FUncompressedLump[1]; // must use array allocator
|
||||
uppercopy(Lumps->Name, name);
|
||||
Lumps->Name[8] = 0;
|
||||
Lumps->FullName = fname;
|
||||
Lumps->Owner = this;
|
||||
Lumps->Position = 0;
|
||||
Lumps->LumpSize = Reader->GetLength();
|
||||
Lumps->Namespace = ns_global;
|
||||
Lumps->Flags = 0;
|
||||
Lumps->FullName = NULL;
|
||||
NumLumps = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ extern void ChildSigHandler (int signum);
|
|||
#include "m_swap.h"
|
||||
#include "i_cd.h"
|
||||
#include "templates.h"
|
||||
#include "m_misc.h"
|
||||
#include "stats.h"
|
||||
#include "timidity/timidity.h"
|
||||
#include "vm.h"
|
||||
|
@ -663,6 +664,43 @@ void I_SetMusicVolume (float factor)
|
|||
snd_musicvolume.Callback();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void I_CollectSoundfonts()
|
||||
{
|
||||
FString path = M_GetDocumentsPath();
|
||||
TArray<FString> sffiles;
|
||||
const char *match;
|
||||
findstate_t c_file;
|
||||
void *file;
|
||||
|
||||
path << "/soundfonts/*";
|
||||
|
||||
if ((file = I_FindFirst(path, &c_file)) == ((void *)(-1)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
path.StripRight("*");
|
||||
do
|
||||
{
|
||||
if (!I_FindAttr(&c_file) & FA_DIREC)
|
||||
{
|
||||
FStringf name("%s%s", path.GetChars(), I_FindName(&c_file));
|
||||
sffiles.Push(name);
|
||||
}
|
||||
} while (I_FindNext(file, &c_file) == 0);
|
||||
I_FindClose(file);
|
||||
|
||||
auto soundfonts = new FWadCollection;
|
||||
soundfonts->InitMultipleFiles(sffiles);
|
||||
|
||||
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DObject, SetMusicVolume)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
|
|
|
@ -208,6 +208,7 @@ public:
|
|||
int GetNumWads () const;
|
||||
|
||||
int AddExternalFile(const char *filename);
|
||||
int AddData(const char *filename, int length);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in a new issue