Skip to content

Commit

Permalink
FluidSynth: Apply music volume when using FluidSynth's own driver
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 30, 2012
1 parent 94a9634 commit a668e75
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doomsday/plugins/fluidsynth/include/driver_fluidsynth.h
Expand Up @@ -46,6 +46,8 @@ fluid_synth_t* DMFluid_Synth();
fluid_audio_driver_t* DMFluid_Driver();
audiointerface_sfx_generic_t* DMFluid_Sfx();

#define MAX_SYNTH_GAIN 0.4

#ifdef DENG_DSFLUIDSYNTH_DEBUG
# define DSFLUIDSYNTH_TRACE(args) std::cerr << "[dsFluidSynth] " << args << std::endl;
#else
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/fluidsynth/src/driver_fluidsynth.cpp
Expand Up @@ -61,7 +61,7 @@ int DS_Init(void)

// Set up a reasonable configuration.
fsConfig = new_fluid_settings();
fluid_settings_setnum(fsConfig, "synth.gain", 0.4);
fluid_settings_setnum(fsConfig, "synth.gain", MAX_SYNTH_GAIN);

// Create the synthesizer.
fsSynth = new_fluid_synth(fsConfig);
Expand Down
4 changes: 4 additions & 0 deletions doomsday/plugins/fluidsynth/src/fluidsynth_music.cpp
Expand Up @@ -386,6 +386,10 @@ void DM_Music_Set(int prop, float value)
{
DMFluid_Sfx()->Set(sfxBuf, SFXBP_VOLUME, musicVolume);
}
else if(DMFluid_Driver())
{
fluid_synth_set_gain(DMFluid_Synth(), MAX_SYNTH_GAIN * musicVolume);
}
DSFLUIDSYNTH_TRACE("Music_Set: MUSIP_VOLUME = " << musicVolume);
break;

Expand Down

0 comments on commit a668e75

Please sign in to comment.