mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- fixed setup for Timidity++ playback frequency.
This commit is contained in:
parent
4b7e57b007
commit
4d4edcfbfb
3 changed files with 15 additions and 11 deletions
|
@ -115,6 +115,8 @@ TimidityPPMIDIDevice::TimidityPPMIDIDevice(const char *args)
|
||||||
delete instruments;
|
delete instruments;
|
||||||
instruments = nullptr;
|
instruments = nullptr;
|
||||||
}
|
}
|
||||||
|
TimidityPlus::set_playback_rate(timidity_frequency);
|
||||||
|
SampleRate = timidity_frequency;
|
||||||
if (instruments == nullptr)
|
if (instruments == nullptr)
|
||||||
{
|
{
|
||||||
instruments = new TimidityPlus::Instruments;
|
instruments = new TimidityPlus::Instruments;
|
||||||
|
@ -126,7 +128,7 @@ TimidityPPMIDIDevice::TimidityPPMIDIDevice(const char *args)
|
||||||
}
|
}
|
||||||
if (instruments != nullptr)
|
if (instruments != nullptr)
|
||||||
{
|
{
|
||||||
Renderer = new TimidityPlus::Player(timidity_frequency, instruments);
|
Renderer = new TimidityPlus::Player(instruments);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -158,7 +160,6 @@ TimidityPPMIDIDevice::~TimidityPPMIDIDevice ()
|
||||||
|
|
||||||
int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
|
int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
int ret = OpenStream(2, 0, callback, userdata);
|
int ret = OpenStream(2, 0, callback, userdata);
|
||||||
if (ret == 0 && Renderer != nullptr)
|
if (ret == 0 && Renderer != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,8 +181,8 @@ namespace TimidityPlus
|
||||||
{
|
{
|
||||||
|
|
||||||
// These two variables need to remain global or things will get messy because they get accessed from non-class code.
|
// These two variables need to remain global or things will get messy because they get accessed from non-class code.
|
||||||
int32_t control_ratio = 44;
|
int32_t control_ratio = 22;
|
||||||
int32_t playback_rate = 44100;
|
int32_t playback_rate = 22050;
|
||||||
|
|
||||||
#define PLAY_INTERLEAVE_SEC 1.0
|
#define PLAY_INTERLEAVE_SEC 1.0
|
||||||
#define PORTAMENTO_TIME_TUNING (1.0 / 5000.0)
|
#define PORTAMENTO_TIME_TUNING (1.0 / 5000.0)
|
||||||
|
@ -195,20 +195,24 @@ int32_t playback_rate = 44100;
|
||||||
#define DEFAULT_AMPLIFICATION 70
|
#define DEFAULT_AMPLIFICATION 70
|
||||||
#define VIBRATO_DEPTH_MAX 384 /* 600 cent */
|
#define VIBRATO_DEPTH_MAX 384 /* 600 cent */
|
||||||
|
|
||||||
Player::Player(int freq, Instruments *instr)
|
void set_playback_rate(int freq)
|
||||||
{
|
{
|
||||||
const int CONTROLS_PER_SECOND = 1000;
|
const int CONTROLS_PER_SECOND = 1000;
|
||||||
const int MAX_CONTROL_RATIO = 255;
|
const int MAX_CONTROL_RATIO = 255;
|
||||||
|
|
||||||
last_reverb_setting = timidity_reverb;
|
|
||||||
memset(this, 0, sizeof(*this));
|
|
||||||
|
|
||||||
playback_rate = freq;
|
playback_rate = freq;
|
||||||
control_ratio = playback_rate / CONTROLS_PER_SECOND;
|
control_ratio = playback_rate / CONTROLS_PER_SECOND;
|
||||||
if (control_ratio < 1)
|
if (control_ratio < 1)
|
||||||
control_ratio = 1;
|
control_ratio = 1;
|
||||||
else if (control_ratio > MAX_CONTROL_RATIO)
|
else if (control_ratio > MAX_CONTROL_RATIO)
|
||||||
control_ratio = MAX_CONTROL_RATIO;
|
control_ratio = MAX_CONTROL_RATIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Player::Player(Instruments *instr)
|
||||||
|
{
|
||||||
|
last_reverb_setting = timidity_reverb;
|
||||||
|
memset(this, 0, sizeof(*this));
|
||||||
|
|
||||||
// init one-time global stuff - this should go to the device class once it exists.
|
// init one-time global stuff - this should go to the device class once it exists.
|
||||||
instruments = instr;
|
instruments = instr;
|
||||||
|
|
|
@ -519,8 +519,6 @@ public:
|
||||||
ChannelBitMask drumchannel_mask;
|
ChannelBitMask drumchannel_mask;
|
||||||
ChannelBitMask drumchannels;
|
ChannelBitMask drumchannels;
|
||||||
double *vol_table;
|
double *vol_table;
|
||||||
int playback_rate;
|
|
||||||
int control_ratio;
|
|
||||||
|
|
||||||
// make this private later
|
// make this private later
|
||||||
Instruments *instruments;
|
Instruments *instruments;
|
||||||
|
@ -696,7 +694,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Player(int freq, Instruments *);
|
Player(Instruments *);
|
||||||
~Player();
|
~Player();
|
||||||
|
|
||||||
bool ISDRUMCHANNEL(int c)
|
bool ISDRUMCHANNEL(int c)
|
||||||
|
@ -741,6 +739,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void free_gauss_table(void);
|
void free_gauss_table(void);
|
||||||
|
void set_playback_rate(int freq);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue