mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 11:53:28 +02:00
cleaned up code
This commit is contained in:
parent
a9d26b3934
commit
f7e043f52d
7 changed files with 9 additions and 40 deletions
|
@ -14,8 +14,8 @@
|
|||
#include "AvatarAudioRingBuffer.h"
|
||||
|
||||
AvatarAudioRingBuffer::AvatarAudioRingBuffer(bool isStereo, bool dynamicJitterBuffer) :
|
||||
PositionalAudioRingBuffer(PositionalAudioRingBuffer::Microphone, isStereo, dynamicJitterBuffer) {
|
||||
|
||||
PositionalAudioRingBuffer(PositionalAudioRingBuffer::Microphone, isStereo, dynamicJitterBuffer)
|
||||
{
|
||||
}
|
||||
|
||||
int AvatarAudioRingBuffer::parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) {
|
||||
|
|
|
@ -902,7 +902,6 @@ void Audio::processReceivedAudio(const QByteArray& audioByteArray) {
|
|||
pushAudioToOutput();
|
||||
}
|
||||
|
||||
|
||||
void Audio::pushAudioToOutput() {
|
||||
|
||||
if (_audioOutput->bytesFree() == _audioOutput->bufferSize()) {
|
||||
|
@ -1002,7 +1001,6 @@ void Audio::pushAudioToOutput() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Audio::processProceduralAudio(int16_t* monoInput, int numSamples) {
|
||||
|
||||
// zero out the locally injected audio in preparation for audio procedural sounds
|
||||
|
|
|
@ -25,8 +25,8 @@ AudioRingBuffer::AudioRingBuffer(int numFrameSamples, bool randomAccessMode, int
|
|||
_sampleCapacity(numFrameSamples * numFramesCapacity),
|
||||
_isFull(false),
|
||||
_numFrameSamples(numFrameSamples),
|
||||
_overflowCount(0),
|
||||
_randomAccessMode(randomAccessMode)
|
||||
_randomAccessMode(randomAccessMode),
|
||||
_overflowCount(0)
|
||||
{
|
||||
if (numFrameSamples) {
|
||||
_buffer = new int16_t[_sampleCapacity];
|
||||
|
|
|
@ -94,10 +94,6 @@ protected:
|
|||
|
||||
int _overflowCount; /// how many times has the ring buffer has overwritten old data
|
||||
|
||||
//bool _isStarved;
|
||||
//bool _hasStarted;
|
||||
|
||||
|
||||
public:
|
||||
class ConstIterator { //public std::iterator < std::forward_iterator_tag, int16_t > {
|
||||
public:
|
||||
|
@ -183,7 +179,6 @@ public:
|
|||
int16_t* _at;
|
||||
};
|
||||
|
||||
|
||||
ConstIterator nextOutput() const { return ConstIterator(_buffer, _sampleCapacity, _nextOutput); }
|
||||
};
|
||||
|
||||
|
|
|
@ -118,36 +118,14 @@ bool InboundAudioStream::popFrames(int numFrames, bool starveOnFail) {
|
|||
// if starveOnFail is true
|
||||
if (starveOnFail) {
|
||||
starved();
|
||||
_consecutiveNotMixedCount++;
|
||||
}
|
||||
_consecutiveNotMixedCount++;
|
||||
_lastPopSucceeded = false;
|
||||
}
|
||||
}
|
||||
return _lastPopSucceeded;
|
||||
}
|
||||
|
||||
bool InboundAudioStream::shouldPop(int numSamples, bool starveOnFail) {
|
||||
if (_isStarved) {
|
||||
// we're still refilling; don't mix
|
||||
_consecutiveNotMixedCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_ringBuffer.samplesAvailable() >= numSamples) {
|
||||
// we have enough samples to pop, so we're good to mix
|
||||
_hasStarted = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// we don't have enough samples, so set this stream to starve
|
||||
// if starveOnFail is true
|
||||
if (starveOnFail) {
|
||||
starved();
|
||||
_consecutiveNotMixedCount++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InboundAudioStream::setToStarved() {
|
||||
if (!_isStarved && _ringBuffer.framesAvailable() < _desiredJitterBufferFrames) {
|
||||
starved();
|
||||
|
|
|
@ -85,7 +85,6 @@ public:
|
|||
int getOverflowCount() const { return _ringBuffer.getOverflowCount(); }
|
||||
|
||||
private:
|
||||
bool shouldPop(int numSamples, bool starveOnFail);
|
||||
void starved();
|
||||
|
||||
protected:
|
||||
|
@ -117,7 +116,6 @@ protected:
|
|||
bool _isStarved;
|
||||
bool _hasStarted;
|
||||
|
||||
|
||||
// stats
|
||||
|
||||
int _consecutiveNotMixedCount;
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include "InjectedAudioRingBuffer.h"
|
||||
|
||||
InjectedAudioRingBuffer::InjectedAudioRingBuffer(const QUuid& streamIdentifier, bool dynamicJitterBuffer) :
|
||||
PositionalAudioRingBuffer(PositionalAudioRingBuffer::Injector, false, dynamicJitterBuffer),
|
||||
_streamIdentifier(streamIdentifier),
|
||||
_radius(0.0f),
|
||||
_attenuationRatio(0)
|
||||
PositionalAudioRingBuffer(PositionalAudioRingBuffer::Injector, false, dynamicJitterBuffer),
|
||||
_streamIdentifier(streamIdentifier),
|
||||
_radius(0.0f),
|
||||
_attenuationRatio(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue