Skip to content

Commit

Permalink
Fix build when Fluidsynth is missing or Fluidlite is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Dec 20, 2023
1 parent 1edc137 commit b45717e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/audio_midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ void MidiDecoder::ChangeFluidsynthSoundfont(StringView sf_path) {
return;
}

#if defined(HAVE_FLUIDSYNTH) || defined(HAVE_FLUIDLITE)
// Was initialized before
works.fluidsynth = FluidSynthDecoder::ChangeGlobalSoundfont(sf_path, works.fluidsynth_status);
#endif
}

bool MidiDecoder::CheckWildMidi(std::string &status_message) {
Expand Down
4 changes: 4 additions & 0 deletions src/config_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ namespace {
return std::to_string(i);
}

inline std::string ParamValueToString(double d) {
return std::to_string(d);
}

inline std::string ParamValueToString(bool b) {
return b ? "[ON]" : "[OFF]";
}
Expand Down
4 changes: 2 additions & 2 deletions src/decoder_fluidsynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static bool load_default_sf(std::string& status_message, fluid_synth_t* syn, int

#if FLUIDSYNTH_VERSION_MAJOR >= 2
char* default_sf = nullptr;
if (fluid_settings_dupstr(global_settings.get(), "synth.default-soundfont", &default_sf) == FLUID_OK) {
if (fluid_settings_dupstr(global_settings.get(), "synth.default-soundfont", &default_sf) == 0) {
if (default_sf != nullptr && default_sf[0] != '\0') {
sf_paths.emplace_back(default_sf);
}
Expand Down Expand Up @@ -298,7 +298,7 @@ bool FluidSynthDecoder::ChangeGlobalSoundfont(StringView sf_path, std::string& s

int new_global_id = fluid_synth_sfload(global_synth.get(), ToString(sf_path).c_str(), 1);
if (new_global_id != FLUID_FAILED) {
assert(fluid_synth_sfunload(global_synth.get(), global_synth_id, 1) == FLUID_OK);
assert(fluid_synth_sfunload(global_synth.get(), global_synth_id, 1) == 0);
global_synth_id = new_global_id;
status_message = fmt::format("Using soundfont {}", sf_path);
return true;
Expand Down
1 change: 0 additions & 1 deletion src/scene_title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ void Scene_Title::CreateHelpWindow() {
translate_window->SetHelpWindow(help_window.get());
}


void Scene_Title::Continue(SceneType prev_scene) {
Main_Data::game_system->ResetSystemGraphic();

Expand Down

0 comments on commit b45717e

Please sign in to comment.