mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 08:53:28 +02:00
Merge pull request #14604 from zfox23/MS20089_interruptRecording
Implement MS20089: ACs playing avatar recordings now correctly handle playAvatarSound
This commit is contained in:
commit
1977180ecf
2 changed files with 13 additions and 0 deletions
|
@ -428,6 +428,10 @@ void Agent::executeScript() {
|
|||
using namespace recording;
|
||||
static const FrameType AUDIO_FRAME_TYPE = Frame::registerFrameType(AudioConstants::getAudioFrameName());
|
||||
Frame::registerFrameHandler(AUDIO_FRAME_TYPE, [this, &scriptedAvatar](Frame::ConstPointer frame) {
|
||||
if (_shouldMuteRecordingAudio) {
|
||||
return;
|
||||
}
|
||||
|
||||
static quint16 audioSequenceNumber{ 0 };
|
||||
|
||||
QByteArray audio(frame->data);
|
||||
|
@ -756,6 +760,10 @@ void Agent::processAgentAvatarAudio() {
|
|||
const int16_t* nextSoundOutput = NULL;
|
||||
|
||||
if (_avatarSound && _avatarSound->isReady()) {
|
||||
if (isPlayingRecording && !_shouldMuteRecordingAudio) {
|
||||
_shouldMuteRecordingAudio = true;
|
||||
}
|
||||
|
||||
auto audioData = _avatarSound->getAudioData();
|
||||
nextSoundOutput = reinterpret_cast<const int16_t*>(audioData->rawData()
|
||||
+ _numAvatarSoundSentBytes);
|
||||
|
@ -781,6 +789,10 @@ void Agent::processAgentAvatarAudio() {
|
|||
_avatarSound.clear();
|
||||
_numAvatarSoundSentBytes = 0;
|
||||
_flushEncoder = true;
|
||||
|
||||
if (_shouldMuteRecordingAudio) {
|
||||
_shouldMuteRecordingAudio = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ private:
|
|||
ResourceRequest* _pendingScriptRequest { nullptr };
|
||||
bool _isListeningToAudioStream = false;
|
||||
SharedSoundPointer _avatarSound;
|
||||
bool _shouldMuteRecordingAudio { false };
|
||||
int _numAvatarSoundSentBytes = 0;
|
||||
bool _isAvatar = false;
|
||||
QTimer* _avatarIdentityTimer = nullptr;
|
||||
|
|
Loading…
Reference in a new issue