This commit is contained in:
Brad Hefta-Gaub 2016-05-29 12:08:10 -07:00
parent 1e7cd06d0e
commit 7fd531541c
3 changed files with 5 additions and 13 deletions

View file

@ -340,12 +340,12 @@ bool AudioMixer::prepareMixForListeningNode(Node* node) {
});
// 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
bool hasAudio = false;
for (int i = 0; i < AudioConstants::NETWORK_FRAME_SAMPLES_STEREO; ++i) {
if (_clampedSamples[i] != 0.0f) {
if (_clampedSamples[i] != 0) {
hasAudio = true;
break;
}

View file

@ -17,8 +17,6 @@
#include <udt/PacketHeaders.h>
#include <UUID.h>
#include <AudioLimiter.h>;
#include "InjectedAudioStream.h"
#include "AudioMixer.h"
@ -29,7 +27,7 @@ AudioMixerClientData::AudioMixerClientData(const QUuid& nodeID) :
NodeData(nodeID),
_outgoingMixedAudioSequenceNumber(0),
_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
// this ensures we send out stats to this client around every second
@ -41,10 +39,6 @@ AudioMixerClientData::AudioMixerClientData(const QUuid& nodeID) :
_frameToSendStats = distribution(numberGenerator);
}
void AudioMixerClientData::clampAudioSamples(float* input, int16_t* output, int numFrames) {
_audioLimiter->render(input, output, numFrames);
}
AvatarAudioStream* AudioMixerClientData::getAvatarAudioStream() {
QReadLocker readLocker { &_streamsLock };

View file

@ -16,12 +16,12 @@
#include <AABox.h>
#include <AudioHRTF.h>
#include <AudioLimiter.h>
#include <UUIDHasher.h>
#include "PositionalAudioStream.h"
#include "AvatarAudioStream.h"
class AudioLimiter;
class AudioMixerClientData : public NodeData {
Q_OBJECT
@ -63,7 +63,7 @@ public:
// uses randomization to have the AudioMixer send a stats packet to this node around every second
bool shouldSendStats(int frameNumber);
void clampAudioSamples(float* input, int16_t* output, int numFrames);
AudioLimiter audioLimiter;
signals:
void injectorStreamFinished(const QUuid& streamIdentifier);
@ -81,8 +81,6 @@ private:
AudioStreamStats _downstreamAudioStreamStats;
int _frameToSendStats { 0 };
std::unique_ptr<AudioLimiter> _audioLimiter;
};
#endif // hifi_AudioMixerClientData_h