mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-30 16:00:55 +00:00
- allow changing the reverb and resampling mode setting for WildMidi.
- fixed: WildMidi did not initialize the reverb data structures. - removed the menu option for midi_timiditylike.
This commit is contained in:
parent
2b1730deae
commit
1def61e3e3
8 changed files with 77 additions and 2 deletions
|
@ -286,6 +286,10 @@ void MusInfo::FluidSettingStr(const char *, const char *)
|
|||
{
|
||||
}
|
||||
|
||||
void MusInfo::WildMidiSetOption(int opt, int set)
|
||||
{
|
||||
}
|
||||
|
||||
FString MusInfo::GetStats()
|
||||
{
|
||||
return "No stats available for this song";
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
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 WildMidiSetOption(int opt, int set);
|
||||
|
||||
void Start(bool loop, float rel_vol = -1.f, int subsong = 0);
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ public:
|
|||
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 WildMidiSetOption(int opt, int set);
|
||||
virtual bool Preprocess(MIDIStreamer *song, bool looping);
|
||||
virtual FString GetStats();
|
||||
};
|
||||
|
@ -349,6 +350,7 @@ protected:
|
|||
void HandleEvent(int status, int parm1, int parm2);
|
||||
void HandleLongEvent(const BYTE *data, int len);
|
||||
void ComputeOutput(float *buffer, int len);
|
||||
void WildMidiSetOption(int opt, int set);
|
||||
};
|
||||
|
||||
// FluidSynth implementation of a MIDI device -------------------------------
|
||||
|
@ -447,6 +449,7 @@ public:
|
|||
void FluidSettingInt(const char *setting, int value);
|
||||
void FluidSettingNum(const char *setting, double value);
|
||||
void FluidSettingStr(const char *setting, const char *value);
|
||||
void WildMidiSetOption(int opt, int set);
|
||||
void CreateSMF(TArray<BYTE> &file, int looplimit=0);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -626,6 +626,21 @@ void MIDIStreamer::FluidSettingStr(const char *setting, const char *value)
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDeviceStreamer :: WildMidiSetOption
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIStreamer::WildMidiSetOption(int opt, int set)
|
||||
{
|
||||
if (MIDI != NULL)
|
||||
{
|
||||
MIDI->WildMidiSetOption(opt, set);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIStreamer :: OutputVolume
|
||||
|
@ -1522,6 +1537,16 @@ void MIDIDevice::FluidSettingStr(const char *setting, const char *value)
|
|||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDevice :: WildMidiSetOption
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void MIDIDevice::WildMidiSetOption(int opt, int set)
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// MIDIDevice :: GetStats
|
||||
|
|
|
@ -61,6 +61,17 @@ static FString CurrentConfig;
|
|||
|
||||
CVAR(String, wildmidi_config, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, wildmidi_frequency, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR(Bool, wildmidi_reverb, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (currSong != NULL)
|
||||
currSong->WildMidiSetOption(WM_MO_REVERB, *self? WM_MO_REVERB:0);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, wildmidi_enhanced_resampling, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
if (currSong != NULL)
|
||||
currSong->WildMidiSetOption(WM_MO_ENHANCED_RESAMPLING, *self? WM_MO_ENHANCED_RESAMPLING:0);
|
||||
}
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
|
@ -90,7 +101,7 @@ WildMIDIDevice::WildMIDIDevice()
|
|||
WildMidi_Shutdown();
|
||||
CurrentConfig = "";
|
||||
}
|
||||
if (!WildMidi_Init(wildmidi_config, SampleRate, WM_MO_ENHANCED_RESAMPLING))
|
||||
if (!WildMidi_Init(wildmidi_config, SampleRate, 0))
|
||||
{
|
||||
CurrentConfig = wildmidi_config;
|
||||
}
|
||||
|
@ -98,6 +109,10 @@ WildMIDIDevice::WildMIDIDevice()
|
|||
if (CurrentConfig.IsNotEmpty())
|
||||
{
|
||||
Renderer = new WildMidi_Renderer();
|
||||
int flags = 0;
|
||||
if (wildmidi_enhanced_resampling) flags |= WM_MO_ENHANCED_RESAMPLING;
|
||||
if (wildmidi_reverb) flags |= WM_MO_REVERB;
|
||||
Renderer->SetOption(WM_MO_ENHANCED_RESAMPLING | WM_MO_REVERB, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,3 +219,14 @@ FString WildMIDIDevice::GetStats()
|
|||
out.Format("%3d voices", Renderer->GetVoiceCount());
|
||||
return out;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// WildMIDIDevice :: GetStats
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void WildMIDIDevice::WildMidiSetOption(int opt, int set)
|
||||
{
|
||||
Renderer->SetOption(opt, set);
|
||||
}
|
||||
|
|
|
@ -2718,6 +2718,16 @@ midi *WildMidi_NewMidi() {
|
|||
ret = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((((_mdi*)ret)->reverb = _WM_init_reverb(_WM_SampleRate, reverb_room_width,
|
||||
reverb_room_length, reverb_listen_posx, reverb_listen_posy))
|
||||
== NULL) {
|
||||
_WM_ERROR(__FUNCTION__, __LINE__, WM_ERR_MEM, "to init reverb", 0);
|
||||
WildMidi_Close(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2988,3 +2998,8 @@ int WildMidi_Renderer::GetVoiceCount()
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void WildMidi_Renderer::SetOption(int opt, int set)
|
||||
{
|
||||
WildMidi_SetOption((_mdi*)handle, (unsigned short)opt, (unsigned short)set);
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
void ComputeOutput(float *buffer, int len);
|
||||
void LoadInstrument(int bank, int percussion, int instr);
|
||||
int GetVoiceCount();
|
||||
void SetOption(int opt, int set);
|
||||
private:
|
||||
void *handle;
|
||||
};
|
||||
|
|
|
@ -1592,7 +1592,6 @@ OptionMenu AdvSoundOptions
|
|||
StaticText "GUS Emulation", 1
|
||||
TextField "GUS config file", "midi_config"
|
||||
Slider "MIDI voices", "midi_voices", 16, 256, 4, 0
|
||||
Option "Emulate TiMidity", "midi_timiditylike", "OnOff"
|
||||
Option "Read DMXGUS lumps", "midi_dmxgus", "OnOff"
|
||||
Option "GUS memory size", "gus_memsize", "GusMemory"
|
||||
StaticText " "
|
||||
|
@ -1611,6 +1610,7 @@ OptionMenu AdvSoundOptions
|
|||
StaticText " "
|
||||
StaticText "WildMidi", 1
|
||||
TextField "WildMidi config file", "wildmidi_config"
|
||||
Option "Reverb", "wildmidi_reverb", "OnOff"
|
||||
}
|
||||
|
||||
/*=======================================
|
||||
|
|
Loading…
Reference in a new issue