mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 12:51:15 +02:00
fix bug with audio mixer muting too often
This commit is contained in:
parent
3323ac11ff
commit
12eb67c734
5 changed files with 11 additions and 14 deletions
|
@ -61,7 +61,7 @@
|
|||
|
||||
const float LOUDNESS_TO_DISTANCE_RATIO = 0.00001f;
|
||||
const float DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE = 0.18;
|
||||
const float DEFAULT_NOISE_MUTING_THRESHOLD = 0.003f;
|
||||
const float DEFAULT_NOISE_MUTING_THRESHOLD = 0.001f;
|
||||
const QString AUDIO_MIXER_LOGGING_TARGET_NAME = "audio-mixer";
|
||||
const QString AUDIO_ENV_GROUP_KEY = "audio_env";
|
||||
const QString AUDIO_BUFFER_GROUP_KEY = "audio_buffer";
|
||||
|
@ -78,7 +78,7 @@ bool AudioMixer::_printStreamStats = false;
|
|||
|
||||
bool AudioMixer::_enableFilter = true;
|
||||
|
||||
bool AudioMixer::shouldMute(float quietestFrame, float loudestFrame) {
|
||||
bool AudioMixer::shouldMute(float quietestFrame) {
|
||||
return (quietestFrame > _noiseMutingThreshold);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(AudioMixerClientData* l
|
|||
}
|
||||
|
||||
// if the stream should be muted, bail
|
||||
if (shouldMute(streamToAdd->getQuietestTrailingFrameLoudness(), streamToAdd->getLoudestTrailingFrameLoudness())) {
|
||||
if (shouldMute(streamToAdd->getQuietestFrameLoudness())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
|
||||
void perSecondActions();
|
||||
|
||||
bool shouldMute(float quietestFrame, float loudestFrame);
|
||||
bool shouldMute(float quietestFrame);
|
||||
|
||||
QString getReadPendingDatagramsCallsPerSecondsStatsString() const;
|
||||
QString getReadPendingDatagramsPacketsPerCallStatsString() const;
|
||||
|
|
|
@ -93,8 +93,8 @@
|
|||
"name": "noise_muting_threshold",
|
||||
"label": "Noise Muting Threshold",
|
||||
"help": "Loudness value for noise background between 0 and 1.0 (0: mute everyone, 1.0: never mute)",
|
||||
"placeholder": "0.003",
|
||||
"default": "0.003",
|
||||
"placeholder": "0.001",
|
||||
"default": "0.001",
|
||||
"advanced": false
|
||||
},
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ PositionalAudioStream::PositionalAudioStream(PositionalAudioStream::Type type, b
|
|||
_lastPopOutputTrailingLoudness(0.0f),
|
||||
_lastPopOutputLoudness(0.0f),
|
||||
_quietestTrailingFrameLoudness(std::numeric_limits<float>::max()),
|
||||
_loudestTrailingFrameLoudness(0.0f),
|
||||
_quietestFrameLoudness(0.0f),
|
||||
_frameCounter(0)
|
||||
{
|
||||
}
|
||||
|
@ -62,16 +62,14 @@ void PositionalAudioStream::updateLastPopOutputLoudnessAndTrailingLoudness() {
|
|||
}
|
||||
}
|
||||
if (_frameCounter++ == TRAILING_MUTE_THRESHOLD_FRAMES) {
|
||||
_quietestFrameLoudness = _quietestTrailingFrameLoudness;
|
||||
_frameCounter = 0;
|
||||
_quietestTrailingFrameLoudness = std::numeric_limits<float>::max();
|
||||
_loudestTrailingFrameLoudness = 0.0f;
|
||||
|
||||
}
|
||||
if (_lastPopOutputLoudness < _quietestTrailingFrameLoudness) {
|
||||
_quietestTrailingFrameLoudness = _lastPopOutputLoudness;
|
||||
}
|
||||
if (_lastPopOutputLoudness > _loudestTrailingFrameLoudness) {
|
||||
_loudestTrailingFrameLoudness = _lastPopOutputLoudness;
|
||||
}
|
||||
}
|
||||
|
||||
int PositionalAudioStream::parsePositionalData(const QByteArray& positionalByteArray) {
|
||||
|
|
|
@ -36,8 +36,7 @@ public:
|
|||
void updateLastPopOutputLoudnessAndTrailingLoudness();
|
||||
float getLastPopOutputTrailingLoudness() const { return _lastPopOutputTrailingLoudness; }
|
||||
float getLastPopOutputLoudness() const { return _lastPopOutputLoudness; }
|
||||
float getQuietestTrailingFrameLoudness() const { return _quietestTrailingFrameLoudness; }
|
||||
float getLoudestTrailingFrameLoudness() const { return _loudestTrailingFrameLoudness; }
|
||||
float getQuietestFrameLoudness() const { return _quietestFrameLoudness; }
|
||||
|
||||
bool shouldLoopbackForNode() const { return _shouldLoopbackForNode; }
|
||||
bool isStereo() const { return _isStereo; }
|
||||
|
@ -67,7 +66,7 @@ protected:
|
|||
float _lastPopOutputTrailingLoudness;
|
||||
float _lastPopOutputLoudness;
|
||||
float _quietestTrailingFrameLoudness;
|
||||
float _loudestTrailingFrameLoudness;
|
||||
float _quietestFrameLoudness;
|
||||
int _frameCounter;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue