Interface AudioSourceListener

ru.yandex.speechkit

public  interface  AudioSourceListener 

Interface of an audio source listener.

This interface should be implemented by a class that wants to get data from the audio source. To subscribe a listener to an audio source, use the subscribe(AudioSourceListener) method; to unsubscribe a listener, use the unsubscribe (AudioSourceListener) method.

Methods

voidonAudioSourceData(@NonNull final AudioSource audioSource, @NonNull final java.nio.ByteBuffer data)

Called during data transmission.

voidonAudioSourceError(@NonNull final AudioSource audioSource, @NonNull final Error error)

Called if errors occurred during the operation of the audio source.

voidonAudioSourceStarted(@NonNull final AudioSource audioSource)

Called when the audio source is ready to transmit data.

voidonAudioSourceStopped(@NonNull final AudioSource audioSource)

Called when the audio source finished transmitting data.

Method Detail

onAudioSourceData

public void onAudioSourceData (@NonNull final AudioSource audioSource, @NonNull final java.nio.ByteBuffer data)

Called during data transmission.

This method can be called multiple times, depending on the amount of data transmitted by the audio source, at intervals equal to getBufferCaptureTimeout ().
Parameters:
audioSource

Link to the object of the AudioSource class that invoked the method.

data

Data buffer.

Throws:

Exception

An exception is thrown if the data buffer was created without using the allocateDirect(int) method of the ByteBuffer system class.

onAudioSourceError

public void onAudioSourceError (@NonNull final AudioSource audioSource, @NonNull final Error error)

Called if errors occurred during the operation of the audio source.

Parameters:
audioSource

Link to the object of the AudioSource class that invoked the method.

error

An error that occurred while the audio source was running.

onAudioSourceStarted

public void onAudioSourceStarted (@NonNull final AudioSource audioSource)

Called when the audio source is ready to transmit data.

Parameters:
audioSource

Link to the object of the AudioSource class that invoked the method.

onAudioSourceStopped

public void onAudioSourceStopped (@NonNull final AudioSource audioSource)

Called when the audio source finished transmitting data.

Parameters:
audioSource

Link to the object of the AudioSource class that invoked the method.