class Audio::PushAudioInputStream

class Audio::PushAudioInputStream
  : public Audio::AudioInputStream

Represents memory backed push audio input stream used for custom audio input configurations.

Members

~PushAudioInputStream

Syntax: public inline virtual ~PushAudioInputStream ( );

Destructor; closes the underlying stream if not already closed.

Write

Syntax: public inline void Write ( uint8_t * dataBuffer , uint32_t size );

Writes the audio data specified by making an internal copy of the data. Note: The dataBuffer should not contain any audio header.

Parameters

  • dataBuffer The pointer to the audio buffer of which this function will make a copy.

  • size The size of the buffer.

SetProperty

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

Set value of a property. The properties of the audio data should be set before writing the audio data. Added in version 1.5.0.

Parameters

  • id The id of property. See PropertyId

  • value value to set

SetProperty

Syntax: public inline void SetProperty ( const SPXSTRING & propertyName , const SPXSTRING & value );

Set value of a property. The properties of the audio data should be set before writing the audio data. Added in version 1.5.0.

Parameters

  • propertyName The name of property.

  • value value to set

Close

Syntax: public inline void Close ( );

Closes the stream.

Commit

Syntax: public inline uint32_t Commit ( );

Requests that the audio written so far be committed as a completed segment. Non-blocking; returns immediately with a correlation token.

Returns

A commit token >= 1 that can be matched against the CommitToken property on a subsequent Recognized event, or 0 if the call was rejected outright e.g. based on the SDK-local rate limit (at most one successful Commit() per 100 ms per push stream).

A returned non-zero token does not guarantee a corresponding Recognized event; the commit may be silently dropped if the service does not support the feature, or if the session is torn down before the acknowledgment arrives. A commit that has not yet been delivered is also discarded when end of audio is signalled - by Close(), or by a Write() with an empty buffer - because the resulting flush already produces a result covering the audio the commit was anchored to.

Commit

Syntax: public inline uint32_t Commit ( uint32_t channelId );

Same as Commit() but scoped to a single channel of a multichannel input. The service acknowledges the commit on the named channel only. See Commit() for return-value semantics.

Parameters

  • channelId 0-indexed channel identifier.

Returns

A commit token >= 1, or 0 if the call was rejected by the SDK-local rate limit.

Create

Syntax: public inline static std::shared_ptr< PushAudioInputStream > Create ( );

Creates a memory backed PushAudioInputStream using the default format (16 kHz, 16 bit, mono PCM).

Returns

A shared pointer to PushAudioInputStream

Create

Syntax: public inline static std::shared_ptr< PushAudioInputStream > Create ( std::shared_ptr< AudioStreamFormat > format );

Creates a memory backed PushAudioInputStream with the specified audio format.

Parameters

  • format Audio stream format.

Returns

A shared pointer to PushAudioInputStream