- Add a default search for Creative's CT4MGM.SF2 on Windows if fluid_patchset is unspecified.

- Use fluid_patchset to specify the SoundFont(s) for FluidSynth instead of doubling up with
  snd_midipatchset, which is already used by FMOD.

SVN r2555 (trunk)
This commit is contained in:
Randy Heit 2010-08-19 15:46:49 +00:00
parent 576e597d2b
commit 2c397b1aac
3 changed files with 20 additions and 9 deletions

View file

@ -101,7 +101,6 @@ EXTERN_CVAR (Int, snd_buffersize)
EXTERN_CVAR (Int, snd_samplerate) EXTERN_CVAR (Int, snd_samplerate)
EXTERN_CVAR (Bool, snd_pitched) EXTERN_CVAR (Bool, snd_pitched)
EXTERN_CVAR (Int, snd_channels) EXTERN_CVAR (Int, snd_channels)
EXTERN_CVAR (String, snd_midipatchset)
extern int sfx_empty; extern int sfx_empty;
@ -117,6 +116,7 @@ CVAR (String, snd_resampler, "Linear", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, snd_speakermode, "Auto", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (String, snd_speakermode, "Auto", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, snd_output_format, "PCM-16", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (String, snd_output_format, "PCM-16", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, snd_profile, false, 0) CVAR (Bool, snd_profile, false, 0)
CVAR (String, snd_midipatchset, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
// Underwater low-pass filter cutoff frequency. Set to 0 to disable the filter. // Underwater low-pass filter cutoff frequency. Set to 0 to disable the filter.
CUSTOM_CVAR (Float, snd_waterlp, 250, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Float, snd_waterlp, 250, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)

View file

@ -55,12 +55,12 @@
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
EXTERN_CVAR(String, snd_midipatchset)
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
CVAR(String, fluid_patchset, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Float, fluid_gain, 0.5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR(Float, fluid_gain, 0.5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{ {
if (self < 0) if (self < 0)
@ -143,16 +143,29 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice()
{ {
Printf("Failed to set interpolation method %d.\n", *fluid_interp); Printf("Failed to set interpolation method %d.\n", *fluid_interp);
} }
if (0 == LoadPatchSets(snd_midipatchset)) if (0 == LoadPatchSets(fluid_patchset))
{ {
#ifdef unix #ifdef unix
// This is the standard location on Ubuntu. // This is the standard location on Ubuntu.
if (0 == LoadPatchSets("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2")) if (0 == LoadPatchSets("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2"))
{ {
#endif #endif
Printf("Failed to load any MIDI patches.\n"); #ifdef _WIN32
delete_fluid_synth(FluidSynth); // On Windows, look for the 4 megabyte patch set installed by Creative's drivers as a default.
FluidSynth = NULL; char sysdir[MAX_PATH+sizeof("\\CT4MGM.SF2")];
if (0 != GetSystemDirectoryA(sysdir, MAX_PATH))
{
strcat(sysdir, "\\CT4MGM.SF2");
if (0 == LoadPatchSets(sysdir))
{
#endif
Printf("Failed to load any MIDI patches.\n");
delete_fluid_synth(FluidSynth);
FluidSynth = NULL;
#ifdef _WIN32
}
}
#endif
#ifdef unix #ifdef unix
} }
#endif #endif

View file

@ -10,8 +10,6 @@
static DWORD nummididevices; static DWORD nummididevices;
static bool nummididevicesset; static bool nummididevicesset;
CVAR (String, snd_midipatchset, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
#ifdef _WIN32 #ifdef _WIN32
UINT mididevice; UINT mididevice;