mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 06:42:12 +00:00
- made adjustments to the remaining parts of the function interface.
This commit is contained in:
parent
7923d25cce
commit
47d70c839d
8 changed files with 198 additions and 192 deletions
|
@ -418,7 +418,7 @@ extern int MUSHeaderSearch(const uint8_t *head, int len);
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
EMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
DLL_EXPORT EMIDIType ZMusic_IdentifyMIDIType(uint32_t *id, int size)
|
||||||
{
|
{
|
||||||
// Check for MUS format
|
// Check for MUS format
|
||||||
// Tolerate sloppy wads by searching up to 32 bytes for the header
|
// Tolerate sloppy wads by searching up to 32 bytes for the header
|
||||||
|
|
|
@ -137,63 +137,62 @@ static void TimidityPlus_SetReverb()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
using namespace ZMusic;
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// change an integer value
|
// change an integer value
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value, int *pRealValue)
|
DLL_EXPORT bool ChangeMusicSettingInt(EIntConfigKey key, MusInfo *currSong, int value, int *pRealValue)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case adl_chips_count:
|
case zmusic_adl_chips_count:
|
||||||
ChangeAndReturn(adlConfig.adl_chips_count, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_chips_count, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case adl_emulator_id:
|
case zmusic_adl_emulator_id:
|
||||||
ChangeAndReturn(adlConfig.adl_emulator_id, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_emulator_id, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case adl_run_at_pcm_rate:
|
case zmusic_adl_run_at_pcm_rate:
|
||||||
ChangeAndReturn(adlConfig.adl_run_at_pcm_rate, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_run_at_pcm_rate, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case adl_fullpan:
|
case zmusic_adl_fullpan:
|
||||||
ChangeAndReturn(adlConfig.adl_fullpan, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_fullpan, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case adl_bank:
|
case zmusic_adl_bank:
|
||||||
ChangeAndReturn(adlConfig.adl_bank, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_bank, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case adl_use_custom_bank:
|
case zmusic_adl_use_custom_bank:
|
||||||
ChangeAndReturn(adlConfig.adl_use_custom_bank, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_use_custom_bank, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case adl_volume_model:
|
case zmusic_adl_volume_model:
|
||||||
ChangeAndReturn(adlConfig.adl_volume_model, value, pRealValue);
|
ChangeAndReturn(adlConfig.adl_volume_model, value, pRealValue);
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case fluid_reverb:
|
case zmusic_fluid_reverb:
|
||||||
if (currSong != NULL)
|
if (currSong != NULL)
|
||||||
currSong->ChangeSettingInt("fluidsynth.synth.reverb.active", value);
|
currSong->ChangeSettingInt("fluidsynth.synth.reverb.active", value);
|
||||||
|
|
||||||
ChangeAndReturn(fluidConfig.fluid_reverb, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_reverb, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_chorus:
|
case zmusic_fluid_chorus:
|
||||||
if (currSong != NULL)
|
if (currSong != NULL)
|
||||||
currSong->ChangeSettingInt("fluidsynth.synth.chorus.active", value);
|
currSong->ChangeSettingInt("fluidsynth.synth.chorus.active", value);
|
||||||
|
|
||||||
ChangeAndReturn(fluidConfig.fluid_chorus, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_chorus, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_voices:
|
case zmusic_fluid_voices:
|
||||||
if (value < 16)
|
if (value < 16)
|
||||||
value = 16;
|
value = 16;
|
||||||
else if (value > 4096)
|
else if (value > 4096)
|
||||||
|
@ -205,7 +204,7 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(fluidConfig.fluid_voices, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_voices, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_interp:
|
case zmusic_fluid_interp:
|
||||||
// Values are: 0 = FLUID_INTERP_NONE
|
// Values are: 0 = FLUID_INTERP_NONE
|
||||||
// 1 = FLUID_INTERP_LINEAR
|
// 1 = FLUID_INTERP_LINEAR
|
||||||
// 4 = FLUID_INTERP_4THORDER (the FluidSynth default)
|
// 4 = FLUID_INTERP_4THORDER (the FluidSynth default)
|
||||||
|
@ -227,14 +226,14 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(fluidConfig.fluid_interp, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_interp, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_samplerate:
|
case zmusic_fluid_samplerate:
|
||||||
// This will only take effect for the next song. (Q: Is this even needed?)
|
// This will only take effect for the next song. (Q: Is this even needed?)
|
||||||
ChangeAndReturn(fluidConfig.fluid_samplerate, std::max<int>(value, 0), pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_samplerate, std::max<int>(value, 0), pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// I don't know if this setting even matters for us, since we aren't letting
|
// I don't know if this setting even matters for us, since we aren't letting
|
||||||
// FluidSynth drives its own output.
|
// FluidSynth drives its own output.
|
||||||
case fluid_threads:
|
case zmusic_fluid_threads:
|
||||||
if (value < 1)
|
if (value < 1)
|
||||||
value = 1;
|
value = 1;
|
||||||
else if (value > 256)
|
else if (value > 256)
|
||||||
|
@ -243,7 +242,7 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(fluidConfig.fluid_threads, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_threads, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_chorus_voices:
|
case zmusic_fluid_chorus_voices:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 99)
|
else if (value > 99)
|
||||||
|
@ -255,7 +254,7 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(fluidConfig.fluid_chorus_voices, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_chorus_voices, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_chorus_type:
|
case zmusic_fluid_chorus_type:
|
||||||
if (value != FLUID_CHORUS_MOD_SINE && value != FLUID_CHORUS_MOD_TRIANGLE)
|
if (value != FLUID_CHORUS_MOD_SINE && value != FLUID_CHORUS_MOD_TRIANGLE)
|
||||||
value = FLUID_CHORUS_DEFAULT_TYPE;
|
value = FLUID_CHORUS_DEFAULT_TYPE;
|
||||||
|
|
||||||
|
@ -265,7 +264,7 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(fluidConfig.fluid_chorus_type, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_chorus_type, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case opl_numchips:
|
case zmusic_opl_numchips:
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
value = 1;
|
value = 1;
|
||||||
else if (value > MAXOPL2CHIPS)
|
else if (value > MAXOPL2CHIPS)
|
||||||
|
@ -277,143 +276,143 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(oplConfig.numchips, value, pRealValue);
|
ChangeAndReturn(oplConfig.numchips, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case opl_core:
|
case zmusic_opl_core:
|
||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
else if (value > 3) value = 3;
|
else if (value > 3) value = 3;
|
||||||
ChangeAndReturn(oplConfig.core, value, pRealValue);
|
ChangeAndReturn(oplConfig.core, value, pRealValue);
|
||||||
return devType() == MDEV_OPL;
|
return devType() == MDEV_OPL;
|
||||||
|
|
||||||
case opl_fullpan:
|
case zmusic_opl_fullpan:
|
||||||
ChangeAndReturn(oplConfig.fullpan, value, pRealValue);
|
ChangeAndReturn(oplConfig.fullpan, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case opn_chips_count:
|
case zmusic_opn_chips_count:
|
||||||
ChangeAndReturn(opnConfig.opn_chips_count, value, pRealValue);
|
ChangeAndReturn(opnConfig.opn_chips_count, value, pRealValue);
|
||||||
return devType() == MDEV_OPN;
|
return devType() == MDEV_OPN;
|
||||||
|
|
||||||
case opn_emulator_id:
|
case zmusic_opn_emulator_id:
|
||||||
ChangeAndReturn(opnConfig.opn_emulator_id, value, pRealValue);
|
ChangeAndReturn(opnConfig.opn_emulator_id, value, pRealValue);
|
||||||
return devType() == MDEV_OPN;
|
return devType() == MDEV_OPN;
|
||||||
|
|
||||||
case opn_run_at_pcm_rate:
|
case zmusic_opn_run_at_pcm_rate:
|
||||||
ChangeAndReturn(opnConfig.opn_run_at_pcm_rate, value, pRealValue);
|
ChangeAndReturn(opnConfig.opn_run_at_pcm_rate, value, pRealValue);
|
||||||
return devType() == MDEV_OPN;
|
return devType() == MDEV_OPN;
|
||||||
|
|
||||||
case opn_fullpan:
|
case zmusic_opn_fullpan:
|
||||||
ChangeAndReturn(opnConfig.opn_fullpan, value, pRealValue);
|
ChangeAndReturn(opnConfig.opn_fullpan, value, pRealValue);
|
||||||
return devType() == MDEV_OPN;
|
return devType() == MDEV_OPN;
|
||||||
|
|
||||||
case opn_use_custom_bank:
|
case zmusic_opn_use_custom_bank:
|
||||||
ChangeAndReturn(opnConfig.opn_use_custom_bank, value, pRealValue);
|
ChangeAndReturn(opnConfig.opn_use_custom_bank, value, pRealValue);
|
||||||
return devType() == MDEV_OPN;
|
return devType() == MDEV_OPN;
|
||||||
|
|
||||||
case gus_dmxgus:
|
case zmusic_gus_dmxgus:
|
||||||
ChangeAndReturn(gusConfig.gus_dmxgus, value, pRealValue);
|
ChangeAndReturn(gusConfig.gus_dmxgus, value, pRealValue);
|
||||||
return devType() == MDEV_GUS;
|
return devType() == MDEV_GUS;
|
||||||
|
|
||||||
case gus_midi_voices:
|
case zmusic_gus_midi_voices:
|
||||||
ChangeAndReturn(gusConfig.midi_voices, value, pRealValue);
|
ChangeAndReturn(gusConfig.midi_voices, value, pRealValue);
|
||||||
return devType() == MDEV_GUS;
|
return devType() == MDEV_GUS;
|
||||||
|
|
||||||
case gus_memsize:
|
case zmusic_gus_memsize:
|
||||||
ChangeAndReturn(gusConfig.gus_memsize, value, pRealValue);
|
ChangeAndReturn(gusConfig.gus_memsize, value, pRealValue);
|
||||||
return devType() == MDEV_GUS && gusConfig.gus_dmxgus;
|
return devType() == MDEV_GUS && gusConfig.gus_dmxgus;
|
||||||
|
|
||||||
case timidity_modulation_wheel:
|
case zmusic_timidity_modulation_wheel:
|
||||||
ChangeVarSync(TimidityPlus::timidity_modulation_wheel, value);
|
ChangeVarSync(TimidityPlus::timidity_modulation_wheel, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_portamento:
|
case zmusic_timidity_portamento:
|
||||||
ChangeVarSync(TimidityPlus::timidity_portamento, value);
|
ChangeVarSync(TimidityPlus::timidity_portamento, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_reverb:
|
case zmusic_timidity_reverb:
|
||||||
if (value < 0 || value > 4) value = 0;
|
if (value < 0 || value > 4) value = 0;
|
||||||
else TimidityPlus_SetReverb();
|
else TimidityPlus_SetReverb();
|
||||||
local_timidity_reverb = value;
|
local_timidity_reverb = value;
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_reverb_level:
|
case zmusic_timidity_reverb_level:
|
||||||
if (value < 0 || value > 127) value = 0;
|
if (value < 0 || value > 127) value = 0;
|
||||||
else TimidityPlus_SetReverb();
|
else TimidityPlus_SetReverb();
|
||||||
local_timidity_reverb_level = value;
|
local_timidity_reverb_level = value;
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_chorus:
|
case zmusic_timidity_chorus:
|
||||||
ChangeVarSync(TimidityPlus::timidity_chorus, value);
|
ChangeVarSync(TimidityPlus::timidity_chorus, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_surround_chorus:
|
case zmusic_timidity_surround_chorus:
|
||||||
ChangeVarSync(TimidityPlus::timidity_surround_chorus, value);
|
ChangeVarSync(TimidityPlus::timidity_surround_chorus, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return devType() == MDEV_TIMIDITY;
|
return devType() == MDEV_TIMIDITY;
|
||||||
|
|
||||||
case timidity_channel_pressure:
|
case zmusic_timidity_channel_pressure:
|
||||||
ChangeVarSync(TimidityPlus::timidity_channel_pressure, value);
|
ChangeVarSync(TimidityPlus::timidity_channel_pressure, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_lpf_def:
|
case zmusic_timidity_lpf_def:
|
||||||
ChangeVarSync(TimidityPlus::timidity_lpf_def, value);
|
ChangeVarSync(TimidityPlus::timidity_lpf_def, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_temper_control:
|
case zmusic_timidity_temper_control:
|
||||||
ChangeVarSync(TimidityPlus::timidity_temper_control, value);
|
ChangeVarSync(TimidityPlus::timidity_temper_control, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_modulation_envelope:
|
case zmusic_timidity_modulation_envelope:
|
||||||
ChangeVarSync(TimidityPlus::timidity_modulation_envelope, value);
|
ChangeVarSync(TimidityPlus::timidity_modulation_envelope, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return devType() == MDEV_TIMIDITY;
|
return devType() == MDEV_TIMIDITY;
|
||||||
|
|
||||||
case timidity_overlap_voice_allow:
|
case zmusic_timidity_overlap_voice_allow:
|
||||||
ChangeVarSync(TimidityPlus::timidity_overlap_voice_allow, value);
|
ChangeVarSync(TimidityPlus::timidity_overlap_voice_allow, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_drum_effect:
|
case zmusic_timidity_drum_effect:
|
||||||
ChangeVarSync(TimidityPlus::timidity_drum_effect, value);
|
ChangeVarSync(TimidityPlus::timidity_drum_effect, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_pan_delay:
|
case zmusic_timidity_pan_delay:
|
||||||
ChangeVarSync(TimidityPlus::timidity_pan_delay, value);
|
ChangeVarSync(TimidityPlus::timidity_pan_delay, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_key_adjust:
|
case zmusic_timidity_key_adjust:
|
||||||
if (value < -24) value = -24;
|
if (value < -24) value = -24;
|
||||||
else if (value > 24) value = 24;
|
else if (value > 24) value = 24;
|
||||||
ChangeVarSync(TimidityPlus::timidity_key_adjust, value);
|
ChangeVarSync(TimidityPlus::timidity_key_adjust, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case wildmidi_reverb:
|
case zmusic_wildmidi_reverb:
|
||||||
if (currSong != NULL)
|
if (currSong != NULL)
|
||||||
currSong->ChangeSettingInt("wildmidi.reverb", value);
|
currSong->ChangeSettingInt("wildmidi.reverb", value);
|
||||||
wildMidiConfig.reverb = value;
|
wildMidiConfig.reverb = value;
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case wildmidi_enhanced_resampling:
|
case zmusic_wildmidi_enhanced_resampling:
|
||||||
if (currSong != NULL)
|
if (currSong != NULL)
|
||||||
currSong->ChangeSettingInt("wildmidi.resampling", value);
|
currSong->ChangeSettingInt("wildmidi.resampling", value);
|
||||||
wildMidiConfig.enhanced_resampling = value;
|
wildMidiConfig.enhanced_resampling = value;
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case snd_midiprecache:
|
case zmusic_snd_midiprecache:
|
||||||
ChangeAndReturn(miscConfig.snd_midiprecache, value, pRealValue);
|
ChangeAndReturn(miscConfig.snd_midiprecache, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case snd_streambuffersize:
|
case zmusic_snd_streambuffersize:
|
||||||
if (value < 16)
|
if (value < 16)
|
||||||
{
|
{
|
||||||
value = 16;
|
value = 16;
|
||||||
|
@ -425,42 +424,42 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
ChangeAndReturn(miscConfig.snd_streambuffersize, value, pRealValue);
|
ChangeAndReturn(miscConfig.snd_streambuffersize, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_samplerate:
|
case zmusic_mod_samplerate:
|
||||||
ChangeAndReturn(dumbConfig.mod_samplerate, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_samplerate, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_volramp:
|
case zmusic_mod_volramp:
|
||||||
ChangeAndReturn(dumbConfig.mod_volramp, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_volramp, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_interp:
|
case zmusic_mod_interp:
|
||||||
ChangeAndReturn(dumbConfig.mod_interp, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_interp, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_autochip:
|
case zmusic_mod_autochip:
|
||||||
ChangeAndReturn(dumbConfig.mod_autochip, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_autochip, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_autochip_size_force:
|
case zmusic_mod_autochip_size_force:
|
||||||
ChangeAndReturn(dumbConfig.mod_autochip_size_force, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_autochip_size_force, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_autochip_size_scan:
|
case zmusic_mod_autochip_size_scan:
|
||||||
ChangeAndReturn(dumbConfig.mod_autochip_size_scan, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_autochip_size_scan, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_autochip_scan_threshold:
|
case zmusic_mod_autochip_scan_threshold:
|
||||||
ChangeAndReturn(dumbConfig.mod_autochip_scan_threshold, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_autochip_scan_threshold, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case snd_mididevice:
|
case zmusic_snd_mididevice:
|
||||||
{
|
{
|
||||||
bool change = miscConfig.snd_mididevice != value;
|
bool change = miscConfig.snd_mididevice != value;
|
||||||
miscConfig.snd_mididevice = value;
|
miscConfig.snd_mididevice = value;
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
case snd_outputrate:
|
case zmusic_snd_outputrate:
|
||||||
miscConfig.snd_outputrate = value;
|
miscConfig.snd_outputrate = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -468,14 +467,14 @@ bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo *currSong, int value,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float value, float *pRealValue)
|
DLL_EXPORT bool ChangeMusicSettingFloat(EFloatConfigKey key, MusInfo* currSong, float value, float *pRealValue)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_gain:
|
case zmusic_fluid_gain:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 10)
|
else if (value > 10)
|
||||||
|
@ -487,7 +486,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_gain, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_gain, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_reverb_roomsize:
|
case zmusic_fluid_reverb_roomsize:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 1.2f)
|
else if (value > 1.2f)
|
||||||
|
@ -499,7 +498,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_reverb_roomsize, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_reverb_roomsize, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_reverb_damping:
|
case zmusic_fluid_reverb_damping:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 1)
|
else if (value > 1)
|
||||||
|
@ -511,7 +510,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_reverb_damping, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_reverb_damping, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_reverb_width:
|
case zmusic_fluid_reverb_width:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 100)
|
else if (value > 100)
|
||||||
|
@ -523,7 +522,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_reverb_width, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_reverb_width, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_reverb_level:
|
case zmusic_fluid_reverb_level:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 1)
|
else if (value > 1)
|
||||||
|
@ -535,7 +534,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_reverb_level, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_reverb_level, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_chorus_level:
|
case zmusic_fluid_chorus_level:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 1)
|
else if (value > 1)
|
||||||
|
@ -547,7 +546,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_chorus_level, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_chorus_level, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case fluid_chorus_speed:
|
case zmusic_fluid_chorus_speed:
|
||||||
if (value < 0.29f)
|
if (value < 0.29f)
|
||||||
value = 0.29f;
|
value = 0.29f;
|
||||||
else if (value > 5)
|
else if (value > 5)
|
||||||
|
@ -560,7 +559,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// depth is in ms and actual maximum depends on the sample rate
|
// depth is in ms and actual maximum depends on the sample rate
|
||||||
case fluid_chorus_depth:
|
case zmusic_fluid_chorus_depth:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if (value > 21)
|
else if (value > 21)
|
||||||
|
@ -572,7 +571,7 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
ChangeAndReturn(fluidConfig.fluid_chorus_depth, value, pRealValue);
|
ChangeAndReturn(fluidConfig.fluid_chorus_depth, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case timidity_drum_power:
|
case zmusic_timidity_drum_power:
|
||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
else if (value > MAX_AMPLIFICATION / 100.f) value = MAX_AMPLIFICATION / 100.f;
|
else if (value > MAX_AMPLIFICATION / 100.f) value = MAX_AMPLIFICATION / 100.f;
|
||||||
ChangeVarSync(TimidityPlus::timidity_drum_power, value);
|
ChangeVarSync(TimidityPlus::timidity_drum_power, value);
|
||||||
|
@ -580,39 +579,39 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// For testing mainly.
|
// For testing mainly.
|
||||||
case timidity_tempo_adjust:
|
case zmusic_timidity_tempo_adjust:
|
||||||
if (value < 0.25) value = 0.25;
|
if (value < 0.25) value = 0.25;
|
||||||
else if (value > 10) value = 10;
|
else if (value > 10) value = 10;
|
||||||
ChangeVarSync(TimidityPlus::timidity_tempo_adjust, value);
|
ChangeVarSync(TimidityPlus::timidity_tempo_adjust, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case min_sustain_time:
|
case zmusic_min_sustain_time:
|
||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
ChangeVarSync(TimidityPlus::min_sustain_time, value);
|
ChangeVarSync(TimidityPlus::min_sustain_time, value);
|
||||||
if (pRealValue) *pRealValue = value;
|
if (pRealValue) *pRealValue = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case gme_stereodepth:
|
case zmusic_gme_stereodepth:
|
||||||
if (currSong != nullptr)
|
if (currSong != nullptr)
|
||||||
currSong->ChangeSettingNum("GME.stereodepth", value);
|
currSong->ChangeSettingNum("GME.stereodepth", value);
|
||||||
ChangeAndReturn(miscConfig.gme_stereodepth, value, pRealValue);
|
ChangeAndReturn(miscConfig.gme_stereodepth, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case mod_dumb_mastervolume:
|
case zmusic_mod_dumb_mastervolume:
|
||||||
if (value < 0) value = 0;
|
if (value < 0) value = 0;
|
||||||
ChangeAndReturn(dumbConfig.mod_dumb_mastervolume, value, pRealValue);
|
ChangeAndReturn(dumbConfig.mod_dumb_mastervolume, value, pRealValue);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case snd_musicvolume:
|
case zmusic_snd_musicvolume:
|
||||||
miscConfig.snd_musicvolume = value;
|
miscConfig.snd_musicvolume = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case relative_volume:
|
case zmusic_relative_volume:
|
||||||
miscConfig.relative_volume = value;
|
miscConfig.relative_volume = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case snd_mastervolume:
|
case zmusic_snd_mastervolume:
|
||||||
miscConfig.snd_mastervolume = value;
|
miscConfig.snd_mastervolume = value;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -620,42 +619,42 @@ bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* currSong, float va
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChangeMusicSetting(ZMusic::EStringConfigKey key, MusInfo* currSong, const char *value)
|
DLL_EXPORT bool ChangeMusicSettingString(EStringConfigKey key, MusInfo* currSong, const char *value)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case adl_custom_bank:
|
case zmusic_adl_custom_bank:
|
||||||
adlConfig.adl_custom_bank = value;
|
adlConfig.adl_custom_bank = value;
|
||||||
return devType() == MDEV_ADL;
|
return devType() == MDEV_ADL;
|
||||||
|
|
||||||
case fluid_lib:
|
case zmusic_fluid_lib:
|
||||||
fluidConfig.fluid_lib = value;
|
fluidConfig.fluid_lib = value;
|
||||||
return false; // only takes effect for next song.
|
return false; // only takes effect for next song.
|
||||||
|
|
||||||
case fluid_patchset:
|
case zmusic_fluid_patchset:
|
||||||
fluidConfig.fluid_patchset = value;
|
fluidConfig.fluid_patchset = value;
|
||||||
return devType() == MDEV_FLUIDSYNTH;
|
return devType() == MDEV_FLUIDSYNTH;
|
||||||
|
|
||||||
case opn_custom_bank:
|
case zmusic_opn_custom_bank:
|
||||||
opnConfig.opn_custom_bank = value;
|
opnConfig.opn_custom_bank = value;
|
||||||
return devType() == MDEV_OPN && opnConfig.opn_use_custom_bank;
|
return devType() == MDEV_OPN && opnConfig.opn_use_custom_bank;
|
||||||
|
|
||||||
case gus_config:
|
case zmusic_gus_config:
|
||||||
gusConfig.gus_config = value;
|
gusConfig.gus_config = value;
|
||||||
return devType() == MDEV_GUS;
|
return devType() == MDEV_GUS;
|
||||||
|
|
||||||
case gus_patchdir:
|
case zmusic_gus_patchdir:
|
||||||
gusConfig.gus_patchdir = value;
|
gusConfig.gus_patchdir = value;
|
||||||
return devType() == MDEV_GUS && gusConfig.gus_dmxgus;
|
return devType() == MDEV_GUS && gusConfig.gus_dmxgus;
|
||||||
|
|
||||||
case timidity_config:
|
case zmusic_timidity_config:
|
||||||
timidityConfig.timidity_config = value;
|
timidityConfig.timidity_config = value;
|
||||||
return devType() == MDEV_TIMIDITY;
|
return devType() == MDEV_TIMIDITY;
|
||||||
|
|
||||||
case wildmidi_config:
|
case zmusic_wildmidi_config:
|
||||||
wildMidiConfig.config = value;
|
wildMidiConfig.config = value;
|
||||||
return devType() == MDEV_TIMIDITY;
|
return devType() == MDEV_TIMIDITY;
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ static bool ungzip(uint8_t *data, int complen, std::vector<uint8_t> &newdata)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
MusInfo *ZMusic_OpenSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args)
|
DLL_EXPORT MusInfo *ZMusic_OpenSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args)
|
||||||
{
|
{
|
||||||
MusInfo *info = nullptr;
|
MusInfo *info = nullptr;
|
||||||
StreamSource *streamsource = nullptr;
|
StreamSource *streamsource = nullptr;
|
||||||
|
@ -403,11 +403,12 @@ DLL_EXPORT bool ZMusic_IsMIDI(MusInfo *song)
|
||||||
return song->IsMIDI();
|
return song->IsMIDI();
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundStreamInfo ZMusic_GetStreamInfo(MusInfo *song)
|
DLL_EXPORT void ZMusic_GetStreamInfo(MusInfo *song, SoundStreamInfo *fmt)
|
||||||
{
|
{
|
||||||
if (!song) return {};
|
if (!fmt) return;
|
||||||
|
if (!song) *fmt = {};
|
||||||
std::lock_guard<std::mutex> lock(song->CritSec);
|
std::lock_guard<std::mutex> lock(song->CritSec);
|
||||||
return song->GetStreamInfo();
|
*fmt = song->GetStreamInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
DLL_EXPORT void ZMusic_Close(MusInfo *song)
|
DLL_EXPORT void ZMusic_Close(MusInfo *song)
|
||||||
|
@ -423,14 +424,16 @@ DLL_EXPORT void ZMusic_VolumeChanged(MusInfo *song)
|
||||||
song->MusicVolumeChanged();
|
song->MusicVolumeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ZMusic_GetStats(MusInfo *song)
|
static std::string staticErrorMessage;
|
||||||
|
|
||||||
|
DLL_EXPORT const char *ZMusic_GetStats(MusInfo *song)
|
||||||
{
|
{
|
||||||
if (!song) return "";
|
if (!song) return "";
|
||||||
std::lock_guard<std::mutex> lock(song->CritSec);
|
std::lock_guard<std::mutex> lock(song->CritSec);
|
||||||
return song->GetStats();
|
staticErrorMessage = song->GetStats();
|
||||||
|
return staticErrorMessage.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string staticErrorMessage;
|
|
||||||
void SetError(const char* msg)
|
void SetError(const char* msg)
|
||||||
{
|
{
|
||||||
staticErrorMessage = msg;
|
staticErrorMessage = msg;
|
||||||
|
|
|
@ -3,119 +3,114 @@
|
||||||
#include "mididefs.h"
|
#include "mididefs.h"
|
||||||
#include "../../music_common/fileio.h"
|
#include "../../music_common/fileio.h"
|
||||||
|
|
||||||
namespace ZMusic // Namespaced because these conflict with the same-named CVARs
|
|
||||||
{
|
|
||||||
|
|
||||||
enum EIntConfigKey
|
enum EIntConfigKey
|
||||||
{
|
{
|
||||||
adl_chips_count,
|
zmusic_adl_chips_count,
|
||||||
adl_emulator_id,
|
zmusic_adl_emulator_id,
|
||||||
adl_run_at_pcm_rate,
|
zmusic_adl_run_at_pcm_rate,
|
||||||
adl_fullpan,
|
zmusic_adl_fullpan,
|
||||||
adl_bank,
|
zmusic_adl_bank,
|
||||||
adl_use_custom_bank,
|
zmusic_adl_use_custom_bank,
|
||||||
adl_volume_model,
|
zmusic_adl_volume_model,
|
||||||
|
|
||||||
fluid_reverb,
|
zmusic_fluid_reverb,
|
||||||
fluid_chorus,
|
zmusic_fluid_chorus,
|
||||||
fluid_voices,
|
zmusic_fluid_voices,
|
||||||
fluid_interp,
|
zmusic_fluid_interp,
|
||||||
fluid_samplerate,
|
zmusic_fluid_samplerate,
|
||||||
fluid_threads,
|
zmusic_fluid_threads,
|
||||||
fluid_chorus_voices,
|
zmusic_fluid_chorus_voices,
|
||||||
fluid_chorus_type,
|
zmusic_fluid_chorus_type,
|
||||||
|
|
||||||
opl_numchips,
|
zmusic_opl_numchips,
|
||||||
opl_core,
|
zmusic_opl_core,
|
||||||
opl_fullpan,
|
zmusic_opl_fullpan,
|
||||||
|
|
||||||
opn_chips_count,
|
zmusic_opn_chips_count,
|
||||||
opn_emulator_id,
|
zmusic_opn_emulator_id,
|
||||||
opn_run_at_pcm_rate,
|
zmusic_opn_run_at_pcm_rate,
|
||||||
opn_fullpan,
|
zmusic_opn_fullpan,
|
||||||
opn_use_custom_bank,
|
zmusic_opn_use_custom_bank,
|
||||||
|
|
||||||
gus_dmxgus,
|
zmusic_gus_dmxgus,
|
||||||
gus_midi_voices,
|
zmusic_gus_midi_voices,
|
||||||
gus_memsize,
|
zmusic_gus_memsize,
|
||||||
|
|
||||||
timidity_modulation_wheel,
|
zmusic_timidity_modulation_wheel,
|
||||||
timidity_portamento,
|
zmusic_timidity_portamento,
|
||||||
timidity_reverb,
|
zmusic_timidity_reverb,
|
||||||
timidity_reverb_level,
|
zmusic_timidity_reverb_level,
|
||||||
timidity_chorus,
|
zmusic_timidity_chorus,
|
||||||
timidity_surround_chorus,
|
zmusic_timidity_surround_chorus,
|
||||||
timidity_channel_pressure,
|
zmusic_timidity_channel_pressure,
|
||||||
timidity_lpf_def,
|
zmusic_timidity_lpf_def,
|
||||||
timidity_temper_control,
|
zmusic_timidity_temper_control,
|
||||||
timidity_modulation_envelope,
|
zmusic_timidity_modulation_envelope,
|
||||||
timidity_overlap_voice_allow,
|
zmusic_timidity_overlap_voice_allow,
|
||||||
timidity_drum_effect,
|
zmusic_timidity_drum_effect,
|
||||||
timidity_pan_delay,
|
zmusic_timidity_pan_delay,
|
||||||
timidity_key_adjust,
|
zmusic_timidity_key_adjust,
|
||||||
|
|
||||||
wildmidi_reverb,
|
zmusic_wildmidi_reverb,
|
||||||
wildmidi_enhanced_resampling,
|
zmusic_wildmidi_enhanced_resampling,
|
||||||
|
|
||||||
snd_midiprecache,
|
zmusic_snd_midiprecache,
|
||||||
|
|
||||||
mod_samplerate,
|
zmusic_mod_samplerate,
|
||||||
mod_volramp,
|
zmusic_mod_volramp,
|
||||||
mod_interp,
|
zmusic_mod_interp,
|
||||||
mod_autochip,
|
zmusic_mod_autochip,
|
||||||
mod_autochip_size_force,
|
zmusic_mod_autochip_size_force,
|
||||||
mod_autochip_size_scan,
|
zmusic_mod_autochip_size_scan,
|
||||||
mod_autochip_scan_threshold,
|
zmusic_mod_autochip_scan_threshold,
|
||||||
|
|
||||||
snd_streambuffersize,
|
zmusic_snd_streambuffersize,
|
||||||
|
|
||||||
snd_mididevice,
|
zmusic_snd_mididevice,
|
||||||
snd_outputrate,
|
zmusic_snd_outputrate,
|
||||||
|
|
||||||
NUM_INT_CONFIGS
|
NUM_ZMUSIC_INT_CONFIGS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EFloatConfigKey
|
enum EFloatConfigKey
|
||||||
{
|
{
|
||||||
fluid_gain,
|
zmusic_fluid_gain,
|
||||||
fluid_reverb_roomsize,
|
zmusic_fluid_reverb_roomsize,
|
||||||
fluid_reverb_damping,
|
zmusic_fluid_reverb_damping,
|
||||||
fluid_reverb_width,
|
zmusic_fluid_reverb_width,
|
||||||
fluid_reverb_level,
|
zmusic_fluid_reverb_level,
|
||||||
fluid_chorus_level,
|
zmusic_fluid_chorus_level,
|
||||||
fluid_chorus_speed,
|
zmusic_fluid_chorus_speed,
|
||||||
fluid_chorus_depth,
|
zmusic_fluid_chorus_depth,
|
||||||
|
|
||||||
timidity_drum_power,
|
zmusic_timidity_drum_power,
|
||||||
timidity_tempo_adjust,
|
zmusic_timidity_tempo_adjust,
|
||||||
min_sustain_time,
|
zmusic_min_sustain_time,
|
||||||
|
|
||||||
gme_stereodepth,
|
zmusic_gme_stereodepth,
|
||||||
mod_dumb_mastervolume,
|
zmusic_mod_dumb_mastervolume,
|
||||||
|
|
||||||
snd_musicvolume,
|
zmusic_snd_musicvolume,
|
||||||
relative_volume,
|
zmusic_relative_volume,
|
||||||
snd_mastervolume,
|
zmusic_snd_mastervolume,
|
||||||
|
|
||||||
NUM_FLOAT_CONFIGS
|
NUM_FLOAT_CONFIGS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EStringConfigKey
|
enum EStringConfigKey
|
||||||
{
|
{
|
||||||
adl_custom_bank,
|
zmusic_adl_custom_bank,
|
||||||
fluid_lib,
|
zmusic_fluid_lib,
|
||||||
fluid_patchset,
|
zmusic_fluid_patchset,
|
||||||
opn_custom_bank,
|
zmusic_opn_custom_bank,
|
||||||
gus_config,
|
zmusic_gus_config,
|
||||||
gus_patchdir,
|
zmusic_gus_patchdir,
|
||||||
timidity_config,
|
zmusic_timidity_config,
|
||||||
wildmidi_config,
|
zmusic_wildmidi_config,
|
||||||
|
|
||||||
NUM_STRING_CONFIGS
|
NUM_STRING_CONFIGS
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Callbacks
|
struct Callbacks
|
||||||
{
|
{
|
||||||
// Callbacks the client can install to capture messages from the backends
|
// Callbacks the client can install to capture messages from the backends
|
||||||
|
@ -147,8 +142,10 @@ typedef struct { int zm1; } *ZMusic_MidiSource;
|
||||||
typedef struct { int zm2; } *ZMusic_MusicStream;
|
typedef struct { int zm2; } *ZMusic_MusicStream;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
DLL_IMPORT const char* ZMusic_GetLastError();
|
DLL_IMPORT const char* ZMusic_GetLastError();
|
||||||
|
|
||||||
// Sets callbacks for functionality that the client needs to provide.
|
// Sets callbacks for functionality that the client needs to provide.
|
||||||
|
@ -181,22 +178,28 @@ extern "C"
|
||||||
DLL_IMPORT bool ZMusic_IsMIDI(ZMusic_MusicStream song);
|
DLL_IMPORT bool ZMusic_IsMIDI(ZMusic_MusicStream song);
|
||||||
DLL_IMPORT void ZMusic_VolumeChanged(ZMusic_MusicStream song);
|
DLL_IMPORT void ZMusic_VolumeChanged(ZMusic_MusicStream song);
|
||||||
DLL_IMPORT bool ZMusic_WriteSMF(ZMusic_MidiSource source, const char* fn, int looplimit);
|
DLL_IMPORT bool ZMusic_WriteSMF(ZMusic_MidiSource source, const char* fn, int looplimit);
|
||||||
SoundStreamInfo ZMusic_GetStreamInfo(ZMusic_MusicStream song);
|
DLL_IMPORT void ZMusic_GetStreamInfo(ZMusic_MusicStream song, SoundStreamInfo *info);
|
||||||
|
|
||||||
// Configuration interface. The return value specifies if a music restart is needed.
|
// Configuration interface. The return value specifies if a music restart is needed.
|
||||||
// RealValue should be written back to the CVAR or whatever other method the client uses to store configuration state.
|
// RealValue should be written back to the CVAR or whatever other method the client uses to store configuration state.
|
||||||
|
DLL_IMPORT bool ChangeMusicSettingInt(EIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue = nullptr);
|
||||||
|
DLL_IMPORT bool ChangeMusicSettingFloat(EFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue = nullptr);
|
||||||
|
DLL_IMPORT bool ChangeMusicSettingString(EStringConfigKey key, ZMusic_MusicStream song, const char* value);
|
||||||
|
DLL_IMPORT const char *ZMusic_GetStats(ZMusic_MusicStream song);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool ChangeMusicSetting(EIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue = nullptr)
|
||||||
|
{
|
||||||
|
return ChangeMusicSettingInt(key, song, value, pRealValue);
|
||||||
|
}
|
||||||
|
inline bool ChangeMusicSetting(EFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue = nullptr)
|
||||||
|
{
|
||||||
|
return ChangeMusicSettingFloat(key, song, value, pRealValue);
|
||||||
|
}
|
||||||
|
inline bool ChangeMusicSetting(EStringConfigKey key, ZMusic_MusicStream song, const char* value)
|
||||||
|
{
|
||||||
|
return ChangeMusicSettingString(key, song, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MusInfo;
|
|
||||||
#if 0
|
|
||||||
std::string ZMusic_GetStats(ZMusic_MusicStream song);
|
|
||||||
bool ChangeMusicSetting(ZMusic::EIntConfigKey key, ZMusic_MusicStream song, int value, int* pRealValue = nullptr);
|
|
||||||
bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, ZMusic_MusicStream song, float value, float* pRealValue = nullptr);
|
|
||||||
bool ChangeMusicSetting(ZMusic::EStringConfigKey key, ZMusic_MusicStream song, const char* value);
|
|
||||||
#else
|
|
||||||
// Cannot be done yet.
|
|
||||||
std::string ZMusic_GetStats(MusInfo* song);
|
|
||||||
bool ChangeMusicSetting(ZMusic::EIntConfigKey key, MusInfo* song, int value, int* pRealValue = nullptr);
|
|
||||||
bool ChangeMusicSetting(ZMusic::EFloatConfigKey key, MusInfo* song, float value, float* pRealValue = nullptr);
|
|
||||||
bool ChangeMusicSetting(ZMusic::EStringConfigKey key, MusInfo* song, const char* value);
|
|
||||||
#endif
|
#endif
|
|
@ -342,7 +342,7 @@ ADD_STAT(music)
|
||||||
{
|
{
|
||||||
if (mus_playing.handle != nullptr)
|
if (mus_playing.handle != nullptr)
|
||||||
{
|
{
|
||||||
return FString(ZMusic_GetStats((MusInfo*)mus_playing.handle).c_str());
|
return ZMusic_GetStats(mus_playing.handle);
|
||||||
}
|
}
|
||||||
return "No song playing";
|
return "No song playing";
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,18 +48,18 @@
|
||||||
|
|
||||||
#define FORWARD_CVAR(key) \
|
#define FORWARD_CVAR(key) \
|
||||||
decltype(*self) newval; \
|
decltype(*self) newval; \
|
||||||
auto ret = ChangeMusicSetting(ZMusic::key, (MusInfo*)mus_playing.handle, *self, &newval); \
|
auto ret = ChangeMusicSetting(zmusic_##key, mus_playing.handle, *self, &newval); \
|
||||||
self = (decltype(*self))newval; \
|
self = (decltype(*self))newval; \
|
||||||
if (ret) S_MIDIDeviceChanged(-1);
|
if (ret) S_MIDIDeviceChanged(-1);
|
||||||
|
|
||||||
#define FORWARD_BOOL_CVAR(key) \
|
#define FORWARD_BOOL_CVAR(key) \
|
||||||
int newval; \
|
int newval; \
|
||||||
auto ret = ChangeMusicSetting(ZMusic::key, (MusInfo*)mus_playing.handle,*self, &newval); \
|
auto ret = ChangeMusicSetting(zmusic_##key, mus_playing.handle,*self, &newval); \
|
||||||
self = !!newval; \
|
self = !!newval; \
|
||||||
if (ret) S_MIDIDeviceChanged(-1);
|
if (ret) S_MIDIDeviceChanged(-1);
|
||||||
|
|
||||||
#define FORWARD_STRING_CVAR(key) \
|
#define FORWARD_STRING_CVAR(key) \
|
||||||
auto ret = ChangeMusicSetting(ZMusic::key, (MusInfo*)mus_playing.handle,*self); \
|
auto ret = ChangeMusicSetting(zmusic_##key, mus_playing.handle,*self); \
|
||||||
if (ret) S_MIDIDeviceChanged(-1);
|
if (ret) S_MIDIDeviceChanged(-1);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,6 @@ CUSTOM_CVAR (Int, snd_mididevice, DEF_MIDIDEV, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CV
|
||||||
self = DEF_MIDIDEV;
|
self = DEF_MIDIDEV;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool change = ChangeMusicSetting(ZMusic::snd_mididevice, nullptr, self);
|
bool change = ChangeMusicSetting(zmusic_snd_mididevice, nullptr, self);
|
||||||
if (change) S_MIDIDeviceChanged(self);
|
if (change) S_MIDIDeviceChanged(self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,8 @@ static bool FillStream(SoundStream* stream, void* buff, int len, void* userdata)
|
||||||
void S_CreateStream()
|
void S_CreateStream()
|
||||||
{
|
{
|
||||||
if (!mus_playing.handle) return;
|
if (!mus_playing.handle) return;
|
||||||
auto fmt = ZMusic_GetStreamInfo(mus_playing.handle);
|
SoundStreamInfo fmt;
|
||||||
|
ZMusic_GetStreamInfo(mus_playing.handle, &fmt);
|
||||||
if (fmt.mBufferSize > 0)
|
if (fmt.mBufferSize > 0)
|
||||||
{
|
{
|
||||||
int flags = fmt.mNumChannels < 0 ? 0 : SoundStream::Float;
|
int flags = fmt.mNumChannels < 0 ? 0 : SoundStream::Float;
|
||||||
|
|
Loading…
Reference in a new issue