mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 23:32:48 +02:00
repairs to Audio class after merge with upstream master
This commit is contained in:
parent
277aa9dd89
commit
d722e0bf6a
1 changed files with 6 additions and 31 deletions
|
@ -172,7 +172,7 @@ void Audio::handleAudioInput() {
|
||||||
static char monoAudioDataPacket[MAX_PACKET_SIZE];
|
static char monoAudioDataPacket[MAX_PACKET_SIZE];
|
||||||
|
|
||||||
// read out the current samples from the _inputDevice
|
// read out the current samples from the _inputDevice
|
||||||
_inputDevice->read((char*) stereoInputBuffer, BUFFER_LENGTH_BYTES_STEREO * SAMPLE_RATE_RATIO);
|
_inputDevice->read((char*) stereoInputBuffer, sizeof(stereoInputBuffer));
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
Node* audioMixer = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
Node* audioMixer = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
||||||
|
@ -187,7 +187,7 @@ void Audio::handleAudioInput() {
|
||||||
|
|
||||||
if (audioMixer) {
|
if (audioMixer) {
|
||||||
if (audioMixer->getActiveSocket()) {
|
if (audioMixer->getActiveSocket()) {
|
||||||
Avatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
||||||
|
|
||||||
glm::vec3 headPosition = interfaceAvatar->getHeadJointPosition();
|
glm::vec3 headPosition = interfaceAvatar->getHeadJointPosition();
|
||||||
glm::quat headOrientation = interfaceAvatar->getHead().getOrientation();
|
glm::quat headOrientation = interfaceAvatar->getHead().getOrientation();
|
||||||
|
@ -241,9 +241,9 @@ void Audio::handleAudioInput() {
|
||||||
// Add procedural effects to input samples
|
// Add procedural effects to input samples
|
||||||
addProceduralSounds((int16_t*) currentPacketPtr, stereoOutputBuffer, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
addProceduralSounds((int16_t*) currentPacketPtr, stereoOutputBuffer, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||||
|
|
||||||
nodeList->getNodeSocket()->send(audioMixer->getActiveSocket(),
|
nodeList->getNodeSocket().writeDatagram(monoAudioDataPacket, BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes,
|
||||||
monoAudioDataPacket,
|
audioMixer->getActiveSocket()->getAddress(),
|
||||||
BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
|
audioMixer->getActiveSocket()->getPort());
|
||||||
} else {
|
} else {
|
||||||
nodeList->pingPublicAndLocalSocketsForInactiveNode(audioMixer);
|
nodeList->pingPublicAndLocalSocketsForInactiveNode(audioMixer);
|
||||||
}
|
}
|
||||||
|
@ -288,34 +288,9 @@ void Audio::handleAudioInput() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventuallySendRecvPing(inputLeft, outputLeft, outputRight);
|
|
||||||
|
|
||||||
|
|
||||||
// add output (@speakers) data just written to the scope
|
|
||||||
_scope->addSamples(1, outputLeft, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
|
||||||
_scope->addSamples(2, outputRight, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
|
||||||
|
|
||||||
gettimeofday(&_lastCallbackTime, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// inputBuffer A pointer to an internal portaudio data buffer containing data read by portaudio.
|
|
||||||
// outputBuffer A pointer to an internal portaudio data buffer to be read by the configured output device.
|
|
||||||
// frames Number of frames that portaudio requests to be read/written.
|
|
||||||
// timeInfo Portaudio time info. Currently unused.
|
|
||||||
// statusFlags Portaudio status flags. Currently unused.
|
|
||||||
// userData Pointer to supplied user data (in this case, a pointer to the parent Audio object
|
|
||||||
int Audio::audioCallback (const void* inputBuffer,
|
|
||||||
void* outputBuffer,
|
|
||||||
unsigned long frames,
|
|
||||||
const PaStreamCallbackTimeInfo *timeInfo,
|
|
||||||
PaStreamCallbackFlags statusFlags,
|
|
||||||
void* userData) {
|
|
||||||
|
|
||||||
// copy the audio data to the output device
|
|
||||||
_outputDevice->write((char*) stereoOutputBuffer, sizeof(stereoOutputBuffer));
|
_outputDevice->write((char*) stereoOutputBuffer, sizeof(stereoOutputBuffer));
|
||||||
_outputDevice->write((char*) stereoOutputBuffer, sizeof(stereoOutputBuffer));
|
|
||||||
|
|
||||||
// add output (@speakers) data just written to the scope
|
// add output (@speakers) data just written to the scope
|
||||||
// _scope->addSamples(1, outputLeft, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
// _scope->addSamples(1, outputLeft, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||||
// _scope->addSamples(2, outputRight, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
// _scope->addSamples(2, outputRight, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||||
|
|
Loading…
Reference in a new issue