mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
change back off strategy, output trailing sleep
This commit is contained in:
parent
321930cec8
commit
d0fbf4953a
1 changed files with 7 additions and 1 deletions
|
@ -384,6 +384,8 @@ void AudioMixer::run() {
|
|||
const float STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.10f;
|
||||
const float BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.20f;
|
||||
|
||||
const float RATIO_BACK_OFF = 0.02f;
|
||||
|
||||
const float CURRENT_FRAME_RATIO = 1.0f / TRAILING_AVERAGE_FRAMES;
|
||||
const float PREVIOUS_FRAMES_RATIO = 1.0f - CURRENT_FRAME_RATIO;
|
||||
|
||||
|
@ -398,6 +400,10 @@ void AudioMixer::run() {
|
|||
bool hasRatioChanged = false;
|
||||
|
||||
if (framesSinceCutoffEvent >= TRAILING_AVERAGE_FRAMES) {
|
||||
if (framesSinceCutoffEvent % TRAILING_AVERAGE_FRAMES == 0) {
|
||||
qDebug() << "Current trailing sleep ratio:" << _trailingSleepRatio;
|
||||
}
|
||||
|
||||
if (_trailingSleepRatio <= STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD) {
|
||||
// we're struggling - change our min required loudness to reduce some load
|
||||
audabilityCutoffRatio = audabilityCutoffRatio + (0.5f * (1.0f - audabilityCutoffRatio));
|
||||
|
@ -407,7 +413,7 @@ void AudioMixer::run() {
|
|||
hasRatioChanged = true;
|
||||
} else if (_trailingSleepRatio >= BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD && audabilityCutoffRatio != 0) {
|
||||
// we've recovered and can back off the required loudness
|
||||
audabilityCutoffRatio = audabilityCutoffRatio - (1.0f - audabilityCutoffRatio);
|
||||
audabilityCutoffRatio = audabilityCutoffRatio - RATIO_BACK_OFF;
|
||||
|
||||
if (audabilityCutoffRatio < 0) {
|
||||
audabilityCutoffRatio = 0;
|
||||
|
|
Loading…
Reference in a new issue