Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 10 files). Show all
Unified · Split
| @@ -490,14 +490,6 @@ void ScriptEngine::run() { · 489 unmodified lines | |||
| 490 | // pack a placeholder value for sequence number for now, will be packed when destination node is known | 490 | // pack a placeholder value for sequence number for now, will be packed when destination node is known |
| 491 | int numPreSequenceNumberBytes = audioPacket.size(); | 491 | int numPreSequenceNumberBytes = audioPacket.size(); |
| 492 | packetStream << (quint16) 0; | 492 | packetStream << (quint16) 0; |
| 493 | |||
| 494 | // assume scripted avatar audio is mono and set channel flag to zero | ||
| 495 | packetStream << (quint8) 0; | ||
| 496 | |||
| 497 | // use the orientation and position of this avatar for the source of this audio | ||
| 498 | packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3)); | ||
| 499 | glm::quat headOrientation = _avatarData->getHeadOrientation(); | ||
| 500 | packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat)); | ||
| 501 | 493 | ||
| 502 | if (silentFrame) { | 494 | if (silentFrame) { |
| 503 | if (!_isListeningToAudioStream) { | 495 | if (!_isListeningToAudioStream) { |
| @@ -507,12 +499,20 @@ void ScriptEngine::run() { · 3 unmodified lines | |||
| 507 | 499 | ||
| 508 | // write the number of silent samples so the audio-mixer can uphold timing | 500 | // write the number of silent samples so the audio-mixer can uphold timing |
| 509 | packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t)); | 501 | packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t)); |
| 502 | |||
| 510 | } else if (nextSoundOutput) { | 503 | } else if (nextSoundOutput) { |
| 504 | // assume scripted avatar audio is mono and set channel flag to zero | ||
| 505 | packetStream << (quint8)0; | ||
| 506 | |||
| 507 | // use the orientation and position of this avatar for the source of this audio | ||
| 508 | packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3)); | ||
| 509 | glm::quat headOrientation = _avatarData->getHeadOrientation(); | ||
| 510 | packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat)); | ||
| 511 | |||
| 511 | // write the raw audio data | 512 | // write the raw audio data |
| 512 | packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), | 513 | packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), numAvailableSamples * sizeof(int16_t)); |
| 513 | numAvailableSamples * sizeof(int16_t)); | ||
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | // write audio packet to AudioMixer nodes | 516 | // write audio packet to AudioMixer nodes |
| 517 | NodeList* nodeList = NodeList::getInstance(); | 517 | NodeList* nodeList = NodeList::getInstance(); |
| 518 | foreach(const SharedNodePointer& node, nodeList->getNodeHash()) { | 518 | foreach(const SharedNodePointer& node, nodeList->getNodeHash()) { |