Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 139 files). Show all
Unified · Split
| @@ -493,14 +493,6 @@ void ScriptEngine::run() { · 492 unmodified lines | |||
| 493 | // pack a placeholder value for sequence number for now, will be packed when destination node is known | 493 | // pack a placeholder value for sequence number for now, will be packed when destination node is known |
| 494 | int numPreSequenceNumberBytes = audioPacket.size(); | 494 | int numPreSequenceNumberBytes = audioPacket.size(); |
| 495 | packetStream << (quint16) 0; | 495 | 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)); | ||
| 504 | 496 | ||
| 505 | if (silentFrame) { | 497 | if (silentFrame) { |
| 506 | if (!_isListeningToAudioStream) { | 498 | if (!_isListeningToAudioStream) { |
| @@ -510,12 +502,20 @@ void ScriptEngine::run() { · 3 unmodified lines | |||
| 510 | 502 | ||
| 511 | // write the number of silent samples so the audio-mixer can uphold timing | 503 | // write the number of silent samples so the audio-mixer can uphold timing |
| 512 | packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t)); | 504 | packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t)); |
| 505 | |||
| 513 | } else if (nextSoundOutput) { | 506 | } 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 | |||
| 514 | // write the raw audio data | 515 | // write the raw audio data |
| 515 | packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), | 516 | packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), numAvailableSamples * sizeof(int16_t)); |
| 516 | numAvailableSamples * sizeof(int16_t)); | ||
| 517 | } | 517 | } |
| 518 | 518 | ||
| 519 | // write audio packet to AudioMixer nodes | 519 | // write audio packet to AudioMixer nodes |
| 520 | NodeList* nodeList = NodeList::getInstance(); | 520 | NodeList* nodeList = NodeList::getInstance(); |
| 521 | foreach(const SharedNodePointer& node, nodeList->getNodeHash()) { | 521 | foreach(const SharedNodePointer& node, nodeList->getNodeHash()) { |