SoundIoOutStream

The size of this struct is not part of the API or ABI.

Members

Variables

bytes_per_frame
int bytes_per_frame;

computed automatically when you call ::soundio_outstream_open

bytes_per_sample
int bytes_per_sample;

computed automatically when you call ::soundio_outstream_open

device
SoundIoDevice* device;

Populated automatically when you call ::soundio_outstream_create.

error_callback
void function(SoundIoOutStream*, int err) error_callback;

Optional callback. err is always SoundIoErrorStreaming. SoundIoErrorStreaming is an unrecoverable error. The stream is in an invalid state and must be destroyed. If you do not supply error_callback, the default callback will print a message to stderr and then call abort. This is called from the SoundIoOutStream::write_callback thread context.

format
SoundIoFormat format;

Defaults to #SoundIoFormatFloat32NE, followed by the first one supported.

layout
SoundIoChannelLayout layout;

Defaults to Stereo, if available, followed by the first layout supported.

layout_error
int layout_error;

If setting the channel layout fails for some reason, this field is set to an error code. Possible error codes are: * #SoundIoErrorIncompatibleDevice

name
const(char)* name;

Optional: Name of the stream. Defaults to "SoundIoOutStream" PulseAudio uses this for the stream name. JACK uses this for the client name of the client that connects when you open the stream. WASAPI uses this for the session display name. Must not contain a colon (":").

non_terminal_hint
bool non_terminal_hint;

Optional: Hint that this output stream is nonterminal. This is used by JACK and it means that the output stream data originates from an input stream. Defaults to false.

sample_rate
int sample_rate;

Sample rate is the number of frames per second. Defaults to 48000 (and then clamped into range).

software_latency
double software_latency;

Ignoring hardware latency, this is the number of seconds it takes for the last sample in a full buffer to be played. After you call ::soundio_outstream_open, this value is replaced with the actual software latency, as near to this value as possible. On systems that support clearing the buffer, this defaults to a large latency, potentially upwards of 2 seconds, with the understanding that you will call ::soundio_outstream_clear_buffer when you want to reduce the latency to 0. On systems that do not support clearing the buffer, this defaults to a reasonable lower latency value.

underflow_callback
void function(SoundIoOutStream*) underflow_callback;

This optional callback happens when the sound device runs out of buffered audio data to play. After this occurs, the outstream waits until the buffer is full to resume playback. This is called from the SoundIoOutStream::write_callback thread context.

userdata
void* userdata;

Defaults to NULL. Put whatever you want here.

volume
float volume;

Core Audio and WASAPI only: current output Audio Unit volume. Float, 0.0-1.0.

write_callback
void function(SoundIoOutStream*, int frame_count_min, int frame_count_max) write_callback;

In this callback, you call ::soundio_outstream_begin_write and ::soundio_outstream_end_write as many times as necessary to write at minimum frame_count_min frames and at maximum frame_count_max frames. frame_count_max will always be greater than 0. Note that you should write as many frames as you can; frame_count_min might be 0 and you can still get a buffer underflow if you always write frame_count_min frames.

Meta