mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- made the class definitions of the MIDI devices private to the implementations.
This commit is contained in:
parent
5ef43143f8
commit
1b1069dc78
7 changed files with 236 additions and 166 deletions
|
@ -87,10 +87,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
MIDIDevice *CreateWinMIDIDevice(int mididevice);
|
|
||||||
#endif
|
|
||||||
MIDIDevice *CreateTimidityPPMIDIDevice(const char *args, int samplerate);
|
|
||||||
void TimidityPP_Shutdown();
|
void TimidityPP_Shutdown();
|
||||||
|
|
||||||
// Base class for software synthesizer MIDI output devices ------------------
|
// Base class for software synthesizer MIDI output devices ------------------
|
||||||
|
@ -172,29 +169,6 @@ public:
|
||||||
void Stop();
|
void Stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal TiMidity MIDI device --------------------------------------------
|
|
||||||
|
|
||||||
namespace Timidity { struct Renderer; }
|
|
||||||
|
|
||||||
class TimidityMIDIDevice : public SoftSynthMIDIDevice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TimidityMIDIDevice(const char *args, int samplerate);
|
|
||||||
~TimidityMIDIDevice();
|
|
||||||
|
|
||||||
int Open(MidiCallback, void *userdata);
|
|
||||||
void PrecacheInstruments(const uint16_t *instruments, int count);
|
|
||||||
FString GetStats();
|
|
||||||
int GetDeviceType() const override { return MDEV_GUS; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Timidity::Renderer *Renderer;
|
|
||||||
|
|
||||||
void HandleEvent(int status, int parm1, int parm2);
|
|
||||||
void HandleLongEvent(const uint8_t *data, int len);
|
|
||||||
void ComputeOutput(float *buffer, int len);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Internal disk writing version of a MIDI device ------------------
|
// Internal disk writing version of a MIDI device ------------------
|
||||||
|
|
||||||
class MIDIWaveWriter : public SoftSynthMIDIDevice
|
class MIDIWaveWriter : public SoftSynthMIDIDevice
|
||||||
|
@ -226,140 +200,6 @@ protected:
|
||||||
SoftSynthMIDIDevice *playDevice;
|
SoftSynthMIDIDevice *playDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
// WildMidi implementation of a MIDI device ---------------------------------
|
|
||||||
|
|
||||||
class WildMIDIDevice : public SoftSynthMIDIDevice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WildMIDIDevice(const char *args, int samplerate);
|
|
||||||
~WildMIDIDevice();
|
|
||||||
|
|
||||||
int Open(MidiCallback, void *userdata);
|
|
||||||
void PrecacheInstruments(const uint16_t *instruments, int count);
|
|
||||||
FString GetStats();
|
|
||||||
int GetDeviceType() const override { return MDEV_WILDMIDI; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
WildMidi_Renderer *Renderer;
|
|
||||||
|
|
||||||
void HandleEvent(int status, int parm1, int parm2);
|
|
||||||
void HandleLongEvent(const uint8_t *data, int len);
|
|
||||||
void ComputeOutput(float *buffer, int len);
|
|
||||||
void WildMidiSetOption(int opt, int set);
|
|
||||||
};
|
|
||||||
|
|
||||||
// FluidSynth implementation of a MIDI device -------------------------------
|
|
||||||
|
|
||||||
#ifndef DYN_FLUIDSYNTH
|
|
||||||
#include <fluidsynth.h>
|
|
||||||
#else
|
|
||||||
#include "i_module.h"
|
|
||||||
extern FModule FluidSynthModule;
|
|
||||||
|
|
||||||
struct fluid_settings_t;
|
|
||||||
struct fluid_synth_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class FluidSynthMIDIDevice : public SoftSynthMIDIDevice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FluidSynthMIDIDevice(const char *args, int samplerate);
|
|
||||||
~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);
|
|
||||||
int GetDeviceType() const override { return MDEV_FLUIDSYNTH; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void HandleEvent(int status, int parm1, int parm2);
|
|
||||||
void HandleLongEvent(const uint8_t *data, int len);
|
|
||||||
void ComputeOutput(float *buffer, int len);
|
|
||||||
int LoadPatchSets(const char *patches);
|
|
||||||
|
|
||||||
fluid_settings_t *FluidSettings;
|
|
||||||
fluid_synth_t *FluidSynth;
|
|
||||||
|
|
||||||
#ifdef DYN_FLUIDSYNTH
|
|
||||||
enum { FLUID_FAILED = -1, FLUID_OK = 0 };
|
|
||||||
static TReqProc<FluidSynthModule, fluid_settings_t *(*)()> new_fluid_settings;
|
|
||||||
static TReqProc<FluidSynthModule, fluid_synth_t *(*)(fluid_settings_t *)> new_fluid_synth;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> delete_fluid_synth;
|
|
||||||
static TReqProc<FluidSynthModule, void (*)(fluid_settings_t *)> delete_fluid_settings;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, double)> fluid_settings_setnum;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, const char *)> fluid_settings_setstr;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, int)> fluid_settings_setint;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, int *)> fluid_settings_getint;
|
|
||||||
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, int)> fluid_synth_set_reverb_on;
|
|
||||||
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, int)> fluid_synth_set_chorus_on;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_set_interp_method;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int)> fluid_synth_set_polyphony;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> fluid_synth_get_polyphony;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> fluid_synth_get_active_voice_count;
|
|
||||||
static TReqProc<FluidSynthModule, double (*)(fluid_synth_t *)> fluid_synth_get_cpu_load;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> fluid_synth_system_reset;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int, int)> fluid_synth_noteon;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_noteoff;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int, int)> fluid_synth_cc;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_program_change;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_channel_pressure;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_pitch_bend;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, void *, int, int, void *, int, int)> fluid_synth_write_float;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, const char *, int)> fluid_synth_sfload;
|
|
||||||
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, double, double, double, double)> fluid_synth_set_reverb;
|
|
||||||
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, int, double, double, double, int)> fluid_synth_set_chorus;
|
|
||||||
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, const char *, int, char *, int *, int *, int)> fluid_synth_sysex;
|
|
||||||
|
|
||||||
bool LoadFluidSynth();
|
|
||||||
void UnloadFluidSynth();
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ADLMIDIDevice : public SoftSynthMIDIDevice
|
|
||||||
{
|
|
||||||
struct ADL_MIDIPlayer *Renderer;
|
|
||||||
public:
|
|
||||||
ADLMIDIDevice(const char *args);
|
|
||||||
~ADLMIDIDevice();
|
|
||||||
|
|
||||||
int Open(MidiCallback, void *userdata);
|
|
||||||
int GetDeviceType() const override { return MDEV_ADL; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void HandleEvent(int status, int parm1, int parm2);
|
|
||||||
void HandleLongEvent(const uint8_t *data, int len);
|
|
||||||
void ComputeOutput(float *buffer, int len);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int LoadCustomBank(const char *bankfile);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class OPNMIDIDevice : public SoftSynthMIDIDevice
|
|
||||||
{
|
|
||||||
struct OPN2_MIDIPlayer *Renderer;
|
|
||||||
public:
|
|
||||||
OPNMIDIDevice(const char *args);
|
|
||||||
~OPNMIDIDevice();
|
|
||||||
|
|
||||||
|
|
||||||
int Open(MidiCallback, void *userdata);
|
|
||||||
int GetDeviceType() const override { return MDEV_OPN; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void HandleEvent(int status, int parm1, int parm2);
|
|
||||||
void HandleLongEvent(const uint8_t *data, int len);
|
|
||||||
void ComputeOutput(float *buffer, int len);
|
|
||||||
|
|
||||||
private:
|
|
||||||
int LoadCustomBank(const char *bankfile);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Base class for streaming MUS and MIDI files ------------------------------
|
// Base class for streaming MUS and MIDI files ------------------------------
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -38,6 +38,27 @@
|
||||||
#include "adlmidi/adlmidi.h"
|
#include "adlmidi/adlmidi.h"
|
||||||
#include "i_soundfont.h"
|
#include "i_soundfont.h"
|
||||||
|
|
||||||
|
class ADLMIDIDevice : public SoftSynthMIDIDevice
|
||||||
|
{
|
||||||
|
struct ADL_MIDIPlayer *Renderer;
|
||||||
|
public:
|
||||||
|
ADLMIDIDevice(const char *args);
|
||||||
|
~ADLMIDIDevice();
|
||||||
|
|
||||||
|
int Open(MidiCallback, void *userdata);
|
||||||
|
int GetDeviceType() const override { return MDEV_ADL; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void HandleEvent(int status, int parm1, int parm2);
|
||||||
|
void HandleLongEvent(const uint8_t *data, int len);
|
||||||
|
void ComputeOutput(float *buffer, int len);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int LoadCustomBank(const char *bankfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ME_NOTEOFF = 0x80,
|
ME_NOTEOFF = 0x80,
|
||||||
|
@ -267,3 +288,15 @@ void ADLMIDIDevice::ComputeOutput(float *buffer, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
MIDIDevice *CreateADLMIDIDevice(const char *args)
|
||||||
|
{
|
||||||
|
return new ADLMIDIDevice(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,75 @@
|
||||||
#include "i_soundfont.h"
|
#include "i_soundfont.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
|
|
||||||
|
// FluidSynth implementation of a MIDI device -------------------------------
|
||||||
|
|
||||||
|
#ifndef DYN_FLUIDSYNTH
|
||||||
|
#include <fluidsynth.h>
|
||||||
|
#else
|
||||||
|
#include "i_module.h"
|
||||||
|
extern FModule FluidSynthModule;
|
||||||
|
|
||||||
|
struct fluid_settings_t;
|
||||||
|
struct fluid_synth_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class FluidSynthMIDIDevice : public SoftSynthMIDIDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FluidSynthMIDIDevice(const char *args, int samplerate);
|
||||||
|
~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);
|
||||||
|
int GetDeviceType() const override { return MDEV_FLUIDSYNTH; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void HandleEvent(int status, int parm1, int parm2);
|
||||||
|
void HandleLongEvent(const uint8_t *data, int len);
|
||||||
|
void ComputeOutput(float *buffer, int len);
|
||||||
|
int LoadPatchSets(const char *patches);
|
||||||
|
|
||||||
|
fluid_settings_t *FluidSettings;
|
||||||
|
fluid_synth_t *FluidSynth;
|
||||||
|
|
||||||
|
#ifdef DYN_FLUIDSYNTH
|
||||||
|
enum { FLUID_FAILED = -1, FLUID_OK = 0 };
|
||||||
|
static TReqProc<FluidSynthModule, fluid_settings_t *(*)()> new_fluid_settings;
|
||||||
|
static TReqProc<FluidSynthModule, fluid_synth_t *(*)(fluid_settings_t *)> new_fluid_synth;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> delete_fluid_synth;
|
||||||
|
static TReqProc<FluidSynthModule, void (*)(fluid_settings_t *)> delete_fluid_settings;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, double)> fluid_settings_setnum;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, const char *)> fluid_settings_setstr;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, int)> fluid_settings_setint;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_settings_t *, const char *, int *)> fluid_settings_getint;
|
||||||
|
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, int)> fluid_synth_set_reverb_on;
|
||||||
|
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, int)> fluid_synth_set_chorus_on;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_set_interp_method;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int)> fluid_synth_set_polyphony;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> fluid_synth_get_polyphony;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> fluid_synth_get_active_voice_count;
|
||||||
|
static TReqProc<FluidSynthModule, double (*)(fluid_synth_t *)> fluid_synth_get_cpu_load;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *)> fluid_synth_system_reset;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int, int)> fluid_synth_noteon;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_noteoff;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int, int)> fluid_synth_cc;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_program_change;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_channel_pressure;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, int)> fluid_synth_pitch_bend;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, int, void *, int, int, void *, int, int)> fluid_synth_write_float;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, const char *, int)> fluid_synth_sfload;
|
||||||
|
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, double, double, double, double)> fluid_synth_set_reverb;
|
||||||
|
static TReqProc<FluidSynthModule, void (*)(fluid_synth_t *, int, double, double, double, int)> fluid_synth_set_chorus;
|
||||||
|
static TReqProc<FluidSynthModule, int (*)(fluid_synth_t *, const char *, int, char *, int *, int *, int)> fluid_synth_sysex;
|
||||||
|
|
||||||
|
bool LoadFluidSynth();
|
||||||
|
void UnloadFluidSynth();
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef DYN_FLUIDSYNTH
|
#ifdef DYN_FLUIDSYNTH
|
||||||
|
@ -742,6 +811,17 @@ void FluidSynthMIDIDevice::UnloadFluidSynth()
|
||||||
FluidSynthModule.Unload();
|
FluidSynthModule.Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
MIDIDevice *CreateFluidSynthMIDIDevice(const char *args, int samplerate)
|
||||||
|
{
|
||||||
|
return new FluidSynthMIDIDevice(args, samplerate);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,27 @@
|
||||||
#include "opnmidi/opnmidi.h"
|
#include "opnmidi/opnmidi.h"
|
||||||
#include "i_soundfont.h"
|
#include "i_soundfont.h"
|
||||||
|
|
||||||
|
class OPNMIDIDevice : public SoftSynthMIDIDevice
|
||||||
|
{
|
||||||
|
struct OPN2_MIDIPlayer *Renderer;
|
||||||
|
public:
|
||||||
|
OPNMIDIDevice(const char *args);
|
||||||
|
~OPNMIDIDevice();
|
||||||
|
|
||||||
|
|
||||||
|
int Open(MidiCallback, void *userdata);
|
||||||
|
int GetDeviceType() const override { return MDEV_OPN; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void HandleEvent(int status, int parm1, int parm2);
|
||||||
|
void HandleLongEvent(const uint8_t *data, int len);
|
||||||
|
void ComputeOutput(float *buffer, int len);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int LoadCustomBank(const char *bankfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ME_NOTEOFF = 0x80,
|
ME_NOTEOFF = 0x80,
|
||||||
|
@ -255,3 +276,16 @@ void OPNMIDIDevice::ComputeOutput(float *buffer, int len)
|
||||||
OPN2_UInt8* right = reinterpret_cast<OPN2_UInt8*>(buffer + 1);
|
OPN2_UInt8* right = reinterpret_cast<OPN2_UInt8*>(buffer + 1);
|
||||||
opn2_generateFormat(Renderer, len * 2, left, right, &audio_output_format);
|
opn2_generateFormat(Renderer, len * 2, left, right, &audio_output_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
MIDIDevice *CreateOPNMIDIDevice(const char *args)
|
||||||
|
{
|
||||||
|
return new OPNMIDIDevice(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,30 @@
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
|
// Internal TiMidity MIDI device --------------------------------------------
|
||||||
|
|
||||||
|
namespace Timidity { struct Renderer; }
|
||||||
|
|
||||||
|
class TimidityMIDIDevice : public SoftSynthMIDIDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TimidityMIDIDevice(const char *args, int samplerate);
|
||||||
|
~TimidityMIDIDevice();
|
||||||
|
|
||||||
|
int Open(MidiCallback, void *userdata);
|
||||||
|
void PrecacheInstruments(const uint16_t *instruments, int count);
|
||||||
|
FString GetStats();
|
||||||
|
int GetDeviceType() const override { return MDEV_GUS; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Timidity::Renderer *Renderer;
|
||||||
|
|
||||||
|
void HandleEvent(int status, int parm1, int parm2);
|
||||||
|
void HandleLongEvent(const uint8_t *data, int len);
|
||||||
|
void ComputeOutput(float *buffer, int len);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
@ -214,3 +238,15 @@ FString TimidityMIDIDevice::GetStats()
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
MIDIDevice *CreateTimidityMIDIDevice(const char *args, int samplerate)
|
||||||
|
{
|
||||||
|
return new TimidityMIDIDevice(args, samplerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,31 @@
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
|
// WildMidi implementation of a MIDI device ---------------------------------
|
||||||
|
|
||||||
|
class WildMIDIDevice : public SoftSynthMIDIDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WildMIDIDevice(const char *args, int samplerate);
|
||||||
|
~WildMIDIDevice();
|
||||||
|
|
||||||
|
int Open(MidiCallback, void *userdata);
|
||||||
|
void PrecacheInstruments(const uint16_t *instruments, int count);
|
||||||
|
FString GetStats();
|
||||||
|
int GetDeviceType() const override { return MDEV_WILDMIDI; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
WildMidi_Renderer *Renderer;
|
||||||
|
|
||||||
|
void HandleEvent(int status, int parm1, int parm2);
|
||||||
|
void HandleLongEvent(const uint8_t *data, int len);
|
||||||
|
void ComputeOutput(float *buffer, int len);
|
||||||
|
void WildMidiSetOption(int opt, int set);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
@ -231,3 +256,15 @@ void WildMIDIDevice::WildMidiSetOption(int opt, int set)
|
||||||
{
|
{
|
||||||
Renderer->SetOption(opt, set);
|
Renderer->SetOption(opt, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
MIDIDevice *CreateWildMIDIDevice(const char *args, int samplerate)
|
||||||
|
{
|
||||||
|
return new WildMIDIDevice(args, samplerate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,16 @@
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
MIDIDevice *CreateWinMIDIDevice(int mididevice);
|
||||||
|
#endif
|
||||||
|
MIDIDevice *CreateFluidSynthMIDIDevice(const char *args, int samplerate);
|
||||||
|
MIDIDevice *CreateTimidityMIDIDevice(const char *args, int samplerate);
|
||||||
|
MIDIDevice *CreateTimidityPPMIDIDevice(const char *args, int samplerate);
|
||||||
|
MIDIDevice *CreateADLMIDIDevice(const char *args);
|
||||||
|
MIDIDevice *CreateOPNMIDIDevice(const char *args);
|
||||||
|
MIDIDevice *CreateWildMIDIDevice(const char *args, int samplerate);
|
||||||
|
|
||||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
@ -197,15 +207,15 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate)
|
||||||
switch (devtype)
|
switch (devtype)
|
||||||
{
|
{
|
||||||
case MDEV_GUS:
|
case MDEV_GUS:
|
||||||
dev = new TimidityMIDIDevice(Args, samplerate);
|
dev = CreateTimidityMIDIDevice(Args, samplerate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDEV_ADL:
|
case MDEV_ADL:
|
||||||
dev = new ADLMIDIDevice(Args);
|
dev = CreateADLMIDIDevice(Args);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDEV_OPN:
|
case MDEV_OPN:
|
||||||
dev = new OPNMIDIDevice(Args);
|
dev = CreateOPNMIDIDevice(Args);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDEV_MMAPI:
|
case MDEV_MMAPI:
|
||||||
|
@ -217,7 +227,7 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate)
|
||||||
// Intentional fall-through for non-Windows systems.
|
// Intentional fall-through for non-Windows systems.
|
||||||
|
|
||||||
case MDEV_FLUIDSYNTH:
|
case MDEV_FLUIDSYNTH:
|
||||||
dev = new FluidSynthMIDIDevice(Args, samplerate);
|
dev = CreateFluidSynthMIDIDevice(Args, samplerate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDEV_OPL:
|
case MDEV_OPL:
|
||||||
|
@ -229,7 +239,7 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype, int samplerate)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MDEV_WILDMIDI:
|
case MDEV_WILDMIDI:
|
||||||
dev = new WildMIDIDevice(Args, samplerate);
|
dev = CreateWildMIDIDevice(Args, samplerate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue