MCPcopy Create free account
hub / github.com/EasyRPG/Player / ChangeGlobalSoundfont

Method ChangeGlobalSoundfont

src/decoder_fluidsynth.cpp:291–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291bool FluidSynthDecoder::ChangeGlobalSoundfont(std::string_view sf_path, std::string& status_message) {
292 if (!global_synth) {
293 return false;
294 }
295
296 pending_global_synth.reset(create_synth(status_message));
297
298 if (!pending_global_synth) {
299 return false;
300 }
301
302 if (sf_path.empty()) {
303 return load_default_sf(status_message, pending_global_synth.get());
304 }
305
306 if (fluid_synth_sfload(pending_global_synth.get(), ToString(sf_path).c_str(), 1) != FLUID_FAILED) {
307 status_message = fmt::format("Using soundfont {}", sf_path);
308 return true;
309 }
310
311 pending_global_synth.reset();
312 status_message = "Could not load soundfont.";
313 return false;
314}
315
316int FluidSynthDecoder::FillBuffer(uint8_t* buffer, int length) {
317 auto* instance_synth = GetSynthInstance();

Callers

nothing calls this directly

Calls 5

create_synthFunction · 0.85
load_default_sfFunction · 0.85
resetMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected