From 9aecabc88748cd8864d85b1f22203e75c4c5dd91 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Sep 2019 20:40:19 +0200 Subject: [PATCH] - moved the last static variable - def_inst_name into the Instruments class. With this the GUS device should be fully reentrant. --- libraries/timidity/timidity.cpp | 6 ++---- libraries/timidity/timidity/instrum.h | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/timidity/timidity.cpp b/libraries/timidity/timidity.cpp index 12055c303..cfc6f331b 100644 --- a/libraries/timidity/timidity.cpp +++ b/libraries/timidity/timidity.cpp @@ -38,8 +38,6 @@ namespace Timidity { -static std::string def_instr_name; - static long ParseCommandLine(const char* args, int* argc, char** argv) { int count; @@ -718,8 +716,8 @@ Renderer::Renderer(float sample_rate, int voices_, Instruments *inst) default_instrument = NULL; default_program = DEFAULT_PROGRAM; - if (def_instr_name.length() > 0) - set_default_instrument(def_instr_name.c_str()); + if (inst->def_instr_name.length() > 0) + set_default_instrument(inst->def_instr_name.c_str()); voices = std::max(voices_, 16); voice = new Voice[voices]; diff --git a/libraries/timidity/timidity/instrum.h b/libraries/timidity/timidity/instrum.h index 452327fbe..cc14dba1e 100644 --- a/libraries/timidity/timidity/instrum.h +++ b/libraries/timidity/timidity/instrum.h @@ -168,6 +168,7 @@ public: ToneBank* tonebank[MAXBANK] = {}; ToneBank* drumset[MAXBANK] = {}; FontFile* Fonts = nullptr; + std::string def_instr_name; Instruments(SoundFontReaderInterface* reader); ~Instruments();