diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index bd368ef7c2..cd2723e896 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -756,6 +756,11 @@ void Agent::processAgentAvatarAudio() { const int16_t* nextSoundOutput = NULL; if (_avatarSound) { + if (isPlayingRecording) { + recordingInterface->stopPlaying(); + _recordingInterrupted = true; + } + auto audioData = _avatarSound->getAudioData(); nextSoundOutput = reinterpret_cast(audioData->rawData() + _numAvatarSoundSentBytes); @@ -781,6 +786,11 @@ void Agent::processAgentAvatarAudio() { _avatarSound.clear(); _numAvatarSoundSentBytes = 0; _flushEncoder = true; + + if (_recordingInterrupted) { + _recordingInterrupted = false; + recordingInterface->startPlaying(); + } } } diff --git a/assignment-client/src/Agent.h b/assignment-client/src/Agent.h index 7d47c8e713..19e9a06336 100644 --- a/assignment-client/src/Agent.h +++ b/assignment-client/src/Agent.h @@ -122,6 +122,8 @@ private: Encoder* _encoder { nullptr }; QTimer _avatarAudioTimer; bool _flushEncoder { false }; + + bool _recordingInterrupted { false }; }; #endif // hifi_Agent_h