Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial

Public Attributes | List of all members
RtAudio::StreamOptions Struct Reference

The structure for specifying stream options. More...

#include <RtAudio.h>

Public Attributes

RtAudioStreamFlags flags {}
unsigned int numberOfBuffers {}
std::string streamName
int priority {}

Detailed Description

The structure for specifying stream options.

The following flags can be OR'ed together to allow a client to make changes to the default stream behavior:

By default, RtAudio streams pass and receive audio data from the client in an interleaved format. By passing the RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio data will instead be presented in non-interleaved buffers. In this case, each buffer argument in the RtAudioCallback function will point to a single array of data, with nFrames samples for each channel concatenated back-to-back. For example, the first sample of data for the second channel would be located at index nFrames (assuming the buffer pointer was recast to the correct data type for the stream).

Certain audio APIs offer a number of parameters that influence the I/O latency of a stream. By default, RtAudio will attempt to set these parameters internally for robust (glitch-free) performance (though some APIs, like Windows DirectSound, make this difficult). By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() function, internal stream settings will be influenced in an attempt to minimize stream latency, though possibly at the expense of stream performance.

If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs.

If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt to select realtime scheduling (round-robin) for the callback thread. The priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME flag is set. It defines the thread's realtime priority.

If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to open the "default" PCM device when using the ALSA API. Note that this will override any specified input or output device id.

The numberOfBuffers parameter can be used to control stream latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs only. A value of two is usually the smallest allowed. Larger numbers can potentially result in more robust stream performance, though likely at the cost of stream latency. The value set by the user is replaced during execution of the RtAudio::openStream() function by the value actually used by the system.

The streamName parameter can be used to set the client name when using the Jack API or the application name when using the Pulse API. By default, the Jack client name is set to RtApiJack. However, if you wish to create multiple instances of RtAudio with Jack, each instance must have a unique client name. The default Pulse application name is set to "RtAudio."

Member Data Documentation

◆ flags

RtAudioStreamFlags RtAudio::StreamOptions::flags {}


◆ numberOfBuffers

unsigned int RtAudio::StreamOptions::numberOfBuffers {}

Number of stream buffers.

◆ streamName

std::string RtAudio::StreamOptions::streamName

A stream name (currently used only in Jack).

◆ priority

int RtAudio::StreamOptions::priority {}

Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME).

The documentation for this struct was generated from the following file:

The Synthesis ToolKit in C++ (STK)
©1995--2023 Perry R. Cook and Gary P. Scavone. All Rights Reserved.