mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:48:09 +02:00
fix for build busters with changed AbstractAudioInterface
This commit is contained in:
parent
eac3b6be65
commit
b035f74f94
3 changed files with 17 additions and 8 deletions
|
@ -42,7 +42,7 @@ static const int ICON_LEFT = 20;
|
||||||
static const int BOTTOM_PADDING = 110;
|
static const int BOTTOM_PADDING = 110;
|
||||||
|
|
||||||
Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* parent) :
|
Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* parent) :
|
||||||
QObject(parent),
|
AbstractAudioInterface(parent),
|
||||||
_audioInput(NULL),
|
_audioInput(NULL),
|
||||||
_desiredInputFormat(),
|
_desiredInputFormat(),
|
||||||
_inputFormat(),
|
_inputFormat(),
|
||||||
|
@ -469,17 +469,23 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) {
|
||||||
|
|
||||||
int16_t* byteArraySamples = (int16_t*) audioByteArray.data();
|
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],
|
_localInjectedSamples[i] = glm::clamp(_localInjectedSamples[i] + byteArraySamples[i],
|
||||||
MIN_SAMPLE_VALUE, MAX_SAMPLE_VALUE);
|
MIN_SAMPLE_VALUE, MAX_SAMPLE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pull out the bytes we just read for outputs
|
if (samplesToRead < NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL) {
|
||||||
audioByteArray.remove(0, NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL);
|
// there isn't anything left to inject from this byte array, remove it from the vector
|
||||||
|
|
||||||
if (audioByteArray.size() == 0) {
|
|
||||||
// if there isn't anything left to inject from this byte array, remove it from the vector
|
|
||||||
_localInjectionByteArrays.remove(b);
|
_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,13 @@
|
||||||
#ifndef __hifi__AbstractAudioInterface__
|
#ifndef __hifi__AbstractAudioInterface__
|
||||||
#define __hifi__AbstractAudioInterface__
|
#define __hifi__AbstractAudioInterface__
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
class AbstractAudioInterface : public QObject {
|
class AbstractAudioInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
|
||||||
|
|
||||||
virtual void startCollisionSound(float magnitude, float frequency, float noise, float duration, bool flashScreen) = 0;
|
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;
|
virtual void startDrumSound(float volume, float frequency, float duration, float decay) = 0;
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -18,7 +18,6 @@ class AudioInjector : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AudioInjector(const QUrl& sampleURL, QObject* parent = 0);
|
AudioInjector(const QUrl& sampleURL, QObject* parent = 0);
|
||||||
~AudioInjector();
|
|
||||||
|
|
||||||
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);
|
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue