mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
require that buffers be above min loudness to be mixed in
This commit is contained in:
parent
a8ef64e0ce
commit
64f946b640
1 changed files with 12 additions and 3 deletions
|
@ -379,13 +379,15 @@ void AudioMixer::run() {
|
||||||
float percentageSleep = (usecToSleep / (float) BUFFER_SEND_INTERVAL_USECS);
|
float percentageSleep = (usecToSleep / (float) BUFFER_SEND_INTERVAL_USECS);
|
||||||
|
|
||||||
float lastCutoffRatio = _loudnessCutoffRatio;
|
float lastCutoffRatio = _loudnessCutoffRatio;
|
||||||
|
bool hasRatioChanged = false;
|
||||||
|
|
||||||
if (percentageSleep <= STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD || usecToSleep < 0) {
|
if (percentageSleep <= STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD || usecToSleep < 0) {
|
||||||
// we're struggling - change our min required loudness to reduce some load
|
// we're struggling - change our min required loudness to reduce some load
|
||||||
_loudnessCutoffRatio += (1 - _loudnessCutoffRatio) / 2;
|
_loudnessCutoffRatio += (1 - _loudnessCutoffRatio) / 2;
|
||||||
|
|
||||||
qDebug() << "Mixer is struggling, sleeping" << percentageSleep * 100 << "% of frame time. Old cutoff was"
|
qDebug() << "Mixer is struggling, sleeping" << percentageSleep * 100 << "% of frame time. Old cutoff was"
|
||||||
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
|
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
|
||||||
|
hasRatioChanged = true;
|
||||||
} else if (percentageSleep >= BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD && _loudnessCutoffRatio != 0) {
|
} else if (percentageSleep >= BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD && _loudnessCutoffRatio != 0) {
|
||||||
// we've recovered and can back off the required loudness
|
// we've recovered and can back off the required loudness
|
||||||
_loudnessCutoffRatio -= _loudnessCutoffRatio / 2;
|
_loudnessCutoffRatio -= _loudnessCutoffRatio / 2;
|
||||||
|
@ -396,10 +398,17 @@ void AudioMixer::run() {
|
||||||
|
|
||||||
qDebug() << "Mixer is recovering, sleeping" << percentageSleep * 100 << "% of frame time. Old cutoff was"
|
qDebug() << "Mixer is recovering, sleeping" << percentageSleep * 100 << "% of frame time. Old cutoff was"
|
||||||
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
|
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
|
||||||
|
hasRatioChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set out min required loudness from the new ratio
|
if (hasRatioChanged) {
|
||||||
_minRequiredLoudness = _loudnessCutoffRatio * (_maxSourceLoudnessInFrame - _minSourceLoudnessInFrame);
|
// set out min required loudness from the new ratio
|
||||||
|
_minRequiredLoudness = _loudnessCutoffRatio * (_maxSourceLoudnessInFrame - _minSourceLoudnessInFrame);
|
||||||
|
qDebug() << "Minimum loudness required to be mixed is now" << _minRequiredLoudness;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
isFirstRun = false;
|
isFirstRun = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue