SpeechSynthesizing

public protocol SpeechSynthesizing : AnyObject

Protocol for implementing speech synthesizer to be used in RouteVoiceController.

  • A delegate that will be notified about significant events related to spoken instructions.

    Declaration

    Swift

    var delegate: SpeechSynthesizingDelegate? { get set }
  • Controls muting playback of the synthesizer

    Declaration

    Swift

    var muted: Bool { get set }
  • Controls volume of the voice of the synthesizer. Should respect NavigationSettings.voiceVolume

    Declaration

    Swift

    var volume: Float { get set }
  • Returns true if synthesizer is speaking

    Declaration

    Swift

    var isSpeaking: Bool { get }
  • Locale setting to vocalization. This locale will be used as ‘default’ if no specific locale is passed for vocalizing each individual instruction.

    Declaration

    Swift

    var locale: Locale? { get set }
  • Used to notify speech synthesizer about future spoken instructions in order to give extra time for preparations.

    It is not guaranteed that all these instructions will be spoken. For example navigation may be re-routed. This method may be (and most likely will be) called multiple times along the route progress

    Declaration

    Swift

    func prepareIncomingSpokenInstructions(_ instructions: [SpokenInstruction], locale: Locale?)

    Parameters

    instructions

    An array of SpokenInstructions that will be encountered further.

    locale

    A locale to be used for preparing instructions. If nil is passed - SpeechSynthesizing.locale will be used as ‘default’.

  • A request to vocalize the instruction

    This method is not guaranteed to be synchronous or asynchronous. When vocalizing is finished, voiceController(_ voiceController: SpeechSynthesizing, didSpeak instruction: SpokenInstruction, with error: SpeechError?) should be called.

    Declaration

    Swift

    func speak(_ instruction: SpokenInstruction, during legProgress: RouteLegProgress, locale: Locale?)

    Parameters

    instruction

    an instruction to be vocalized

    legProgress

    current leg progress, corresponding to the instruction

    locale

    A locale to be used for vocalizing the instruction. If nil is passed - SpeechSynthesizing.locale will be used as ‘default’.

  • Tells synthesizer to stop current vocalization in a graceful manner

    Declaration

    Swift

    func stopSpeaking()
  • Tells synthesizer to stop current vocalization immediately

    Declaration

    Swift

    func interruptSpeaking()