Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
iOS Documentation
SDLPerformAudioPassThru

SDLPerformAudioPassThru Class Reference

Section Contents

Overview

This will open an audio pass thru session. By doing so the app can receive audio data through the vehicle microphone

Function Group: AudioPassThru

HMILevel needs to be FULL, LIMITED or BACKGROUND

Since SmartDeviceLink 2.0

See SDLEndAudioPassThru

-initWithSamplingRate:bitsPerSample:audioType:maxDuration:

Convenience init to perform an audio pass thru

Objective-C

- (nonnull instancetype)
    initWithSamplingRate:(nonnull SDLSamplingRate)samplingRate
           bitsPerSample:(nonnull SDLBitsPerSample)bitsPerSample
               audioType:(nonnull SDLAudioType)audioType
             maxDuration:(UInt32)maxDuration;

Swift

init(samplingRate: SDLSamplingRate, bitsPerSample: SDLBitsPerSample, audioType: SDLAudioType, maxDuration: UInt32)

Parameters

samplingRate

A samplingRate

bitsPerSample

The quality the audio is recorded - 8 bit or 16 bit

audioType

An audioType

maxDuration

The maximum duration of audio recording in milliseconds

-initWithInitialPrompt:audioPassThruDisplayText1:audioPassThruDisplayText2:samplingRate:bitsPerSample:audioType:maxDuration:muteAudio:

Convenience init to perform an audio pass thru

Objective-C

- (nonnull instancetype)
        initWithInitialPrompt:(nullable NSString *)initialPrompt
    audioPassThruDisplayText1:(nullable NSString *)audioPassThruDisplayText1
    audioPassThruDisplayText2:(nullable NSString *)audioPassThruDisplayText2
                 samplingRate:(nonnull SDLSamplingRate)samplingRate
                bitsPerSample:(nonnull SDLBitsPerSample)bitsPerSample
                    audioType:(nonnull SDLAudioType)audioType
                  maxDuration:(UInt32)maxDuration
                    muteAudio:(BOOL)muteAudio;

Swift

init(initialPrompt: String?, audioPassThruDisplayText1: String?, audioPassThruDisplayText2: String?, samplingRate: SDLSamplingRate, bitsPerSample: SDLBitsPerSample, audioType: SDLAudioType, maxDuration: UInt32, muteAudio: Bool)

Parameters

initialPrompt

Initial prompt which will be spoken before opening the audio pass thru session by SDL

audioPassThruDisplayText1

A line of text displayed during audio capture

audioPassThruDisplayText2

A line of text displayed during audio capture

samplingRate

A samplingRate

bitsPerSample

The quality the audio is recorded - 8 bit or 16 bit

audioType

An audioType

maxDuration

The maximum duration of audio recording in milliseconds

muteAudio

A Boolean value representing if the current audio source should be muted during the APT session

-initWithSamplingRate:bitsPerSample:audioType:maxDuration:audioDataHandler:

Convenience init to perform an audio pass thru

Objective-C

- (nonnull instancetype)
    initWithSamplingRate:(nonnull SDLSamplingRate)samplingRate
           bitsPerSample:(nonnull SDLBitsPerSample)bitsPerSample
               audioType:(nonnull SDLAudioType)audioType
             maxDuration:(UInt32)maxDuration
        audioDataHandler:(nullable SDLAudioPassThruHandler)audioDataHandler;

Swift

init(samplingRate: SDLSamplingRate, bitsPerSample: SDLBitsPerSample, audioType: SDLAudioType, maxDuration: UInt32, audioDataHandler: SDLAudioPassThruHandler? = nil)

Parameters

samplingRate

A samplingRate

bitsPerSample

The quality the audio is recorded - 8 bit or 16 bit

audioType

An audioType

maxDuration

The maximum duration of audio recording in milliseconds

audioDataHandler

A handler that will be called whenever an onAudioPassThru notification is received.

-initWithInitialPrompt:audioPassThruDisplayText1:audioPassThruDisplayText2:samplingRate:bitsPerSample:audioType:maxDuration:muteAudio:audioDataHandler:

Objective-C

