Hi !
I'm currently working on a an Iphone app for people suffering of visual impairment.
In order to get an input text, the app uses voice recognition.
The app runs pretty well with Voice-Over activated, but when the user launch the voice recognition, Voice-Over output switch to the ear speaker (and that's normal I guess).
What bothers me, is that when all the process is over, the output speaker doesn't switch back to main speaker even if I end all the processes.
For the Voice recognition I created an instance of
AVAudioEngine()
,
SFSpeechRecognizer()
,
SFSpeechAudioBufferRecognitionRequest()
and
SFSpeechRecognitionTask?
.
Then I tapped the request into the live input node and started the audioengine.
After the user finished to speak, I called
audioEngine.stop()
,
request.endAudio()
and
recognitionTask?.cancel()
to stop everything and go back to a "normal" use of the app.
Maybe I missed something when stoping everything, something about the live input node tapped :
audioEngine.inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { buffer, _ in self.request.append(buffer)}
But I tried to
removeTap(onBus: 0)
but nothing changed.
The output speaker comes back to normal only when I close the app or going to multitasking.
I hope you could help me figure it out !
Thanks
Robin