- Start of soundfont refactoring. This does not compile yet!

This commit is contained in:
Christoph Oelckers 2018-02-22 07:21:19 +01:00
parent 0688d53ea8
commit 542d3431ff
5 changed files with 72 additions and 2 deletions

View File

@ -1541,7 +1541,7 @@ void ParseCVarInfo()
{
GameConfig->DoModSetup (gameinfo.ConfigName);
}
}
}
//==========================================================================
//

View File

@ -16,7 +16,8 @@ public:
{
OM_FILEORLUMP = 0,
OM_LUMP,
OM_FILE
OM_FILE,
OM_ARCHIVE
};
PathExpander(int om = OM_FILEORLUMP)

View File

@ -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;
}
};

View File

@ -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;

View File

@ -208,6 +208,7 @@ public:
int GetNumWads () const;
int AddExternalFile(const char *filename);
int AddData(const char *filename, int length);
protected: