SoundContext

Objective-C


@interface SoundContext : NSObject

Swift

class SoundContext : NSObject

This class handles the sound.

  • The delegate for the navigation contex.

    Declaration

    Objective-C

    @property (nonatomic, weak) NSObject<SoundContextDelegate> *_Nullable delegate;

    Swift

    weak var delegate: (any SoundContextDelegate)? { get set }
  • Set use for text to speech.

    Declaration

    Objective-C

    - (void)setUseTtsWithCompletionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func setUseTts() async -> Bool

    Parameters

    handler

    The block to execute asynchronously with the result. @discussion AVSpeechSynthesisVoice current language will be used.

  • Set use for text to speech with custom language code.

    Declaration

    Objective-C

    - (void)setUseTtsWithLanguage:(nonnull NSString *)language
                completionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func setUseTtsWithLanguage(_ language: String) async -> Bool

    Parameters

    handler

    The block to execute asynchronously with the result.

    language

    The language code. A string that contains the BCP 47 language and locale code for the user’s current locale ( en-US ).

  • Set use for human voice for identifier from local list.

    Declaration

    Objective-C

    - (void)setUseHumanVoiceWithIdentifier:(NSInteger)identifier
                         completionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func setUseHumanVoiceWithIdentifier(_ identifier: Int) async -> Bool

    Parameters

    identifier

    The voice identifier.

    handler

    The block to execute asynchronously with the result.

  • Play the requested sound object.

    Declaration

    Objective-C

    - (void)playSound:(nonnull SoundObject *)object;

    Swift

    func playSound(_ object: SoundObject)

    Parameters

    object

    The sound object.

  • Play the requested text.

    Declaration

    Objective-C

    - (void)playText:(nonnull NSString *)text;

    Swift

    func playText(_ text: String)
  • Play file audio type.

    Declaration

    Objective-C

    - (void)playFileType:(FileAudioType)type;

    Swift

    func playFileType(_ type: FileAudioType)
  • Play the requested sound warning.

    Declaration

    Objective-C

    - (void)playWarningFile:(DriverAssistanceAudioFile)audioFile;

    Swift

    func playWarning(_ audioFile: DriverAssistanceAudioFile)
  • Play alert at maximum volume level. Everything else is interrupted.

    Declaration

    Objective-C

    - (void)playWarningAlert:(DriverAssistanceAudioFile)audioFile;

    Swift

    func playWarningAlert(_ audioFile: DriverAssistanceAudioFile)
  • Cancel playing the sound.

    Declaration

    Objective-C

    - (void)cancel;

    Swift

    func cancel()
  • Returns true if a play sound is active.

    Declaration

    Objective-C

    - (BOOL)isPlaying;

    Swift

    func isPlaying() -> Bool
  • Set the volume level.

    Declaration

    Objective-C

    - (void)setVolume:(int)volume;

    Swift

    func setVolume(_ volume: Int32)

    Parameters

    volume

    The volume level.

  • Returns the volume level.

    Declaration

    Objective-C

    - (int)getVolume;

    Swift

    func getVolume() -> Int32
  • Returns the tts voice name.

    Declaration

    Objective-C

    - (nonnull NSString *)getTtsVoiceName;

    Swift

    func getTtsVoiceName() -> String
  • Updates the audio session category.

    Declaration

    Objective-C

    - (void)updateSessionWithAudioCategory:(AudioCategory)audioCategory;

    Swift

    func updateSession(with audioCategory: AudioCategory)
  • Updates the audio session output.

    Declaration

    Objective-C

    - (void)updateSessionWithAudioOutput:(AudioOutput)audioOutput;

    Swift

    func updateSession(with audioOutput: AudioOutput)
  • Set the call delay for audio session output: AudioOutputBluetoothAsPhoneCall. @details Default value is 0 milliseconds.

    Declaration

    Objective-C

    - (void)setDelay:(int)value;

    Swift

    func setDelay(_ value: Int32)
  • Get the call delay for audio session output: AudioOutputBluetoothAsPhoneCall.

    Declaration

    Objective-C

    - (int)getDelay;

    Swift

    func getDelay() -> Int32
  • Returns the sound session interruption state.

    Declaration

    Objective-C

    - (BOOL)isSessionInterrupted;

    Swift

    func isSessionInterrupted() -> Bool