mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 11:53:28 +02:00
use packet version helpers for PACKET_TYPE_MICROPHONE
This commit is contained in:
parent
7d20455d83
commit
b816761a74
1 changed files with 5 additions and 3 deletions
|
@ -99,16 +99,18 @@ inline void Audio::performIO(int16_t* inputLeft, int16_t* outputLeft, int16_t* o
|
|||
glm::vec3 headPosition = interfaceAvatar->getHeadJointPosition();
|
||||
glm::quat headOrientation = interfaceAvatar->getHead().getOrientation();
|
||||
|
||||
int leadingBytes = sizeof(PACKET_TYPE_MICROPHONE_AUDIO_NO_ECHO) + sizeof(headPosition) + sizeof(headOrientation);
|
||||
int numBytesPacketHeader = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_MICROPHONE_AUDIO_NO_ECHO);
|
||||
int leadingBytes = numBytesPacketHeader + sizeof(headPosition) + sizeof(headOrientation);
|
||||
|
||||
// we need the amount of bytes in the buffer + 1 for type
|
||||
// + 12 for 3 floats for position + float for bearing + 1 attenuation byte
|
||||
unsigned char dataPacket[BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes];
|
||||
|
||||
dataPacket[0] = (Application::getInstance()->shouldEchoAudio())
|
||||
PACKET_TYPE packetType = (Application::getInstance()->shouldEchoAudio())
|
||||
? PACKET_TYPE_MICROPHONE_AUDIO_WITH_ECHO
|
||||
: PACKET_TYPE_MICROPHONE_AUDIO_NO_ECHO;
|
||||
unsigned char *currentPacketPtr = dataPacket + 1;
|
||||
|
||||
unsigned char *currentPacketPtr = dataPacket + populateTypeAndVersion(dataPacket, packetType);
|
||||
|
||||
// memcpy the three float positions
|
||||
memcpy(currentPacketPtr, &headPosition, sizeof(headPosition));
|
||||
|
|
Loading…
Reference in a new issue