mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 02:01:30 +02:00
change audio-mixer struggle behaviour
This commit is contained in:
parent
66b863eea8
commit
5567d9acb9
1 changed files with 2 additions and 7 deletions
|
@ -383,7 +383,6 @@ void AudioMixer::run() {
|
|||
|
||||
const float STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.10f;
|
||||
const float BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.20f;
|
||||
const float CUTOFF_DELTA = 0.02f;
|
||||
|
||||
const float CURRENT_FRAME_RATIO = 1.0f / TRAILING_AVERAGE_FRAMES;
|
||||
const float PREVIOUS_FRAMES_RATIO = 1.0f - CURRENT_FRAME_RATIO;
|
||||
|
@ -401,18 +400,14 @@ void AudioMixer::run() {
|
|||
if (framesSinceCutoffEvent >= TRAILING_AVERAGE_FRAMES) {
|
||||
if (_trailingSleepRatio <= STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD) {
|
||||
// we're struggling - change our min required loudness to reduce some load
|
||||
audabilityCutoffRatio += CUTOFF_DELTA;
|
||||
|
||||
if (audabilityCutoffRatio >= 1) {
|
||||
audabilityCutoffRatio = 1 - CUTOFF_DELTA;
|
||||
}
|
||||
audabilityCutoffRatio = audabilityCutoffRatio + (0.5f * (1.0f - audabilityCutoffRatio));
|
||||
|
||||
qDebug() << "Mixer is struggling, sleeping" << _trailingSleepRatio * 100 << "% of frame time. Old cutoff was"
|
||||
<< lastCutoffRatio << "and is now" << audabilityCutoffRatio;
|
||||
hasRatioChanged = true;
|
||||
} else if (_trailingSleepRatio >= BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD && audabilityCutoffRatio != 0) {
|
||||
// we've recovered and can back off the required loudness
|
||||
audabilityCutoffRatio -= CUTOFF_DELTA;
|
||||
audabilityCutoffRatio = audabilityCutoffRatio - (1.0f - audabilityCutoffRatio);
|
||||
|
||||
if (audabilityCutoffRatio < 0) {
|
||||
audabilityCutoffRatio = 0;
|
||||
|
|
Loading…
Reference in a new issue