| 192 | } |
| 193 | |
| 194 | FluidSynthDecoder::FluidSynthDecoder() { |
| 195 | ++instances; |
| 196 | |
| 197 | // Optimisation: Only create the soundfont once and share the synth |
| 198 | // Sharing is only not possible when a Midi is played as a SE (unlikely) |
| 199 | if (instances > 1) { |
| 200 | std::string error_message; |
| 201 | local_synth = create_synth(error_message); |
| 202 | if (!local_synth) { |
| 203 | // unlikely, the SF was already allocated once |
| 204 | Output::Debug("FluidSynth failed: {}", error_message); |
| 205 | } |
| 206 | } else { |
| 207 | use_global_synth = true; |
| 208 | fluid_synth_program_reset(global_synth.get()); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | FluidSynthDecoder::~FluidSynthDecoder() { |
| 213 | --instances; |
nothing calls this directly
no test coverage detected