sample-googleassistant icon indicating copy to clipboard operation
sample-googleassistant copied to clipboard

assistant response shouldn't be allowed to play concurrently

Open proppy opened this issue 8 years ago • 2 comments

Currently if pressing the button while the assistant response is playing, a new request will be recorded and there is a possibility that the response audio will play on top of each other.

We should either interrupt the assistant response playback or queue them.

@Fleker what do you think?

proppy avatar Oct 25 '17 14:10 proppy

I think if we interrupt the Assistant mid-playback, it should remove audio from the previous response. That's the behavior Google Home and other devices use.

We could put each audio sample into a queue perhaps and then wipe it. Right now we call mAudioTrack.write. Is there a way to stop the audio track or clear its internal queue?

Fleker avatar Oct 25 '17 17:10 Fleker

Sound fesable https://developer.android.com/reference/android/media/AudioTrack.html#stop():

For an immediate stop, use pause(), followed by flush() to discard audio data that hasn't been played back yet.

proppy avatar Oct 25 '17 19:10 proppy