mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 12:38:46 +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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -18,7 +18,6 @@ class AudioInjector : public QObject {
|
|||
Q_OBJECT
|
||||
public:
|
||||
AudioInjector(const QUrl& sampleURL, QObject* parent = 0);
|
||||
~AudioInjector();
|
||||
|
||||
void injectViaThread(AbstractAudioInterface* localAudioInterface = NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue