VoiceControllerDelegate
public protocol VoiceControllerDelegate : AnyObject, UnimplementedLogging
The VoiceControllerDelegate
protocol defines methods that allow an object to respond to significant events related to spoken instructions.
-
voiceController(_:didFallBackTo:error:)
Default implementationCalled when the voice controller falls back to a backup speech syntehsizer, but is still able to speak the instruction.
Default Implementation
UnimplementedLogging
prints a warning to standard output the first time this method is called.Declaration
Swift
func voiceController(_ voiceController: RouteVoiceController, didFallBackTo synthesizer: AVSpeechSynthesizer, error: SpeechError)
Parameters
voiceController
The voice controller that experienced the failure.
synthesizer
the Speech engine that was used as the fallback.
error
An error explaining the failure and its cause.
-
voiceController(_:spokenInstructionsDidFailWith:)
Default implementationCalled when the voice controller failed to speak an instruction.
Default Implementation
UnimplementedLogging
prints a warning to standard output the first time this method is called.Declaration
Swift
func voiceController(_ voiceController: RouteVoiceController, spokenInstructionsDidFailWith error: SpeechError)
Parameters
voiceController
The voice controller that experienced the failure.
error
An error explaining the failure and its cause.
-
voiceController(_:didInterrupt:with:)
Default implementationCalled when one spoken instruction interrupts another instruction currently being spoken.
Default Implementation
UnimplementedLogging
prints a warning to standard output the first time this method is called.Declaration
Swift
func voiceController(_ voiceController: RouteVoiceController, didInterrupt interruptedInstruction: SpokenInstruction, with interruptingInstruction: SpokenInstruction)
Parameters
voiceController
The voice controller that experienced the interruption.
interruptedInstruction
The spoken instruction currently in progress that has been interrupted.
interruptingInstruction
The spoken instruction that is interrupting the current instruction.
-
voiceController(_:willSpeak:routeProgress:)
Default implementationCalled when a spoken is about to speak. Useful if it is necessary to give a custom instruction instead. Noting, changing the
distanceAlongStep
property onSpokenInstruction
will have no impact on when the instruction will be said.Default Implementation
UnimplementedLogging
prints a warning to standard output the first time this method is called.Declaration
Swift
func voiceController(_ voiceController: RouteVoiceController, willSpeak instruction: SpokenInstruction, routeProgress: RouteProgress) -> SpokenInstruction?
Parameters
voiceController
The voice controller that will speak an instruction.
instruction
The spoken instruction that will be said.
routeProgress
The
RouteProgress
just before when the instruction is scheduled to be spoken.