mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:19:24 +02:00
add received audio to buffer via queued connection
This commit is contained in:
parent
5ae30bc1a0
commit
d1054b3cfc
3 changed files with 6 additions and 6 deletions
|
@ -4239,7 +4239,8 @@ void* Application::networkReceive(void* args) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PACKET_TYPE_MIXED_AUDIO:
|
case PACKET_TYPE_MIXED_AUDIO:
|
||||||
app->_audio.addReceivedAudioToBuffer(app->_incomingPacket, bytesReceived);
|
QMetaObject::invokeMethod(&app->_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection,
|
||||||
|
Q_ARG(QByteArray, QByteArray((char*) app->_incomingPacket, bytesReceived)));
|
||||||
break;
|
break;
|
||||||
case PACKET_TYPE_VOXEL_DATA:
|
case PACKET_TYPE_VOXEL_DATA:
|
||||||
case PACKET_TYPE_VOXEL_ERASE:
|
case PACKET_TYPE_VOXEL_ERASE:
|
||||||
|
|
|
@ -350,7 +350,7 @@ void Audio::handleAudioInput() {
|
||||||
gettimeofday(&_lastCallbackTime, NULL);
|
gettimeofday(&_lastCallbackTime, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBytes) {
|
void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) {
|
||||||
const int NUM_INITIAL_PACKETS_DISCARD = 3;
|
const int NUM_INITIAL_PACKETS_DISCARD = 3;
|
||||||
const int STANDARD_DEVIATION_SAMPLE_COUNT = 500;
|
const int STANDARD_DEVIATION_SAMPLE_COUNT = 500;
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ void Audio::addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ringBuffer.parseData((unsigned char*) receivedData, receivedBytes);
|
_ringBuffer.parseData((unsigned char*) audioByteArray.data(), audioByteArray.size());
|
||||||
|
|
||||||
Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AUDIO)
|
Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AUDIO)
|
||||||
.updateValue(PACKET_LENGTH_BYTES + sizeof(PACKET_TYPE));
|
.updateValue(PACKET_LENGTH_BYTES + sizeof(PACKET_TYPE));
|
||||||
|
|
|
@ -42,8 +42,6 @@ public:
|
||||||
|
|
||||||
void render(int screenWidth, int screenHeight);
|
void render(int screenWidth, int screenHeight);
|
||||||
|
|
||||||
void addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBytes);
|
|
||||||
|
|
||||||
float getLastInputLoudness() const { return _lastInputLoudness; }
|
float getLastInputLoudness() const { return _lastInputLoudness; }
|
||||||
|
|
||||||
void setLastAcceleration(const glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; }
|
void setLastAcceleration(const glm::vec3 lastAcceleration) { _lastAcceleration = lastAcceleration; }
|
||||||
|
@ -64,8 +62,9 @@ public:
|
||||||
void init(QGLWidget *parent = 0);
|
void init(QGLWidget *parent = 0);
|
||||||
bool mousePressEvent(int x, int y);
|
bool mousePressEvent(int x, int y);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void start();
|
void start();
|
||||||
|
void addReceivedAudioToBuffer(const QByteArray& audioByteArray);
|
||||||
void handleAudioInput();
|
void handleAudioInput();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue