- make AC recording audio play with right encoding

- spelling fix
This commit is contained in:
Thijs Wenker 2017-01-27 01:19:11 +01:00
parent b053fb55aa
commit cdc0f3ddd2
2 changed files with 16 additions and 7 deletions

View file

@ -266,6 +266,9 @@ void Agent::handleSelectedAudioFormat(QSharedPointer<ReceivedMessage> message) {
} }
void Agent::selectAudioFormat(const QString& selectedCodecName) { void Agent::selectAudioFormat(const QString& selectedCodecName) {
if (_selectedCodecName == selectedCodecName) {
return;
}
_selectedCodecName = selectedCodecName; _selectedCodecName = selectedCodecName;
qDebug() << "Selected Codec:" << _selectedCodecName; qDebug() << "Selected Codec:" << _selectedCodecName;
@ -351,9 +354,15 @@ void Agent::executeScript() {
Transform audioTransform; Transform audioTransform;
audioTransform.setTranslation(scriptedAvatar->getPosition()); audioTransform.setTranslation(scriptedAvatar->getPosition());
audioTransform.setRotation(scriptedAvatar->getOrientation()); audioTransform.setRotation(scriptedAvatar->getOrientation());
AbstractAudioInterface::emitAudioPacket(audio.data(), audio.size(), audioSequenceNumber, QByteArray encodedBuffer;
if (_encoder) {
_encoder->encode(audio, encodedBuffer);
} else {
encodedBuffer = audio;
}
AbstractAudioInterface::emitAudioPacket(encodedBuffer.data(), encodedBuffer.size(), audioSequenceNumber,
audioTransform, scriptedAvatar->getPosition(), glm::vec3(0), audioTransform, scriptedAvatar->getPosition(), glm::vec3(0),
PacketType::MicrophoneAudioNoEcho); PacketType::MicrophoneAudioNoEcho, _selectedCodecName);
}); });
auto avatarHashMap = DependencyManager::set<AvatarHashMap>(); auto avatarHashMap = DependencyManager::set<AvatarHashMap>();

View file

@ -1434,7 +1434,7 @@ static const QString JSON_AVATAR_HEAD_MODEL = QStringLiteral("headModel");
static const QString JSON_AVATAR_BODY_MODEL = QStringLiteral("bodyModel"); static const QString JSON_AVATAR_BODY_MODEL = QStringLiteral("bodyModel");
static const QString JSON_AVATAR_DISPLAY_NAME = QStringLiteral("displayName"); static const QString JSON_AVATAR_DISPLAY_NAME = QStringLiteral("displayName");
// It isn't meaningful to persist sessionDisplayName. // It isn't meaningful to persist sessionDisplayName.
static const QString JSON_AVATAR_ATTACHEMENTS = QStringLiteral("attachments"); static const QString JSON_AVATAR_ATTACHMENTS = QStringLiteral("attachments");
static const QString JSON_AVATAR_ENTITIES = QStringLiteral("attachedEntities"); static const QString JSON_AVATAR_ENTITIES = QStringLiteral("attachedEntities");
static const QString JSON_AVATAR_SCALE = QStringLiteral("scale"); static const QString JSON_AVATAR_SCALE = QStringLiteral("scale");
static const QString JSON_AVATAR_VERSION = QStringLiteral("version"); static const QString JSON_AVATAR_VERSION = QStringLiteral("version");
@ -1477,7 +1477,7 @@ QJsonObject AvatarData::toJson() const {
for (auto attachment : getAttachmentData()) { for (auto attachment : getAttachmentData()) {
attachmentsJson.push_back(attachment.toJson()); attachmentsJson.push_back(attachment.toJson());
} }
root[JSON_AVATAR_ATTACHEMENTS] = attachmentsJson; root[JSON_AVATAR_ATTACHMENTS] = attachmentsJson;
} }
_avatarEntitiesLock.withReadLock([&] { _avatarEntitiesLock.withReadLock([&] {
@ -1590,8 +1590,8 @@ void AvatarData::fromJson(const QJsonObject& json) {
setTargetScale((float)json[JSON_AVATAR_SCALE].toDouble()); setTargetScale((float)json[JSON_AVATAR_SCALE].toDouble());
} }
if (json.contains(JSON_AVATAR_ATTACHEMENTS) && json[JSON_AVATAR_ATTACHEMENTS].isArray()) { if (json.contains(JSON_AVATAR_ATTACHMENTS) && json[JSON_AVATAR_ATTACHMENTS].isArray()) {
QJsonArray attachmentsJson = json[JSON_AVATAR_ATTACHEMENTS].toArray(); QJsonArray attachmentsJson = json[JSON_AVATAR_ATTACHMENTS].toArray();
QVector<AttachmentData> attachments; QVector<AttachmentData> attachments;
for (auto attachmentJson : attachmentsJson) { for (auto attachmentJson : attachmentsJson) {
AttachmentData attachment; AttachmentData attachment;
@ -1602,7 +1602,7 @@ void AvatarData::fromJson(const QJsonObject& json) {
} }
// if (json.contains(JSON_AVATAR_ENTITIES) && json[JSON_AVATAR_ENTITIES].isArray()) { // if (json.contains(JSON_AVATAR_ENTITIES) && json[JSON_AVATAR_ENTITIES].isArray()) {
// QJsonArray attachmentsJson = json[JSON_AVATAR_ATTACHEMENTS].toArray(); // QJsonArray attachmentsJson = json[JSON_AVATAR_ATTACHMENTS].toArray();
// for (auto attachmentJson : attachmentsJson) { // for (auto attachmentJson : attachmentsJson) {
// // TODO -- something // // TODO -- something
// } // }