- 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->seek(0, SEEK_SET);
fp->read(data, fsize); fp->read(data, fsize);
if (fullname)* fullname = fp->filename;
fp->close(); fp->close();
data[fsize] = 0; data[fsize] = 0;
*size = (long)fsize; *size = (long)fsize;
if (fullname) *fullname = fp->filename;
return data; 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. // This part was rewritten because the original depended on a header that was GPL'd.
dir_end = strrchr(config_file, '/'); dir_end = strrchr(config_file, '/');
#ifdef _WIN32 #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; if (dir_end2 > dir_end) dir_end = dir_end2;
#endif #endif
@ -1323,6 +1323,13 @@ void Instruments::load_patch(struct _mdi *mdi, unsigned short patchid)
tmp_patch->inuse_count++; tmp_patch->inuse_count++;
} }
Instruments::~Instruments()
{
FreePatches();
delete sfreader;
}
static struct _sample *get_sample_data(struct _patch *sample_patch, unsigned long int freq) static struct _sample *get_sample_data(struct _patch *sample_patch, unsigned long int freq)
{ {
struct _sample *last_sample = NULL; struct _sample *last_sample = NULL;
@ -2517,6 +2524,7 @@ int Renderer::SetOption(int options, int setting)
Renderer::Renderer(Instruments *instr, unsigned mixOpt) Renderer::Renderer(Instruments *instr, unsigned mixOpt)
{ {
init_gauss(); init_gauss();
instruments = instr;
WM_MixerOptions = mixOpt; WM_MixerOptions = mixOpt;
handle = NewMidi(); handle = NewMidi();
} }

View file

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