Partager via


Class SPXPullAudioInputStream

Declaration

@class SPXPullAudioInputStream : SPXAudioInputStream;

Description

Represents an audio input stream used for custom audio input configurations.

Methods

initWithReadHandler:closeHandler:

Initializes an SPXPullAudioInputStream that delegates to the specified callback interface for read() and close() methods, using the default format (16 kHz, 16 bit, mono PCM).

- (instancetype _Nullable)initWithReadHandler:(SPXPullAudioInputStreamReadHandler _Nonnull)readHandler
    closeHandler:(SPXPullAudioInputStreamCloseHandler _Nonnull)closeHandler

Parameters

  • readHandler - handler which will be called in order to read data from the audio input stream. If no data is currently available in the stream, the readHandler should wait until data is available. It returns the number of bytes that have been read. It returns 0 when the stream should be closed. The data returned by read() should not contain any audio header.
  • closeHandler - handler which will be called in order to close the audio input stream.

Returns

an instance of pull audio input stream.

initWithAudioFormat:readHandler:closeHandler:

Initializes an SPXPullAudioInputStream that delegates to the specified callback functions for read() and close() methods, with the specified audio format.

- (instancetype _Nullable)initWithAudioFormat:(SPXAudioStreamFormat * _Nonnull)format
    readHandler:(SPXPullAudioInputStreamReadHandler _Nonnull)readHandler
    closeHandler:(SPXPullAudioInputStreamCloseHandler _Nonnull)closeHandler

Parameters

  • format - The audio data format in which audio will be written to the push audio stream's write() method.
  • readHandler - handler which will be called in order to read data from the audio input stream. If no data is currently available in the stream, the readHandler should wait until data is available. It returns the number of bytes that have been read. It returns 0 when stream should be closed. The data returned by read() should not contain any audio header.
  • closeHandler - handler which will be called in order to close the audio input stream.

Returns

The audio input stream being created.

initWithReadHandler:getPropertyHandler:closeHandler:

Initializes an SPXPullAudioInputStream that delegates to the specified callback interface for read() and close() methods, using the default format (16 kHz, 16 bit, mono PCM).

- (instancetype _Nullable)initWithReadHandler:(SPXPullAudioInputStreamReadHandler _Nonnull)readHandler
    getPropertyHandler:(SPXPullAudioInputStreamGetPropertyHandler _Nonnull)getPropertyHandler
    closeHandler:(SPXPullAudioInputStreamCloseHandler _Nonnull)closeHandler

Parameters

  • readHandler - handler which will be called in order to read data from the audio input stream. If no data is currently available in the stream, the readHandler should wait until data is available. It returns the number of bytes that have been read. It returns 0 when the stream should be closed. The data returned by read() should not contain any audio header.
  • getPropertyHandler - handler which will be called in order to get string information associated to given SPXPropertyId.
  • closeHandler - handler which will be called in order to close the audio input stream.

Returns

an instance of pull audio input stream.

initWithAudioFormat:readHandler:getPropertyHandler:closeHandler:

Initializes an SPXPullAudioInputStream that delegates to the specified callback functions for read() and close() methods, with the specified audio format.

- (instancetype _Nullable)initWithAudioFormat:(SPXAudioStreamFormat * _Nonnull)format
    readHandler:(SPXPullAudioInputStreamReadHandler _Nonnull)readHandler
    getPropertyHandler:(SPXPullAudioInputStreamGetPropertyHandler _Nonnull)getPropertyHandler
    closeHandler:(SPXPullAudioInputStreamCloseHandler _Nonnull)closeHandler

Parameters

  • format - The audio data format in which audio will be written to the push audio stream's write() method.
  • readHandler - handler which will be called in order to read data from the audio input stream. If no data is currently available in the stream, the readHandler should wait until data is available. It returns the number of bytes that have been read. It returns 0 when stream should be closed. The data returned by read() should not contain any audio header.
  • getPropertyHandler - handler which will be called in order to get string information associated to given SPXPropertyId.
  • closeHandler - handler which will be called in order to close the audio input stream.

Returns

The audio input stream being created.