mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
- Volume tweaking.
This commit is contained in:
parent
e6bae25423
commit
59352af486
2 changed files with 13 additions and 2 deletions
|
@ -70,6 +70,8 @@ public:
|
|||
instruments = nullptr;
|
||||
}
|
||||
|
||||
double test[3] = { 0, 0, 0 };
|
||||
|
||||
protected:
|
||||
TimidityPlus::Player *Renderer;
|
||||
|
||||
|
@ -161,6 +163,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata)
|
|||
}
|
||||
// No instruments loaded means we cannot play...
|
||||
if (instruments == nullptr) return 0;
|
||||
TimidityVolumeChanged();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -216,6 +219,14 @@ void TimidityPPMIDIDevice::ComputeOutput(float *buffer, int len)
|
|||
if (Renderer != nullptr)
|
||||
Renderer->compute_data(buffer, len);
|
||||
sampletime += len;
|
||||
|
||||
for (int i = 0; i < len * 2; i++)
|
||||
{
|
||||
if (buffer[i] < test[0]) test[0] = buffer[i];
|
||||
if (buffer[i] > test[1]) test[1] = buffer[i];
|
||||
test[2] += fabs(buffer[i]);
|
||||
}
|
||||
Printf("Min = %f, Max = %f, Avg = %f\n", test[0], test[1], test[2] / sampletime);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -230,7 +230,7 @@ double Player::cnv_Hz_to_vib_ratio(double freq)
|
|||
|
||||
void Player::adjust_amplification(void)
|
||||
{
|
||||
static const double compensation_ratio = 1.0;
|
||||
static const double compensation_ratio = 5.0;
|
||||
/* compensate master volume */
|
||||
master_volume = (double)(amplification) / 100.0 *
|
||||
((double)master_volume_ratio * (compensation_ratio/0xFFFF));
|
||||
|
@ -5033,7 +5033,7 @@ int Player::compute_data(float *buffer, int32_t count)
|
|||
// pass to caller
|
||||
for (int i = 0; i < process*2; i++)
|
||||
{
|
||||
*buffer++ = (common_buffer[i])*(5.f / 0x80000000u);
|
||||
*buffer++ = (common_buffer[i])*(1.f / 0x80000000u);
|
||||
}
|
||||
}
|
||||
return RC_OK;
|
||||
|
|
Loading…
Reference in a new issue