History

Merge branch 'master' of https://github.com/highfidelity/hifi into virtualEntities

ZappoMan committed 12 years ago

Commit 2bcad6a2 parents de968ba 29ed1b3139 files · +9470 −2557Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 139 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+11−11
@@ -493,14 +493,6 @@ void ScriptEngine::run() { · 492 unmodified lines
493493 // pack a placeholder value for sequence number for now, will be packed when destination node is known
494494 int numPreSequenceNumberBytes = audioPacket.size();
495495 packetStream << (quint16) 0;
496−
497− // assume scripted avatar audio is mono and set channel flag to zero
498− packetStream << (quint8) 0;
499−
500− // use the orientation and position of this avatar for the source of this audio
501− packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3));
502− glm::quat headOrientation = _avatarData->getHeadOrientation();
503− packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat));
504496
505497 if (silentFrame) {
506498 if (!_isListeningToAudioStream) {
@@ -510,12 +502,20 @@ void ScriptEngine::run() { · 3 unmodified lines
510502
511503 // write the number of silent samples so the audio-mixer can uphold timing
512504 packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t));
505+
513506 } else if (nextSoundOutput) {
507+ // assume scripted avatar audio is mono and set channel flag to zero
508+ packetStream << (quint8)0;
509+
510+ // use the orientation and position of this avatar for the source of this audio
511+ packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3));
512+ glm::quat headOrientation = _avatarData->getHeadOrientation();
513+ packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat));
514+
514515 // write the raw audio data
515− packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput),
516− numAvailableSamples * sizeof(int16_t));
516+ packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), numAvailableSamples * sizeof(int16_t));
517517 }
518−
518+
519519 // write audio packet to AudioMixer nodes
520520 NodeList* nodeList = NodeList::getInstance();
521521 foreach(const SharedNodePointer& node, nodeList->getNodeHash()) {