mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-23 11:51:26 +00:00
- more work on music code
- renamed the FluidSetting functions to ChangeSetting so that they can be used as a generic means to change music player options without overloading the virtual function table for each minor thing. - pass Printf as a parameter to the MIDI renderer to uncouple it from the main GZDoom code. - throw exceptions when setting up the renderer fails so that this can be handled consistently for all construction errors here. - delete FluidSynth handles before the constructor aborts.
This commit is contained in:
parent
8b6af8726e
commit
726f65e91b
7 changed files with 100 additions and 101 deletions
|
@ -69,3 +69,4 @@ CUSTOM_CVAR(Int, adl_volume_model, ADLMIDI_VolumeModel_DMX, CVAR_ARCHIVE | CVAR_
|
|||
CheckRestart(MDEV_ADL);
|
||||
adlConfig.adl_volume_model = self;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,12 +83,13 @@ ADLMIDIDevice::ADLMIDIDevice(const char *args, const ADLConfig *config)
|
|||
{
|
||||
adl_switchEmulator(Renderer, config->adl_emulator_id);
|
||||
adl_setRunAtPcmRate(Renderer, config->adl_run_at_pcm_rate);
|
||||
if(!LoadCustomBank(config->adl_custom_bank, config))
|
||||
if (!LoadCustomBank(config->adl_custom_bank, config))
|
||||
adl_setBank(Renderer, config->adl_bank);
|
||||
adl_setNumChips(Renderer, config->adl_chips_count);
|
||||
adl_setVolumeRangeModel(Renderer, config->adl_volume_model);
|
||||
adl_setSoftPanEnabled(Renderer, config->adl_fullpan);
|
||||
}
|
||||
else throw std::runtime_error("Failed to create ADL MIDI renderer.");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -59,14 +59,14 @@ struct fluid_synth_t;
|
|||
class FluidSynthMIDIDevice : public SoftSynthMIDIDevice
|
||||
{
|
||||
public:
|
||||
FluidSynthMIDIDevice(const char *args, int samplerate);
|
||||
FluidSynthMIDIDevice(const char *args, int samplerate, int (*printfunc_)(const char *, ...));
|
||||
~FluidSynthMIDIDevice();
|
||||
|
||||
int Open(MidiCallback, void *userdata);
|
||||
FString GetStats();
|
||||
void FluidSettingInt(const char *setting, int value);
|
||||
void FluidSettingNum(const char *setting, double value);
|
||||
void FluidSettingStr(const char *setting, const char *value);
|
||||
void ChangeSettingInt(const char *setting, int value);
|
||||
void ChangeSettingNum(const char *setting, double value);
|
||||
void ChangeSettingString(const char *setting, const char *value);
|
||||
int GetDeviceType() const override { return MDEV_FLUIDSYNTH; }
|
||||
|
||||
protected:
|
||||
|
@ -77,6 +77,7 @@ protected:
|
|||
|
||||
fluid_settings_t *FluidSettings;
|
||||
fluid_synth_t *FluidSynth;
|
||||
int (*printfunc)(const char*, ...);
|
||||
|
||||
#ifdef DYN_FLUIDSYNTH
|
||||
enum { FLUID_FAILED = -1, FLUID_OK = 0 };
|
||||
|
@ -139,19 +140,9 @@ extern "C" unsigned __stdcall GetSystemDirectoryA(char *lpBuffer, unsigned uSize
|
|||
#endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#define FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f
|
||||
#define FLUID_REVERB_DEFAULT_DAMP 0.0f
|
||||
#define FLUID_REVERB_DEFAULT_WIDTH 0.5f
|
||||
#define FLUID_REVERB_DEFAULT_LEVEL 0.9f
|
||||
|
||||
#define FLUID_CHORUS_MOD_SINE 0
|
||||
#define FLUID_CHORUS_MOD_TRIANGLE 1
|
||||
|
||||
#define FLUID_CHORUS_DEFAULT_N 3
|
||||
#define FLUID_CHORUS_DEFAULT_LEVEL 2.0f
|
||||
#define FLUID_CHORUS_DEFAULT_SPEED 0.3f
|
||||
#define FLUID_CHORUS_DEFAULT_DEPTH 8.0f
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FLUID_CHORUS_DEFAULT_TYPE
|
||||
|
@ -191,19 +182,19 @@ CUSTOM_CVAR(Float, fluid_gain, 0.5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 10)
|
||||
self = 10;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingNum("synth.gain", self);
|
||||
currSong->ChangeSettingNum("fluidsynth.synth.gain", self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, fluid_reverb, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (currSong != NULL)
|
||||
currSong->FluidSettingInt("synth.reverb.active", self);
|
||||
currSong->ChangeSettingInt("fluidsynth.synth.reverb.active", self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, fluid_chorus, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (currSong != NULL)
|
||||
currSong->FluidSettingInt("synth.chorus.active", self);
|
||||
currSong->ChangeSettingInt("fluidsynth.synth.chorus.active", self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, fluid_voices, 128, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -213,7 +204,7 @@ CUSTOM_CVAR(Int, fluid_voices, 128, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 4096)
|
||||
self = 4096;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("synth.polyphony", self);
|
||||
currSong->ChangeSettingInt("fluidsynth.synth.polyphony", self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, fluid_interp, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -233,7 +224,7 @@ CUSTOM_CVAR(Int, fluid_interp, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self == 6 || self > 7)
|
||||
self = 7;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("synth.interpolation", self);
|
||||
currSong->ChangeSettingInt("fluidsynth.synth.interpolation", self);
|
||||
}
|
||||
|
||||
CVAR(Int, fluid_samplerate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -255,7 +246,7 @@ CUSTOM_CVAR(Float, fluid_reverb_roomsize, 0.61f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 1.2f)
|
||||
self = 1.2f;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.reverb-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.reverb-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, fluid_reverb_damping, 0.23f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -265,7 +256,7 @@ CUSTOM_CVAR(Float, fluid_reverb_damping, 0.23f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 1)
|
||||
self = 1;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.reverb-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.reverb-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, fluid_reverb_width, 0.76f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -275,7 +266,7 @@ CUSTOM_CVAR(Float, fluid_reverb_width, 0.76f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 100)
|
||||
self = 100;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.reverb-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.reverb-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, fluid_reverb_level, 0.57f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -285,7 +276,7 @@ CUSTOM_CVAR(Float, fluid_reverb_level, 0.57f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 1)
|
||||
self = 1;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.reverb-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.reverb-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, fluid_chorus_voices, 3, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -295,7 +286,7 @@ CUSTOM_CVAR(Int, fluid_chorus_voices, 3, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 99)
|
||||
self = 99;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.chorus-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.chorus-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, fluid_chorus_level, 1.2f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -305,7 +296,7 @@ CUSTOM_CVAR(Float, fluid_chorus_level, 1.2f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 1)
|
||||
self = 1;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.chorus-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.chorus-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, fluid_chorus_speed, 0.3f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -315,7 +306,7 @@ CUSTOM_CVAR(Float, fluid_chorus_speed, 0.3f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 5)
|
||||
self = 5;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.chorus-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.chorus-changed", 0);
|
||||
}
|
||||
|
||||
// depth is in ms and actual maximum depends on the sample rate
|
||||
|
@ -326,7 +317,7 @@ CUSTOM_CVAR(Float, fluid_chorus_depth, 8, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
else if (self > 21)
|
||||
self = 21;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.chorus-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.chorus-changed", 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, fluid_chorus_type, FLUID_CHORUS_DEFAULT_TYPE, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -334,7 +325,7 @@ CUSTOM_CVAR(Int, fluid_chorus_type, FLUID_CHORUS_DEFAULT_TYPE, CVAR_ARCHIVE|CVAR
|
|||
if (self != FLUID_CHORUS_MOD_SINE && self != FLUID_CHORUS_MOD_TRIANGLE)
|
||||
self = FLUID_CHORUS_DEFAULT_TYPE;
|
||||
else if (currSong != NULL)
|
||||
currSong->FluidSettingInt("z.chorus-changed", 0);
|
||||
currSong->ChangeSettingInt("fluidsynth.z.chorus-changed", 0);
|
||||
}
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
@ -345,22 +336,22 @@ CUSTOM_CVAR(Int, fluid_chorus_type, FLUID_CHORUS_DEFAULT_TYPE, CVAR_ARCHIVE|CVAR
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FluidSynthMIDIDevice::FluidSynthMIDIDevice(const char *args, int samplerate)
|
||||
FluidSynthMIDIDevice::FluidSynthMIDIDevice(const char *args, int samplerate, int (*printfunc_)(const char*, ...) = nullptr)
|
||||
: SoftSynthMIDIDevice(samplerate <= 0? fluid_samplerate : samplerate, 22050, 96000)
|
||||
{
|
||||
printfunc = printfunc_;
|
||||
FluidSynth = NULL;
|
||||
FluidSettings = NULL;
|
||||
#ifdef DYN_FLUIDSYNTH
|
||||
if (!LoadFluidSynth())
|
||||
LoadFluidSynth();
|
||||
{
|
||||
return;
|
||||
throw std::runtime_error("Failed to load FluidSynth.\n");
|
||||
}
|
||||
#endif
|
||||
FluidSettings = new_fluid_settings();
|
||||
if (FluidSettings == NULL)
|
||||
{
|
||||
printf("Failed to create FluidSettings.\n");
|
||||
return;
|
||||
throw std::runtime_error("Failed to create FluidSettings.\n");
|
||||
}
|
||||
fluid_settings_setnum(FluidSettings, "synth.sample-rate", SampleRate);
|
||||
fluid_settings_setnum(FluidSettings, "synth.gain", fluid_gain);
|
||||
|
@ -371,8 +362,8 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice(const char *args, int samplerate)
|
|||
FluidSynth = new_fluid_synth(FluidSettings);
|
||||
if (FluidSynth == NULL)
|
||||
{
|
||||
Printf("Failed to create FluidSynth.\n");
|
||||
return;
|
||||
delete_fluid_settings(FluidSettings);
|
||||
throw std::runtime_error("Failed to create FluidSynth.\n");
|
||||
}
|
||||
fluid_synth_set_interp_method(FluidSynth, -1, fluid_interp);
|
||||
fluid_synth_set_reverb(FluidSynth, fluid_reverb_roomsize, fluid_reverb_damping,
|
||||
|
@ -421,9 +412,11 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice(const char *args, int samplerate)
|
|||
|
||||
#endif
|
||||
|
||||
delete_fluid_settings(FluidSettings);
|
||||
delete_fluid_synth(FluidSynth);
|
||||
FluidSynth = NULL;
|
||||
I_Error("Failed to load any MIDI patches.\n");
|
||||
FluidSynth = nullptr;
|
||||
FluidSettings = nullptr;
|
||||
throw std::runtime_error("Failed to load any MIDI patches.\n");
|
||||
|
||||
}
|
||||
|
||||
|
@ -595,17 +588,17 @@ int FluidSynthMIDIDevice::LoadPatchSets(const char *patches)
|
|||
{
|
||||
if (FLUID_FAILED != fluid_synth_sfload(FluidSynth, path, count == 0))
|
||||
{
|
||||
DPrintf(DMSG_NOTIFY, "Loaded patch set %s.\n", tok);
|
||||
//DPrintf(DMSG_NOTIFY, "Loaded patch set %s.\n", tok);
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPrintf(DMSG_ERROR, "Failed to load patch set %s.\n", tok);
|
||||
if (printfunc) printfunc("Failed to load patch set %s.\n", tok);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPrintf(DMSG_ERROR, "Could not find patch set %s.\n", tok);
|
||||
if (printfunc) printfunc("Could not find patch set %s.\n", tok);
|
||||
}
|
||||
tok = strtok(NULL, delim);
|
||||
}
|
||||
|
@ -615,31 +608,32 @@ int FluidSynthMIDIDevice::LoadPatchSets(const char *patches)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// FluidSynthMIDIDevice :: FluidSettingInt
|
||||
// FluidSynthMIDIDevice :: ChangeSettingInt
|
||||
//
|
||||
// Changes an integer setting.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FluidSynthMIDIDevice::FluidSettingInt(const char *setting, int value)
|
||||
void FluidSynthMIDIDevice::ChangeSettingInt(const char *setting, int value)
|
||||
{
|
||||
if (FluidSynth == NULL || FluidSettings == NULL)
|
||||
if (FluidSynth == nullptr || FluidSettings == nullptr || strncmp(setting, "fluidsynth.", 11))
|
||||
{
|
||||
return;
|
||||
}
|
||||
setting += 11;
|
||||
|
||||
if (strcmp(setting, "synth.interpolation") == 0)
|
||||
{
|
||||
if (FLUID_OK != fluid_synth_set_interp_method(FluidSynth, -1, value))
|
||||
{
|
||||
Printf("Setting interpolation method %d failed.\n", value);
|
||||
if (printfunc) printfunc("Setting interpolation method %d failed.\n", value);
|
||||
}
|
||||
}
|
||||
else if (strcmp(setting, "synth.polyphony") == 0)
|
||||
{
|
||||
if (FLUID_OK != fluid_synth_set_polyphony(FluidSynth, value))
|
||||
{
|
||||
Printf("Setting polyphony to %d failed.\n", value);
|
||||
if (printfunc) printfunc("Setting polyphony to %d failed.\n", value);
|
||||
}
|
||||
}
|
||||
else if (strcmp(setting, "z.reverb-changed") == 0)
|
||||
|
@ -654,7 +648,7 @@ void FluidSynthMIDIDevice::FluidSettingInt(const char *setting, int value)
|
|||
}
|
||||
else if (0 == fluid_settings_setint(FluidSettings, setting, value))
|
||||
{
|
||||
Printf("Failed to set %s to %d.\n", setting, value);
|
||||
if (printfunc) printfunc("Failed to set %s to %d.\n", setting, value);
|
||||
}
|
||||
// fluid_settings_setint succeeded; update these settings in the running synth, too
|
||||
else if (strcmp(setting, "synth.reverb.active") == 0)
|
||||
|
@ -669,39 +663,45 @@ void FluidSynthMIDIDevice::FluidSettingInt(const char *setting, int value)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// FluidSynthMIDIDevice :: FluidSettingNum
|
||||
// FluidSynthMIDIDevice :: ChangeSettingNum
|
||||
//
|
||||
// Changes a numeric setting.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FluidSynthMIDIDevice::FluidSettingNum(const char *setting, double value)
|
||||
void FluidSynthMIDIDevice::ChangeSettingNum(const char *setting, double value)
|
||||
{
|
||||
if (FluidSettings != NULL)
|
||||
if (FluidSynth == nullptr || FluidSettings == nullptr || strncmp(setting, "fluidsynth.", 11))
|
||||
{
|
||||
if (0 == fluid_settings_setnum(FluidSettings, setting, value))
|
||||
{
|
||||
Printf("Failed to set %s to %g.\n", setting, value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
setting += 11;
|
||||
|
||||
if (0 == fluid_settings_setnum(FluidSettings, setting, value))
|
||||
{
|
||||
if (printfunc) printfunc("Failed to set %s to %g.\n", setting, value);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FluidSynthMIDIDevice :: FluidSettingStr
|
||||
// FluidSynthMIDIDevice :: ChangeSettingString
|
||||
//
|
||||
// Changes a string setting.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FluidSynthMIDIDevice::FluidSettingStr(const char *setting, const char *value)
|
||||
void FluidSynthMIDIDevice::ChangeSettingString(const char *setting, const char *value)
|
||||
{
|
||||
if (FluidSettings != NULL)
|
||||
if (FluidSynth == nullptr || FluidSettings == nullptr || strncmp(setting, "fluidsynth.", 11))
|
||||
{
|
||||
if (0 == fluid_settings_setstr(FluidSettings, setting, value))
|
||||
{
|
||||
Printf("Failed to set %s to %s.\n", setting, value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
setting += 11;
|
||||
|
||||
if (0 == fluid_settings_setstr(FluidSettings, setting, value))
|
||||
{
|
||||
if (printfunc) printfunc("Failed to set %s to %s.\n", setting, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,10 +728,7 @@ FString FluidSynthMIDIDevice::GetStats()
|
|||
fluid_settings_getint(FluidSettings, "synth.reverb.active", &reverb);
|
||||
fluid_settings_getint(FluidSettings, "synth.polyphony", &maxpoly);
|
||||
|
||||
out.Format("Voices: " TEXTCOLOR_YELLOW "%3d" TEXTCOLOR_NORMAL "/" TEXTCOLOR_ORANGE "%3d" TEXTCOLOR_NORMAL "(" TEXTCOLOR_RED "%3d" TEXTCOLOR_NORMAL ")"
|
||||
TEXTCOLOR_YELLOW "%6.2f" TEXTCOLOR_NORMAL "%% CPU "
|
||||
"Reverb: " TEXTCOLOR_YELLOW "%3s" TEXTCOLOR_NORMAL
|
||||
" Chorus: " TEXTCOLOR_YELLOW "%3s",
|
||||
out.Format("Voices: %3d/%3d(%3d) %6.2f%% CPU Reverb: %3s Chorus: %3s",
|
||||
voices, polyphony, maxpoly, load, reverb ? "yes" : "no", chorus ? "yes" : "no");
|
||||
return out;
|
||||
}
|
||||
|
@ -784,7 +781,7 @@ bool FluidSynthMIDIDevice::LoadFluidSynth()
|
|||
if(!FluidSynthModule.Load({fluid_lib}))
|
||||
{
|
||||
const char* libname = fluid_lib;
|
||||
Printf(TEXTCOLOR_RED "Could not load %s\n", libname);
|
||||
if (printfunc) printfunc("Could not load %s\n", libname);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
@ -793,13 +790,13 @@ bool FluidSynthMIDIDevice::LoadFluidSynth()
|
|||
#ifdef FLUIDSYNTHLIB2
|
||||
if(!FluidSynthModule.Load({FLUIDSYNTHLIB1, FLUIDSYNTHLIB2}))
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Could not load " FLUIDSYNTHLIB1 " or " FLUIDSYNTHLIB2 "\n");
|
||||
if (printfunc) printfunc("Could not load " FLUIDSYNTHLIB1 " or " FLUIDSYNTHLIB2 "\n");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if(!FluidSynthModule.Load({fluid_lib, FLUIDSYNTHLIB1}))
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Could not load " FLUIDSYNTHLIB1 ": %s\n", dlerror());
|
||||
if (printfunc) printfunc("Could not load " FLUIDSYNTHLIB1 ": %s\n", dlerror());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -825,7 +822,7 @@ void FluidSynthMIDIDevice::UnloadFluidSynth()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
MIDIDevice *CreateFluidSynthMIDIDevice(const char *args, int samplerate)
|
||||
MIDIDevice *CreateFluidSynthMIDIDevice(const char *args, int samplerate, int (*printfunc)(const char*, ...))
|
||||
{
|
||||
return new FluidSynthMIDIDevice(args, samplerate);
|
||||
return new FluidSynthMIDIDevice(args, samplerate, printfunc);
|
||||
}
|
||||
|
|
|
@ -261,15 +261,15 @@ void MusInfo::GMEDepthChanged(float val)
|
|||
{
|
||||
}
|
||||
|
||||
void MusInfo::FluidSettingInt(const char *, int)
|
||||
void MusInfo::ChangeSettingInt(const char *, int)
|
||||
{
|
||||
}
|
||||
|
||||
void MusInfo::FluidSettingNum(const char *, double)
|
||||
void MusInfo::ChangeSettingNum(const char *, double)
|
||||
{
|
||||
}
|
||||
|
||||
void MusInfo::FluidSettingStr(const char *, const char *)
|
||||
void MusInfo::ChangeSettingString(const char *, const char *)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -79,9 +79,9 @@ public:
|
|||
virtual FString GetStats();
|
||||
virtual MusInfo *GetOPLDumper(const char *filename);
|
||||
virtual MusInfo *GetWaveDumper(const char *filename, int rate);
|
||||
virtual void FluidSettingInt(const char *setting, int value); // FluidSynth settings
|
||||
virtual void FluidSettingNum(const char *setting, double value); // "
|
||||
virtual void FluidSettingStr(const char *setting, const char *value); // "
|
||||
virtual void ChangeSettingInt(const char *setting, int value); // FluidSynth settings
|
||||
virtual void ChangeSettingNum(const char *setting, double value); // "
|
||||
virtual void ChangeSettingString(const char *setting, const char *value); // "
|
||||
virtual void WildMidiSetOption(int opt, int set);
|
||||
virtual void GMEDepthChanged(float val);
|
||||
|
||||
|
|
|
@ -69,9 +69,9 @@ public:
|
|||
virtual void InitPlayback();
|
||||
virtual bool Update();
|
||||
virtual void PrecacheInstruments(const uint16_t *instruments, int count);
|
||||
virtual void FluidSettingInt(const char *setting, int value);
|
||||
virtual void FluidSettingNum(const char *setting, double value);
|
||||
virtual void FluidSettingStr(const char *setting, const char *value);
|
||||
virtual void ChangeSettingInt(const char *setting, int value);
|
||||
virtual void ChangeSettingNum(const char *setting, double value);
|
||||
virtual void ChangeSettingString(const char *setting, const char *value);
|
||||
virtual void WildMidiSetOption(int opt, int set);
|
||||
virtual bool Preprocess(MIDIStreamer *song, bool looping);
|
||||
virtual FString GetStats();
|
||||
|
@ -215,9 +215,9 @@ public:
|
|||
bool SetSubsong(int subsong) override;
|
||||
void Update() override;
|
||||
FString GetStats() override;
|
||||
void FluidSettingInt(const char *setting, int value) override;
|
||||
void FluidSettingNum(const char *setting, double value) override;
|
||||
void FluidSettingStr(const char *setting, const char *value) override;
|
||||
void ChangeSettingInt(const char *setting, int value) override;
|
||||
void ChangeSettingNum(const char *setting, double value) override;
|
||||
void ChangeSettingString(const char *setting, const char *value) override;
|
||||
void WildMidiSetOption(int opt, int set) override;
|
||||
int ServiceEvent();
|
||||
void SetMIDISource(MIDISource *_source);
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#ifdef _WIN32
|
||||
MIDIDevice *CreateWinMIDIDevice(int mididevice);
|
||||
#endif
|
||||
MIDIDevice *CreateFluidSynthMIDIDevice(const char *args, int samplerate);
|
||||
MIDIDevice *CreateFluidSynthMIDIDevice(const char *args, int samplerate, int (*printfunc_)(const char*, ...));
|
||||
MIDIDevice *CreateTimidityMIDIDevice(const char *args, int samplerate);
|
||||
MIDIDevice *CreateTimidityPPMIDIDevice(const char *args, int samplerate);
|
||||
MIDIDevice *CreateADLMIDIDevice(const char *args, const ADLConfig* config);
|
||||
|
@ -229,7 +229,7 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate)
|
|||
// Intentional fall-through for non-Windows systems.
|
||||
|
||||
case MDEV_FLUIDSYNTH:
|
||||
dev = CreateFluidSynthMIDIDevice(Args, samplerate);
|
||||
dev = CreateFluidSynthMIDIDevice(Args, samplerate, Printf);
|
||||
break;
|
||||
|
||||
case MDEV_OPL:
|
||||
|
@ -248,9 +248,9 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate)
|
|||
break;
|
||||
}
|
||||
}
|
||||
catch (CRecoverableError &err)
|
||||
catch (std::runtime_error &err)
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "%s\n", err.GetMessage());
|
||||
DPrintf(DMSG_WARNING, "%s\n", err.what());
|
||||
checked[devtype] = true;
|
||||
devtype = MDEV_DEFAULT;
|
||||
// Opening the requested device did not work out so choose another one.
|
||||
|
@ -557,43 +557,43 @@ void MIDIStreamer::MusicVolumeChanged()
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIStreamer :: FluidSettingInt
|
||||
// MIDIStreamer :: ChangeSettingInt
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIStreamer::FluidSettingInt(const char *setting, int value)
|
||||
void MIDIStreamer::ChangeSettingInt(const char *setting, int value)
|
||||
{
|
||||
if (MIDI != NULL)
|
||||
{
|
||||
MIDI->FluidSettingInt(setting, value);
|
||||
MIDI->ChangeSettingInt(setting, value);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIStreamer :: FluidSettingNum
|
||||
// MIDIStreamer :: ChangeSettingNum
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIStreamer::FluidSettingNum(const char *setting, double value)
|
||||
void MIDIStreamer::ChangeSettingNum(const char *setting, double value)
|
||||
{
|
||||
if (MIDI != NULL)
|
||||
{
|
||||
MIDI->FluidSettingNum(setting, value);
|
||||
MIDI->ChangeSettingNum(setting, value);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDeviceStreamer :: FluidSettingStr
|
||||
// MIDIDeviceStreamer :: ChangeSettingString
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIStreamer::FluidSettingStr(const char *setting, const char *value)
|
||||
void MIDIStreamer::ChangeSettingString(const char *setting, const char *value)
|
||||
{
|
||||
if (MIDI != NULL)
|
||||
{
|
||||
MIDI->FluidSettingStr(setting, value);
|
||||
MIDI->ChangeSettingString(setting, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1044,31 +1044,31 @@ bool MIDIDevice::Update()
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDevice :: FluidSettingInt
|
||||
// MIDIDevice :: ChangeSettingInt
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIDevice::FluidSettingInt(const char *setting, int value)
|
||||
void MIDIDevice::ChangeSettingInt(const char *setting, int value)
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDevice :: FluidSettingNum
|
||||
// MIDIDevice :: ChangeSettingNum
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIDevice::FluidSettingNum(const char *setting, double value)
|
||||
void MIDIDevice::ChangeSettingNum(const char *setting, double value)
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDevice :: FluidSettingStr
|
||||
// MIDIDevice :: ChangeSettingString
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIDevice::FluidSettingStr(const char *setting, const char *value)
|
||||
void MIDIDevice::ChangeSettingString(const char *setting, const char *value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue