fix for build busters with changed AbstractAudioInterface

This commit is contained in:
Stephen Birarda 2013-12-19 12:39:57 -08:00
parent eac3b6be65
commit b035f74f94
3 changed files with 17 additions and 8 deletions

View file

@ -42,7 +42,7 @@ static const int ICON_LEFT = 20;
static const int BOTTOM_PADDING = 110;
Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* parent) :
QObject(parent),
AbstractAudioInterface(parent),
_audioInput(NULL),
_desiredInputFormat(),
_inputFormat(),
@ -469,17 +469,23 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) {
int16_t* byteArraySamples = (int16_t*) audioByteArray.data();
for (int i = 0; i < NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL; i++) {
int samplesToRead = MIN(audioByteArray.size() / sizeof(int16_t),
NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
for (int i = 0; i < samplesToRead; i++) {
_localInjectedSamples[i] = glm::clamp(_localInjectedSamples[i] + byteArraySamples[i],
MIN_SAMPLE_VALUE, MAX_SAMPLE_VALUE);
}
// pull out the bytes we just read for outputs
audioByteArray.remove(0, NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL);
if (audioByteArray.size() == 0) {
// if there isn't anything left to inject from this byte array, remove it from the vector
if (samplesToRead < NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL) {
// there isn't anything left to inject from this byte array, remove it from the vector
_localInjectionByteArrays.remove(b);
} else {
// pull out the bytes we just read for outputs
audioByteArray.remove(0, samplesToRead * sizeof(int16_t));
// still data left to read - replace the byte array in the QVector with the smaller one
_localInjectionByteArrays.replace(b, audioByteArray);
}
}

View file

@ -10,9 +10,13 @@
#ifndef __hifi__AbstractAudioInterface__
#define __hifi__AbstractAudioInterface__
#include <QtCore/QObject>
class AbstractAudioInterface : public QObject {
Q_OBJECT
public:
AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
virtual void startCollisionSound(float magnitude, float frequency, float noise, float duration, bool flashScreen) = 0;
virtual void startDrumSound(float volume, float frequency, float duration, float decay) = 0;
public slots:

View file

@ -18,7 +18,6 @@ class AudioInjector : public QObject {
Q_OBJECT
public:
AudioInjector(const QUrl& sampleURL, QObject* parent = 0);
~AudioInjector();
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);