Class SPXAudioConfiguration
Declaration
@class SPXAudioConfiguration : NSObject;
Description
Represents audio input or output configuration. Audio input can be from a microphone, file, or input stream. Audio output can be to a speaker, audio file output in WAV format, or output stream.
Methods
init
Initializes an SPXAudioConfiguration object using the default microphone on the system.
- (instancetype _Nonnull)init
Returns
an instance of audio input configuration.
init:
Initializes an SPXAudioConfiguration object using the default microphone on the system and audio processing options.
- (instancetype _Nonnull)init:(SPXAudioProcessingOptions * _Nonnull)audioProcessingOptions
Parameters
audioProcessingOptions
- the audio processing options.
Returns
an instance of audio input configuration.
initWithMicrophone:
Initializes an SPXAudioConfiguration object using the specified audio input of the system.
Added in version 1.3.0.
- (instancetype _Nullable)initWithMicrophone:(NSString * _Nullable)deviceName
Parameters
deviceName
- the unique ID of the input device to be used. If this is nil, the default is used. Please refer to this page on how to retrieve platform-specific microphone names.
Returns
an instance of audio input configuration.
initWithMicrophone:audioProcessingOptions:
Initializes an SPXAudioConfiguration object using the specified audio input of the system and audio processing options.
- (instancetype _Nullable)initWithMicrophone:(NSString * _Nullable)deviceName
audioProcessingOptions:(SPXAudioProcessingOptions * _Nonnull)audioProcessingOptions
Parameters
deviceName
- the unique ID of the input device to be used. If this is nil, the default is used. Please refer to this page on how to retrieve platform-specific microphone names.audioProcessingOptions
- the audio processing options.
Returns
an instance of audio input configuration.
initWithWavFileInput:
Initializes an SPXAudioConfiguration object using the specified file as input.
- (instancetype _Nullable)initWithWavFileInput:(NSString * _Nonnull)path
Parameters
path
- path of the audio input file.
Returns
an instance of audio input configuration.
initWithWavFileInput:audioProcessingOptions:
Initializes an SPXAudioConfiguration object using the specified file as input and audio processing options.
- (instancetype _Nullable)initWithWavFileInput:(NSString * _Nonnull)path
audioProcessingOptions:(SPXAudioProcessingOptions * _Nonnull)audioProcessingOptions
Parameters
path
- path of the audio input file.audioProcessingOptions
- the audio processing options.
Returns
an instance of audio input configuration.
initWithDefaultSpeakerOutput
Initializes an SPXAudioConfiguration object using the default audio output device (speaker) on the system as output.
Added in version 1.7.0
- (instancetype _Nullable)initWithDefaultSpeakerOutput
Returns
an instance of audio input configuration.
initWithDefaultSpeakerOutput:
Initializes an SPXAudioConfiguration object using the default audio output device (speaker) on the system as output.
Added in version 1.7.0
- (instancetype _Nullable)initWithDefaultSpeakerOutput:(NSError * _Nullable * _Nullable)outError
Parameters
outError
- error information.
Returns
an instance of audio input configuration.
initWithSpeakerOutput:
Initializes an SPXAudioConfiguration object using a given audio output device (speaker) on the system as output.
Added in version 1.17.0
- (instancetype _Nullable)initWithSpeakerOutput:(NSString * _Nonnull)deviceName
Parameters
deviceName
- the unique ID of the input device to be used.
Returns
an instance of audio input configuration.
initWithSpeakerOutput:error:
Initializes an SPXAudioConfiguration object using a given audio output device (speaker) on the system as output.
Added in version 1.17.0
- (instancetype _Nullable)initWithSpeakerOutput:(NSString * _Nonnull)deviceName
error:(NSError * _Nullable * _Nullable)outError
Parameters
deviceName
- the unique ID of the input device to be used.outError
- error information.
Returns
an instance of audio input configuration.
initWithWavFileOutput:
Initializes an SPXAudioConfiguration object using the specified file as output.
Added in version 1.7.0
- (instancetype _Nullable)initWithWavFileOutput:(NSString * _Nonnull)path
Parameters
path
- path of the audio output file. The parent directory must already exist.
Returns
an instance of audio input configuration.
initWithWavFileOutput:error:
Initializes an SPXAudioConfiguration object using the specified file as output.
Added in version 1.7.0
- (instancetype _Nullable)initWithWavFileOutput:(NSString * _Nonnull)path
error:(NSError * _Nullable * _Nullable)outError
Parameters
path
- path of the audio output file. The parent directory must already exist.outError
- error information.
Returns
an instance of audio input configuration.
initWithStreamInput:
Initializes an SPXAudioConfiguration object using the specified stream as input.
- (instancetype _Nullable)initWithStreamInput:(SPXAudioInputStream * _Nonnull)stream
Parameters
stream
- the custom audio input stream.
Returns
an instance of audio input configuration.
initWithStreamInput:audioProcessingOptions:
Initializes an SPXAudioConfiguration object using the specified stream as input.
- (instancetype _Nullable)initWithStreamInput:(SPXAudioInputStream * _Nonnull)stream
audioProcessingOptions:(SPXAudioProcessingOptions * _Nonnull)audioProcessingOptions
Parameters
stream
- the custom audio input stream.audioProcessingOptions
- the audio processing options.
Returns
an instance of audio input configuration.
initWithStreamOutput:
Initializes an SPXAudioConfiguration object using the specified stream as output.
Added in version 1.7.0
- (instancetype _Nullable)initWithStreamOutput:(SPXAudioOutputStream * _Nonnull)stream
Parameters
stream
- the custom audio output stream.
Returns
an instance of audio output configuration.
initWithStreamOutput:error:
Initializes an SPXAudioConfiguration object using the specified stream as output.
Added in version 1.7.0
- (instancetype _Nullable)initWithStreamOutput:(SPXAudioOutputStream * _Nonnull)stream
error:(NSError * _Nullable * _Nullable)outError
Parameters
stream
- the custom audio output stream.outError
- error information.
Returns
an instance of audio output configuration.
getPropertyByName:
Returns the property value. If the name is not available, it returns an empty string.
- (NSString * _Nullable)getPropertyByName:(NSString * _Nonnull)name
Parameters
name
- property name.
Returns
value of the property.
setPropertyTo:byName:
Sets the property value by name.
- (void)setPropertyTo:(NSString * _Nonnull)value byName:(NSString * _Nonnull)name
Parameters
name
- property name.value
- value of the property.
Properties
audioProcessingOptions
@property (readonly, atomic) SPXAudioProcessingOptions * _Nullable audioProcessingOptions;
The audio processing options.