mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 13:04:07 +02:00
simplify
This commit is contained in:
parent
1e7cd06d0e
commit
7fd531541c
3 changed files with 5 additions and 13 deletions
|
@ -340,12 +340,12 @@ bool AudioMixer::prepareMixForListeningNode(Node* node) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// use the per listner AudioLimiter to render the mixed data...
|
// use the per listner AudioLimiter to render the mixed data...
|
||||||
listenerNodeData->clampAudioSamples(_mixedSamples, _clampedSamples, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL);
|
listenerNodeData->audioLimiter.render(_mixedSamples, _clampedSamples, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL);
|
||||||
|
|
||||||
// check for silent audio after the peak limitor has converted the samples
|
// check for silent audio after the peak limitor has converted the samples
|
||||||
bool hasAudio = false;
|
bool hasAudio = false;
|
||||||
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; ++i) {
|
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; ++i) {
|
||||||
if (_clampedSamples[i] != 0.0f) {
|
if (_clampedSamples[i] != 0) {
|
||||||
hasAudio = true;
|
hasAudio = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#include <udt/PacketHeaders.h>
|
#include <udt/PacketHeaders.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
#include <AudioLimiter.h>;
|
|
||||||
|
|
||||||
#include "InjectedAudioStream.h"
|
#include "InjectedAudioStream.h"
|
||||||
|
|
||||||
#include "AudioMixer.h"
|
#include "AudioMixer.h"
|
||||||
|
@ -29,7 +27,7 @@ AudioMixerClientData::AudioMixerClientData(const QUuid& nodeID) :
|
||||||
NodeData(nodeID),
|
NodeData(nodeID),
|
||||||
_outgoingMixedAudioSequenceNumber(0),
|
_outgoingMixedAudioSequenceNumber(0),
|
||||||
_downstreamAudioStreamStats(),
|
_downstreamAudioStreamStats(),
|
||||||
_audioLimiter(new AudioLimiter(AudioConstants::SAMPLE_RATE, AudioConstants::STEREO))
|
audioLimiter(AudioConstants::SAMPLE_RATE, AudioConstants::STEREO)
|
||||||
{
|
{
|
||||||
// of the ~94 blocks in a second of audio sent from the AudioMixer, pick a random one to send out a stats packet on
|
// of the ~94 blocks in a second of audio sent from the AudioMixer, pick a random one to send out a stats packet on
|
||||||
// this ensures we send out stats to this client around every second
|
// this ensures we send out stats to this client around every second
|
||||||
|
@ -41,10 +39,6 @@ AudioMixerClientData::AudioMixerClientData(const QUuid& nodeID) :
|
||||||
_frameToSendStats = distribution(numberGenerator);
|
_frameToSendStats = distribution(numberGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMixerClientData::clampAudioSamples(float* input, int16_t* output, int numFrames) {
|
|
||||||
_audioLimiter->render(input, output, numFrames);
|
|
||||||
}
|
|
||||||
|
|
||||||
AvatarAudioStream* AudioMixerClientData::getAvatarAudioStream() {
|
AvatarAudioStream* AudioMixerClientData::getAvatarAudioStream() {
|
||||||
QReadLocker readLocker { &_streamsLock };
|
QReadLocker readLocker { &_streamsLock };
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
|
|
||||||
#include <AABox.h>
|
#include <AABox.h>
|
||||||
#include <AudioHRTF.h>
|
#include <AudioHRTF.h>
|
||||||
|
#include <AudioLimiter.h>
|
||||||
#include <UUIDHasher.h>
|
#include <UUIDHasher.h>
|
||||||
|
|
||||||
#include "PositionalAudioStream.h"
|
#include "PositionalAudioStream.h"
|
||||||
#include "AvatarAudioStream.h"
|
#include "AvatarAudioStream.h"
|
||||||
|
|
||||||
class AudioLimiter;
|
|
||||||
|
|
||||||
class AudioMixerClientData : public NodeData {
|
class AudioMixerClientData : public NodeData {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
// uses randomization to have the AudioMixer send a stats packet to this node around every second
|
// uses randomization to have the AudioMixer send a stats packet to this node around every second
|
||||||
bool shouldSendStats(int frameNumber);
|
bool shouldSendStats(int frameNumber);
|
||||||
|
|
||||||
void clampAudioSamples(float* input, int16_t* output, int numFrames);
|
AudioLimiter audioLimiter;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void injectorStreamFinished(const QUuid& streamIdentifier);
|
void injectorStreamFinished(const QUuid& streamIdentifier);
|
||||||
|
@ -81,8 +81,6 @@ private:
|
||||||
AudioStreamStats _downstreamAudioStreamStats;
|
AudioStreamStats _downstreamAudioStreamStats;
|
||||||
|
|
||||||
int _frameToSendStats { 0 };
|
int _frameToSendStats { 0 };
|
||||||
|
|
||||||
std::unique_ptr<AudioLimiter> _audioLimiter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AudioMixerClientData_h
|
#endif // hifi_AudioMixerClientData_h
|
||||||
|
|
Loading…
Reference in a new issue