class Audio::AudioConfig

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.

Members

operator SPXAUDIOCONFIGHANDLE

Syntax: public inline explicit operator SPXAUDIOCONFIGHANDLE ( ) const;

Internal operator used to get underlying handle value.

Returns

A handle.

SetProperty

Syntax: public inline void SetProperty ( const std::string & name , const std::string & value );

Sets a property value by name.

Parameters

  • name The property name.

  • value The property value.

SetProperty

Syntax: public inline void SetProperty ( PropertyId id , const std::string & value );

Sets a property value by ID.

Parameters

  • id The property id.

  • value The property value.

GetProperty

Syntax: public inline std::string GetProperty ( const std::string & name ) const;

Gets a property value by name.

Parameters

  • name The parameter name.

Returns

The property value.

GetProperty

Syntax: public inline std::string GetProperty ( PropertyId id ) const;

Gets a property value by ID.

Parameters

  • id The parameter id.

Returns

The property value.

GetAudioProcessingOptions

Syntax: public inline std::shared_ptr< AudioProcessingOptions > GetAudioProcessingOptions ( ) const;

Gets an instance of AudioProcessingOptions class which contains the parameters for audio processing used by Speech SDK.

Returns

A shared pointer to the AudioProcessingOptions object.

~AudioConfig

Syntax: public inline virtual ~AudioConfig ( );

Destructs the object.

FromDefaultMicrophoneInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromDefaultMicrophoneInput ( );

Creates an AudioConfig object representing the default microphone on the system.

Returns

A shared pointer to the AudioConfig object

FromDefaultMicrophoneInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromDefaultMicrophoneInput ( std::shared_ptr< AudioProcessingOptions > audioProcessingOptions );

Creates an AudioConfig object representing the default microphone on the system.

Parameters

  • audioProcessingOptions Audio processing options.

Returns

A shared pointer to the AudioConfig object

FromMicrophoneInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromMicrophoneInput ( const std::string & deviceName );

Creates an AudioConfig object representing a specific microphone on the system. Added in version 1.3.0.

Parameters

  • deviceName Specifies the device name. Please refer to this page on how to retrieve platform-specific microphone names.

Returns

A shared pointer to the AudioConfig object

FromMicrophoneInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromMicrophoneInput ( const std::string & deviceName , std::shared_ptr< AudioProcessingOptions > audioProcessingOptions );

Creates an AudioConfig object representing a specific microphone on the system.

Parameters

  • deviceName Specifies the device name. Please refer to this page on how to retrieve platform-specific microphone names.

  • audioProcessingOptions Audio processing options.

Returns

A shared pointer to the AudioConfig object

FromWavFileInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromWavFileInput ( const std::string & fileName );

Creates an AudioConfig object representing the specified file.

Parameters

  • fileName Specifies the audio input file.

Returns

A shared pointer to the AudioConfig object

FromWavFileInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromWavFileInput ( const std::string & fileName , std::shared_ptr< AudioProcessingOptions > audioProcessingOptions );

Creates an AudioConfig object representing the specified file.

Parameters

  • fileName Specifies the audio input file.

  • audioProcessingOptions Audio processing options.

Returns

A shared pointer to the AudioConfig object

FromStreamInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromStreamInput ( std::shared_ptr< AudioInputStream > stream );

Creates an AudioConfig object representing the specified stream.

Parameters

  • stream Specifies the custom audio input stream.

Returns

A shared pointer to the AudioConfig object

FromStreamInput

Syntax: public inline static std::shared_ptr< AudioConfig > FromStreamInput ( std::shared_ptr< AudioInputStream > stream , std::shared_ptr< AudioProcessingOptions > audioProcessingOptions );

Creates an AudioConfig object representing the specified stream.

Parameters

  • stream Specifies the custom audio input stream.

  • audioProcessingOptions Audio processing options.

Returns

A shared pointer to the AudioConfig object

FromDefaultSpeakerOutput

Syntax: public inline static std::shared_ptr< AudioConfig > FromDefaultSpeakerOutput ( );

Creates an AudioConfig object representing the default audio output device (speaker) on the system. Added in version 1.4.0.

Returns

A shared pointer to the AudioConfig object

FromSpeakerOutput

Syntax: public inline static std::shared_ptr< AudioConfig > FromSpeakerOutput ( const std::string & deviceName );

Creates an AudioConfig object representing a specific speaker on the system. Added in version 1.14.0.

Parameters

  • deviceName Specifies the device name. Please refer to this page on how to retrieve platform-specific audio device names.

Returns

A shared pointer to the AudioConfig object

FromWavFileOutput

Syntax: public inline static std::shared_ptr< AudioConfig > FromWavFileOutput ( const std::string & fileName );

Creates an AudioConfig object representing the specified file for audio output. Added in version 1.4.0.

Parameters

  • fileName Specifies the audio output file. The parent directory must already exist.

Returns

A shared pointer to the AudioConfig object

FromStreamOutput

Syntax: public inline static std::shared_ptr< AudioConfig > FromStreamOutput ( std::shared_ptr< AudioOutputStream > stream );

Creates an AudioConfig object representing the specified output stream. Added in version 1.4.0.

Parameters

  • stream Specifies the custom audio output stream.

Returns

A shared pointer to the AudioConfig object