- (nonnull instancetype)
        initWithInitialPrompt:(nullable NSString *)initialPrompt
    audioPassThruDisplayText1:(nullable NSString *)audioPassThruDisplayText1
    audioPassThruDisplayText2:(nullable NSString *)audioPassThruDisplayText2
                 samplingRate:(nonnull SDLSamplingRate)samplingRate
                bitsPerSample:(nonnull SDLBitsPerSample)bitsPerSample
                    audioType:(nonnull SDLAudioType)audioType
                  maxDuration:(UInt32)maxDuration
                    muteAudio:(BOOL)muteAudio
             audioDataHandler:
                 (nullable SDLAudioPassThruHandler)audioDataHandler;

Swift

init(initialPrompt: String?, audioPassThruDisplayText1: String?, audioPassThruDisplayText2: String?, samplingRate: SDLSamplingRate, bitsPerSample: SDLBitsPerSample, audioType: SDLAudioType, maxDuration: UInt32, muteAudio: Bool, audioDataHandler: SDLAudioPassThruHandler? = nil)

Parameters

audioPassThruDisplayText1

A line of text displayed during audio capture

audioPassThruDisplayText2

A line of text displayed during audio capture

samplingRate

A samplingRate

bitsPerSample

The quality the audio is recorded - 8 bit or 16 bit

audioType

An audioType

maxDuration

The maximum duration of audio recording in milliseconds

muteAudio

A Boolean value representing if the current audio source should be muted during the APT session

audioDataHandler

A handler that will be called whenever an onAudioPassThru notification is received.

initialPrompt

initial prompt which will be spoken before opening the audio pass thru session by SDL @discussion initialPrompt a Vector value represents the initial prompt which will be spoken before opening the audio pass thru session by SDL

Notes:

  • This is an array of text chunks of type TTSChunk
  • The array must have at least one item
  • If omitted, then no initial prompt is spoken
  • Array Minsize: 1
  • Array Maxsize: 100

Objective-C

@property (nonatomic, strong, nullable) NSArray<SDLTTSChunk *> *initialPrompt;

Swift

var initialPrompt: [SDLTTSChunk]? { get set }

audioPassThruDisplayText1

a line of text displayed during audio capture @discussion audioPassThruDisplayText1 a String value representing the line of text displayed during audio capture

Notes: Maxlength=500

Objective-C

@property (nonatomic, strong, nullable) NSString *audioPassThruDisplayText1;

Swift

var audioPassThruDisplayText1: String? { get set }

audioPassThruDisplayText2

A line of text displayed during audio capture @discussion audioPassThruDisplayText2 a String value representing the line of text displayed during audio capture

Notes: Maxlength=500

Objective-C

@property (nonatomic, strong, nullable) NSString *audioPassThruDisplayText2;

Swift

var audioPassThruDisplayText2: String? { get set }

samplingRate

A samplingRate

@discussion a SamplingRate value representing a 8 or 16 or 22 or 24 khz

Objective-C

@property (nonatomic, strong) SDLSamplingRate _Nonnull samplingRate;

Swift

var samplingRate: SDLSamplingRate { get set }

maxDuration

the maximum duration of audio recording in milliseconds

@discussion maxDuration an Integer value representing the maximum duration of audio recording in millisecond

Notes: Minvalue:1; Maxvalue:1000000

Objective-C

@property (nonatomic, strong) NSNumber<SDLInt> *_Nonnull maxDuration;

Swift

var maxDuration: NSNumber & SDLInt { get set }

bitsPerSample

the quality the audio is recorded - 8 bit or 16 bit

@discussion a BitsPerSample value representing 8 bit or 16 bit

Objective-C

@property (nonatomic, strong) SDLBitsPerSample _Nonnull bitsPerSample;

Swift

var bitsPerSample: SDLBitsPerSample { get set }

audioType

an audioType

Objective-C

@property (nonatomic, strong) SDLAudioType _Nonnull audioType;

Swift

var audioType: SDLAudioType { get set }

muteAudio

a Boolean value representing if the current audio source should be muted during the APT session

Objective-C

@property (nonatomic, strong, nullable) NSNumber<SDLBool> *muteAudio;

Swift

var muteAudio: (NSNumber & SDLBool)? { get set }

audioDataHandler

A handler that will be called whenever an onAudioPassThru notification is received.

Objective-C

@property (nonatomic, strong, nullable) SDLAudioPassThruHandler audioDataHandler;

Swift

var audioDataHandler: SDLAudioPassThruHandler? { get set }
View on GitHub.com
Previous Section Next Section