Skip to content

Commit

Permalink
Fix #7189: Fluidsynth volume gain too high
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Feb 19, 2019
1 parent 21d8636 commit e90ae12
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/music/fluidsynth.cpp
Expand Up @@ -149,7 +149,11 @@ bool MusicDriver_FluidSynth::IsSongPlaying()
void MusicDriver_FluidSynth::SetVolume(byte vol)
{
/* Allowed range of synth.gain is 0.0 to 10.0 */
if (fluid_settings_setnum(_midi.settings, "synth.gain", 1.0 * vol / 128.0) != 1) {
/* fluidsynth's default gain is 0.2, so use this as "full
volume". Set gain using OpenTTD's volume, as a number between 0
and 0.2. */
double gain = (1.0 * vol) / (128.0 * 5.0);
if (fluid_settings_setnum(_midi.settings, "synth.gain", gain) != 1) {
DEBUG(driver, 0, "Could not set volume");
}
}

0 comments on commit e90ae12

Please sign in to comment.