repairs to Audio class after merge with upstream master

This commit is contained in:
Stephen Birarda 2013-12-04 14:24:03 -08:00
parent 277aa9dd89
commit d722e0bf6a

View file

@ -172,7 +172,7 @@ void Audio::handleAudioInput() {
static char monoAudioDataPacket[MAX_PACKET_SIZE];
// 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();
Node* audioMixer = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
@ -187,7 +187,7 @@ void Audio::handleAudioInput() {
if (audioMixer) {
if (audioMixer->getActiveSocket()) {
Avatar* interfaceAvatar = Application::getInstance()->getAvatar();
MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
glm::vec3 headPosition = interfaceAvatar->getHeadJointPosition();
glm::quat headOrientation = interfaceAvatar->getHead().getOrientation();
@ -241,9 +241,9 @@ void Audio::handleAudioInput() {
// Add procedural effects to input samples
addProceduralSounds((int16_t*) currentPacketPtr, stereoOutputBuffer, BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
nodeList->getNodeSocket()->send(audioMixer->getActiveSocket(),
monoAudioDataPacket,
BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes);
nodeList->getNodeSocket().writeDatagram(monoAudioDataPacket, BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes,
audioMixer->getActiveSocket()->getAddress(),
audioMixer->getActiveSocket()->getPort());
} else {
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));
// 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);