pub trait PullAudioInputStreamCallbacks: Send {
    fn read(&mut self, data_buffer: &mut [u8]) -> u32;
    fn close(&mut self);
    fn get_property(&mut self, id: i32) -> Result<String>;
}
Expand description

This trait that must be implemented by callback struct passed into pull audio input stream during initialization. Methods of this trait will be called by Speech Recognizer. When Speech recognizer is ready to process more data it will call read method.
Structs implementing PullAudioInputStreamCallbacks must also implement Send trait.
To see how to use see example: recognizer/continuous_recognition_pull_stream.

Required Methods

Reads (pulls) data from this audio stream instance data_buffer - data buffer to populate. It is prepolutated with zeros and its length represents maximum number of bytes to read and return. returns - number of actual bytes populated or 0 in case stream hits end and there is no more data. If there is no data available immediatelly read should block until next data becomes available.

Closes underlying resources of struct implementing this trait.

retrieves specific property related to read audio frame recognizer will be trying to retrieve following properties:
ConversationTranscribingService_DataBufferTimeStamp (11001)
ConversationTranscribingService_DataBufferUserId (11002)
For mor details see: PropertyId Enum definition.

Implementors