mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
fixed a typo, tidied up more minor details
This commit is contained in:
parent
ae2780dcab
commit
1b0ce510f6
2 changed files with 3 additions and 4 deletions
|
@ -86,7 +86,6 @@ void AudioInjector::injectAudio() {
|
||||||
quint8 volume = MAX_INJECTOR_VOLUME * _options.getVolume();
|
quint8 volume = MAX_INJECTOR_VOLUME * _options.getVolume();
|
||||||
packetStream << volume;
|
packetStream << volume;
|
||||||
|
|
||||||
|
|
||||||
QElapsedTimer timer;
|
QElapsedTimer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
int nextFrame = 0;
|
int nextFrame = 0;
|
||||||
|
|
|
@ -23,11 +23,11 @@ AudioRingBuffer::AudioRingBuffer(int numFrameSamples, bool randomAccessMode) :
|
||||||
NodeData(),
|
NodeData(),
|
||||||
_overflowCount(0),
|
_overflowCount(0),
|
||||||
_sampleCapacity(numFrameSamples * RING_BUFFER_LENGTH_FRAMES),
|
_sampleCapacity(numFrameSamples * RING_BUFFER_LENGTH_FRAMES),
|
||||||
|
_isFull(false),
|
||||||
_numFrameSamples(numFrameSamples),
|
_numFrameSamples(numFrameSamples),
|
||||||
_isStarved(true),
|
_isStarved(true),
|
||||||
_hasStarted(false),
|
_hasStarted(false),
|
||||||
_randomAccessMode(randomAccessMode),
|
_randomAccessMode(randomAccessMode)
|
||||||
_isFull(false)
|
|
||||||
{
|
{
|
||||||
if (numFrameSamples) {
|
if (numFrameSamples) {
|
||||||
_buffer = new int16_t[_sampleCapacity];
|
_buffer = new int16_t[_sampleCapacity];
|
||||||
|
@ -56,7 +56,6 @@ void AudioRingBuffer::reset() {
|
||||||
void AudioRingBuffer::resizeForFrameSize(qint64 numFrameSamples) {
|
void AudioRingBuffer::resizeForFrameSize(qint64 numFrameSamples) {
|
||||||
delete[] _buffer;
|
delete[] _buffer;
|
||||||
_sampleCapacity = numFrameSamples * RING_BUFFER_LENGTH_FRAMES;
|
_sampleCapacity = numFrameSamples * RING_BUFFER_LENGTH_FRAMES;
|
||||||
_sampleCapacity = _sampleCapacity + 1;
|
|
||||||
_buffer = new int16_t[_sampleCapacity];
|
_buffer = new int16_t[_sampleCapacity];
|
||||||
if (_randomAccessMode) {
|
if (_randomAccessMode) {
|
||||||
memset(_buffer, 0, _sampleCapacity * sizeof(int16_t));
|
memset(_buffer, 0, _sampleCapacity * sizeof(int16_t));
|
||||||
|
@ -133,6 +132,7 @@ qint64 AudioRingBuffer::writeData(const char* data, qint64 maxSize) {
|
||||||
// there's not enough room for this write. erase old data to make room for this new data
|
// there's not enough room for this write. erase old data to make room for this new data
|
||||||
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
||||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||||
|
_overflowCount++;
|
||||||
qDebug() << "Overflowed ring buffer! Overwriting old data";
|
qDebug() << "Overflowed ring buffer! Overwriting old data";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue