rtAudio.RtAudio

type
class

Static Methods

getCompiledApi() : Array<Api>

returns
Array of compiled Api.
A static function to determine the available compiled audio APIs.

Constructor

new(?api : Api)
parameters
?api The compiled Api to be used. If no API argument is specified and multiple API support has been compiled, the default order of use is JACK, ALSA, OSS (Linux systems) and ASIO, DS (Windows systems).
The class constructor.

Instance Variables

bufferFrames(default,null) : Int

The bufferFrames you provided when calling openStream() is stored here.

format(default,null) : RtAudioFormat

The format you provided when calling openStream() is stored here.

handle(default,null) : Dynamic

This is the handle to the real RtAudio object in ndll. Don't use it unless you know what it means.

inputBuffer(default,null) : Dynamic

Buffer for storing the input stream data, that used by streamCallback. You should cast it to Array or Array depending on the format you specified.

inputParameters(default,null) : Null<StreamParameters>

The inputParameters you provided when calling openStream() is stored here.

options(default,null) : Null<StreamOptions>

The options you provided when calling openStream() is stored here.

outputBuffer(default,null) : Dynamic

Buffer that needs to be filled by streamCallback when playing a output stream. You should cast it to Array or Array depending on the format you specified.

outputParameters(default,null) : Null<StreamParameters>

The outputParameters you provided when calling openStream() is stored here.

sampleRate(default,null) : Int

The sampleRate you provided when calling openStream() is stored here.

status(default,null) : Int

Status of the stream.

streamCallback(default,null) : RtAudioCallback

The streamCallback you provided when calling openStream() is stored here.

userData(default,null) : Dynamic

The userData you provided when calling openStream() is stored here.

Instance Methods

abortStream() : Void

Stop a stream, discarding any samples remaining in the input/output queue.

An RtError (type = SYSTEM_ERROR) is printed to console if an error occurs during processing. An RtError (type = INVALID_USE) is printed to console if a stream is not open. A warning is issued if the stream is already stopped.

closeStream() : Void

A function that closes a stream and frees any associated stream memory.

If a stream is not open, this function issues a warning and returns (no exception is thrown).

getCurrentApi() : Api

returns
The audio API specifier for the current instance of RtAudio.

getDefaultInputDevice() : Int

returns
The index of the default input device.
If the underlying audio API does not provide a "default device", or if no devices are available, the return value will be 0. Note that this is a valid device identifier and it is the client's responsibility to verify that a device is available before attempting to open a stream.

getDefaultOutputDevice() : Int

returns
The index of the default output device.
If the underlying audio API does not provide a "default device", or if no devices are available, the return value will be 0. Note that this is a valid device identifier and it is the client's responsibility to verify that a device is available before attempting to open a stream.

getDeviceCount() : Int

returns
The number of audio devices available.
A public function that queries for the number of audio devices available.

This function performs a system query of available devices each time it is called, thus supporting devices connected after instantiation. If a system error occurs during processing, a warning will be issued.

getDeviceInfo(device : Int) : DeviceInfo

parameters
device Any device integer between 0 and getDeviceCount() - 1.
returns
DeviceInfo for a specified device number.
Any device integer between 0 and getDeviceCount() - 1 is valid. If an invalid argument is provided, an RtError (type = INVALID_USE) will be printed to the console. If a device is busy or otherwise unavailable, the DeviceInfo member "probed" will have a value of "false" and all other members are null. If the specified device is the current default input or output device, the corresponding "isDefault" member will have a value of "true".

getStreamLatency() : Int

returns
The internal stream latency in sample frames.
The stream latency refers to delay in audio input and/or output caused by internal buffering by the audio system and/or hardware. For duplex streams, the returned value will represent the sum of the input and output latencies. If a stream is not open, an RtError (type = INVALID_USE) will be printed to console. If the API does not report latency, the return value will be zero.

getStreamSampleRate() : Int

returns
Actual sample rate in use by the stream.
On some systems, the sample rate used may be slightly different than that specified in the stream parameters. If a stream is not open, an RtError (type = INVALID_USE) will be printed to console.

getStreamTime() : Float

returns
The number of elapsed seconds since the stream was started.
If a stream is not open, an RtError (type = INVALID_USE) will be printed to console.

isStreamOpen() : Bool

returns
true if a stream is open and false if not.

isStreamRunning() : Bool

returns
true if the stream is running and false if it is stopped or not open.

openStream(outputParameters : Null<StreamParameters>, inputParameters : Null<StreamParameters>, format : RtAudioFormat, sampleRate : Int, bufferFrames : Int, streamCallback : RtAudioCallback, ?userData : Dynamic, ?options : StreamOptions) : Void

parameters
outputParameters Specifies output stream parameters to use when opening a stream, including a device ID, number of channels, and starting channel number. For input-only streams, this argument should be null. The device ID is an index value between 0 and getDeviceCount() - 1.
inputParameters Specifies input stream parameters to use when opening a stream, including a device ID, number of channels, and starting channel number. For output-only streams, this argument should be null. The device ID is an index value between 0 and getDeviceCount() - 1.
format An RtAudioFormat specifying the desired sample data format.
sampleRate The desired sample rate (sample frames per second).
bufferFrames Indicating the desired internal buffer size in sample frames. The actual value used by the device is assigned to the property of the same name. A value of zero can be specified, in which case the lowest allowable value is determined.
streamCallback A client-defined function that will be invoked when input data is available and/or output data is needed.
?userData An optional pointer to data that can be accessed from the property of the same name.
?options An optional pointer to a StreamOptions containing various global stream options, including a Array of RtAudioStreamFlags and a suggested number of stream buffers that can be used to control stream latency. More buffers typically result in more robust performance, though at a cost of greater latency. If a value of zero is specified, a system-specific median value is chosen. If the RTAUDIO_MINIMIZE_LATENCY flag bit is set, the lowest allowable value is used. The actual value used is assigned to the property of the same name. The parameter is API dependent.
A public function for opening a stream with the specified parameters.

An RtError (type = SYSTEM_ERROR) is printed to console if a stream cannot be opened with the specified parameters or an error occurs during processing. An RtError (type = INVALID_USE) is printed to console if any invalid device ID or channel number parameters are specified.

showWarnings(?value : Bool) : Void

parameters
value true if warning messages should be printed to stderr.
Specify whether warning messages should be printed to stderr.

startStream() : Void

A function that starts a stream.

An RtError (type = SYSTEM_ERROR) is printed to console if an error occurs during processing. An RtError (type = INVALID_USE) is printed to console if a stream is not open. A warning is issued if the stream is already running.

stopStream() : Void

Stop a stream, allowing any samples remaining in the output queue to be played.

An RtError (type = SYSTEM_ERROR) is printed to console if an error occurs during processing. An RtError (type = INVALID_USE) is printed to console if a stream is not open. A warning is issued if the stream is already stopped.