SpeechSynthesizingDelegate

public protocol SpeechSynthesizingDelegate : AnyObject, UnimplementedLogging

The SpeechSynthesizingDelegate protocol defines methods that allow an object to respond to significant events related to spoken instructions.

  • Called when the speech synthesizer encountered an error during processing, but may still be able to speak the instruction.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func speechSynthesizer(_ speechSynthesizer: SpeechSynthesizing, encounteredError error: SpeechError)

    Parameters

    speechSynthesizer

    The voice controller that experienced the failure.

    error

    An error explaining the failure and its cause.

  • speechSynthesizer(_:didSpeak:with:) Default implementation

    Called when the speech synthesizer finished pronouncing the instruction or encountered an error, from which it cannot recover.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func speechSynthesizer(_ speechSynthesizer: SpeechSynthesizing, didSpeak instruction: SpokenInstruction, with error: SpeechError?)

    Parameters

    speechSynthesizer

    The speech synthesizer performing the action.

    instruction

    The spoken instruction pronounced or attempted to pronounce

    error

    An error explaining the failure and its cause if any

  • Called 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 speechSynthesizer(_ speechSynthesizer: SpeechSynthesizing, didInterrupt interruptedInstruction: SpokenInstruction, with interruptingInstruction: SpokenInstruction)

    Parameters

    speechSynthesizer

    The speech synthesizer 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.

  • speechSynthesizer(_:willSpeak:) Default implementation

    Called when a spoken instruction is about to be vocalized. Useful if it is necessary to give a custom instruction instead. Note that changing the distanceAlongStep property on SpokenInstruction 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 speechSynthesizer(_ speechSynthesizer: SpeechSynthesizing, willSpeak instruction: SpokenInstruction) -> SpokenInstruction?

    Parameters

    speechSynthesizer

    The speech synthesizer that will speak an instruction.

    instruction

    The spoken instruction that will be said.