- fixed WildMidi.

This commit is contained in:
Christoph Oelckers 2019-09-25 19:20:22 +02:00
parent 4369220335
commit 32e1605e17
3 changed files with 12 additions and 3 deletions

View File

@ -75,10 +75,10 @@ unsigned char *_WM_BufferFile(SoundFontReaderInterface *reader, const char *file
fp->seek(0, SEEK_SET);
fp->read(data, fsize);
if (fullname)* fullname = fp->filename;
fp->close();
data[fsize] = 0;
*size = (long)fsize;
if (fullname) *fullname = fp->filename;
return data;
}
}

View File

@ -635,7 +635,7 @@ int Instruments::LoadConfig(const char *config_parm)
// This part was rewritten because the original depended on a header that was GPL'd.
dir_end = strrchr(config_file, '/');
#ifdef _WIN32
const char *dir_end2 = strrchr(config_file.c, '\\');
const char *dir_end2 = strrchr(config_file, '\\');
if (dir_end2 > dir_end) dir_end = dir_end2;
#endif
@ -1323,6 +1323,13 @@ void Instruments::load_patch(struct _mdi *mdi, unsigned short patchid)
tmp_patch->inuse_count++;
}
Instruments::~Instruments()
{
FreePatches();
delete sfreader;
}
static struct _sample *get_sample_data(struct _patch *sample_patch, unsigned long int freq)
{
struct _sample *last_sample = NULL;
@ -2517,6 +2524,7 @@ int Renderer::SetOption(int options, int setting)
Renderer::Renderer(Instruments *instr, unsigned mixOpt)
{
init_gauss();
instruments = instr;
WM_MixerOptions = mixOpt;
handle = NewMidi();
}

View File

@ -75,7 +75,8 @@ struct Instruments
sfreader = reader;
_WM_SampleRate = samplerate;
}
~Instruments();
int LoadConfig(const char *config_file);
int load_sample(struct _patch *sample_patch);
struct _patch *get_patch_data(unsigned short patchid);