- moved the last static variable - def_inst_name into the Instruments class.

With this the GUS device should be fully reentrant.
This commit is contained in:
Christoph Oelckers 2019-09-27 20:40:19 +02:00
parent 1cb668e895
commit 9aecabc887
2 changed files with 3 additions and 4 deletions

View file

@ -38,8 +38,6 @@
namespace Timidity namespace Timidity
{ {
static std::string def_instr_name;
static long ParseCommandLine(const char* args, int* argc, char** argv) static long ParseCommandLine(const char* args, int* argc, char** argv)
{ {
int count; int count;
@ -718,8 +716,8 @@ Renderer::Renderer(float sample_rate, int voices_, Instruments *inst)
default_instrument = NULL; default_instrument = NULL;
default_program = DEFAULT_PROGRAM; default_program = DEFAULT_PROGRAM;
if (def_instr_name.length() > 0) if (inst->def_instr_name.length() > 0)
set_default_instrument(def_instr_name.c_str()); set_default_instrument(inst->def_instr_name.c_str());
voices = std::max(voices_, 16); voices = std::max(voices_, 16);
voice = new Voice[voices]; voice = new Voice[voices];

View file

@ -168,6 +168,7 @@ public:
ToneBank* tonebank[MAXBANK] = {}; ToneBank* tonebank[MAXBANK] = {};
ToneBank* drumset[MAXBANK] = {}; ToneBank* drumset[MAXBANK] = {};
FontFile* Fonts = nullptr; FontFile* Fonts = nullptr;
std::string def_instr_name;
Instruments(SoundFontReaderInterface* reader); Instruments(SoundFontReaderInterface* reader);
~Instruments(); ~Instruments();