From 32e1605e1726398360efd111424a5f0981c88f0f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 25 Sep 2019 19:20:22 +0200 Subject: [PATCH] - fixed WildMidi. --- src/sound/wildmidi/file_io.cpp | 2 +- src/sound/wildmidi/wildmidi_lib.cpp | 10 +++++++++- src/sound/wildmidi/wildmidi_lib.h | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/sound/wildmidi/file_io.cpp b/src/sound/wildmidi/file_io.cpp index a7817c608..c4b6a9ee7 100644 --- a/src/sound/wildmidi/file_io.cpp +++ b/src/sound/wildmidi/file_io.cpp @@ -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; } } diff --git a/src/sound/wildmidi/wildmidi_lib.cpp b/src/sound/wildmidi/wildmidi_lib.cpp index d6aea8c4c..cf7b25ec0 100644 --- a/src/sound/wildmidi/wildmidi_lib.cpp +++ b/src/sound/wildmidi/wildmidi_lib.cpp @@ -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(); } diff --git a/src/sound/wildmidi/wildmidi_lib.h b/src/sound/wildmidi/wildmidi_lib.h index 39079afc5..d4d5fcfbf 100644 --- a/src/sound/wildmidi/wildmidi_lib.h +++ b/src/sound/wildmidi/wildmidi_lib.h @@ -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);