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 }
  • Controls if this speech synthesizer is allowed to manage the shared AVAudioSession. Set this field to false if you want to manage the session yourself, for example if your app has background music. Default value is true.

    Declaration

    Swift

    var managesAudioSession: Bool { 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()