mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
one more shot at kens way
This commit is contained in:
parent
0e600fc8fd
commit
dd85cd9558
1 changed files with 4 additions and 7 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <UUID.h>
|
||||
#include <shared/JSONHelpers.h>
|
||||
#include <ShapeInfo.h>
|
||||
#include <AudioHelpers.h>
|
||||
|
||||
#include "AvatarLogging.h"
|
||||
|
||||
|
@ -52,7 +53,7 @@ const QString AvatarData::FRAME_NAME = "com.highfidelity.recording.AvatarData";
|
|||
static const int TRANSLATION_COMPRESSION_RADIX = 12;
|
||||
static const int SENSOR_TO_WORLD_SCALE_RADIX = 10;
|
||||
static const int AUDIO_LOUDNESS_RADIX = 2;
|
||||
static const float AUDIO_LOUDNESS_SCALE = 4.0f;
|
||||
static const float AUDIO_LOUDNESS_SCALE = 1024.0f;
|
||||
//static const int MODEL_OFFSET_RADIX = 6;
|
||||
|
||||
#define ASSERT(COND) do { if (!(COND)) { abort(); } } while(0)
|
||||
|
@ -234,9 +235,6 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
|||
// TODO -
|
||||
// typical -- 1jd 0ft 0p 1af 1stw 0loud 1look 0s 0o 1d 1lp 1gp
|
||||
//
|
||||
// 4) AudioLoudness - 8bit encoding, clamp to 1000 and / 4.0f - 1 byte - 0.36 kpbs (when speaking)
|
||||
//
|
||||
//
|
||||
// 1) make the dimensions really be dimensions instead of corner - 12 bytes - 4.32 kbps (when moving)
|
||||
// 2) determine if local position really only matters for parent - 12 bytes - 4.32 kbps (when moving and/or not parented)
|
||||
// 3) SensorToWorld - should we only send this for avatars with attachments?? - 20 bytes - 7.20 kbps
|
||||
|
@ -338,8 +336,7 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
|
|||
|
||||
if (hasAudioLoudness) {
|
||||
auto data = reinterpret_cast<AvatarDataPacket::AudioLoudness*>(destinationBuffer);
|
||||
|
||||
data->audioLoudness = glm::min(_headData->getAudioLoudness(), MAX_AUDIO_LOUDNESS) / AUDIO_LOUDNESS_SCALE;
|
||||
data->audioLoudness = packFloatGainToByte(_headData->getAudioLoudness() * (1 / AUDIO_LOUDNESS_SCALE));
|
||||
destinationBuffer += sizeof(AvatarDataPacket::AudioLoudness);
|
||||
}
|
||||
|
||||
|
@ -755,7 +752,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
|||
PACKET_READ_CHECK(AudioLoudness, sizeof(AvatarDataPacket::AudioLoudness));
|
||||
auto data = reinterpret_cast<const AvatarDataPacket::AudioLoudness*>(sourceBuffer);
|
||||
float audioLoudness;
|
||||
audioLoudness = data->audioLoudness * AUDIO_LOUDNESS_SCALE;
|
||||
audioLoudness = unpackFloatGainFromByte(data->audioLoudness * AUDIO_LOUDNESS_SCALE);
|
||||
sourceBuffer += sizeof(AvatarDataPacket::AudioLoudness);
|
||||
|
||||
if (isNaN(audioLoudness)) {
|
||||
|
|
Loading…
Reference in a new issue