1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4
5use ::std::os::raw::{c_char, c_int, c_long, c_uint, c_ulong, c_void};
6
7#[doc = " \\typedef typedef unsigned long rtaudio_format_t;\n\\brief RtAudio data format type.\n\n- \\e RTAUDIO_FORMAT_SINT8: 8-bit signed integer.\n- \\e RTAUDIO_FORMAT_SINT16: 16-bit signed integer.\n- \\e RTAUDIO_FORMAT_SINT24: 24-bit signed integer.\n- \\e RTAUDIO_FORMAT_SINT32: 32-bit signed integer.\n- \\e RTAUDIO_FORMAT_FLOAT32: Normalized between plus/minus 1.0.\n- \\e RTAUDIO_FORMAT_FLOAT64: Normalized between plus/minus 1.0.\n\nSee \\ref RtAudioFormat."]
8pub type rtaudio_format_t = c_ulong;
9pub const RTAUDIO_FORMAT_SINT8: rtaudio_format_t = 1;
10pub const RTAUDIO_FORMAT_SINT16: rtaudio_format_t = 2;
11pub const RTAUDIO_FORMAT_SINT24: rtaudio_format_t = 4;
12pub const RTAUDIO_FORMAT_SINT32: rtaudio_format_t = 8;
13pub const RTAUDIO_FORMAT_FLOAT32: rtaudio_format_t = 16;
14pub const RTAUDIO_FORMAT_FLOAT64: rtaudio_format_t = 32;
15
16#[doc = " \\typedef typedef unsigned long rtaudio_stream_flags_t;\n\\brief RtAudio stream option flags.\n\nThe following flags can be OR'ed together to allow a client to\nmake changes to the default stream behavior:\n\n- \\e RTAUDIO_FLAGS_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved).\n- \\e RTAUDIO_FLAGS_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.\n- \\e RTAUDIO_FLAGS_HOG_DEVICE: Attempt grab device for exclusive use.\n- \\e RTAUDIO_FLAGS_ALSA_USE_DEFAULT: Use the \"default\" PCM device (ALSA only).\n- \\e RTAUDIO_FLAGS_JACK_DONT_CONNECT: Do not automatically connect ports (JACK only).\n\nSee \\ref RtAudioStreamFlags."]
17pub type rtaudio_stream_flags_t = c_uint;
18pub const RTAUDIO_FLAGS_NONINTERLEAVED: rtaudio_stream_flags_t = 1;
19pub const RTAUDIO_FLAGS_MINIMIZE_LATENCY: rtaudio_stream_flags_t = 2;
20pub const RTAUDIO_FLAGS_HOG_DEVICE: rtaudio_stream_flags_t = 4;
21pub const RTAUDIO_FLAGS_SCHEDULE_REALTIME: rtaudio_stream_flags_t = 8;
22pub const RTAUDIO_FLAGS_ALSA_USE_DEFAULT: rtaudio_stream_flags_t = 16;
23pub const RTAUDIO_FLAGS_JACK_DONT_CONNECT: rtaudio_stream_flags_t = 32;
24
25#[doc = " \\typedef typedef unsigned long rtaudio_stream_status_t;\n\\brief RtAudio stream status (over- or underflow) flags.\n\nNotification of a stream over- or underflow is indicated by a\nnon-zero stream \\c status argument in the RtAudioCallback function.\nThe stream status can be one of the following two options,\ndepending on whether the stream is open for output and/or input:\n\n- \\e RTAUDIO_STATUS_INPUT_OVERFLOW: Input data was discarded because of an overflow condition at the driver.\n- \\e RTAUDIO_STATUS_OUTPUT_UNDERFLOW: The output buffer ran low, likely producing a break in the output sound.\n\nSee \\ref RtAudioStreamStatus."]
26pub type rtaudio_stream_status_t = c_uint;
27pub const RTAUDIO_STATUS_INPUT_OVERFLOW: rtaudio_stream_status_t = 1;
28pub const RTAUDIO_STATUS_OUTPUT_UNDERFLOW: rtaudio_stream_status_t = 2;
29
30pub const NUM_SAMPLE_RATES: usize = 16;
31pub const MAX_NAME_LENGTH: usize = 512;
32
33#[doc = "! RtAudio callback function prototype.\n*!\nAll RtAudio clients must create a function of this type to read\nand/or write data from/to the audio stream. When the underlying\naudio system is ready for new input or output data, this function\nwill be invoked.\n\nSee \\ref RtAudioCallback.\n*/"]
34pub type rtaudio_cb_t = ::std::option::Option<
35 unsafe extern "C" fn(
36 out: *mut c_void,
37 in_: *mut c_void,
38 nFrames: c_uint,
39 stream_time: f64,
40 status: rtaudio_stream_status_t,
41 userdata: *mut c_void,
42 ) -> c_int,
43>;
44
45#[doc = " \\brief Error codes for RtAudio.\n\nSee \\ref RtAudioError."]
46pub type rtaudio_error_t = c_int;
47#[doc = "< No error."]
48pub const RTAUDIO_ERROR_NONE: rtaudio_error_t = 0;
49#[doc = "< A non-critical error."]
50pub const RTAUDIO_ERROR_WARNING: rtaudio_error_t = 1;
51#[doc = "< An unspecified error type."]
52pub const RTAUDIO_ERROR_UNKNOWN: rtaudio_error_t = 2;
53#[doc = "< No devices found on system."]
54pub const RTAUDIO_ERROR_NO_DEVICES_FOUND: rtaudio_error_t = 3;
55#[doc = "< An invalid device ID was specified."]
56pub const RTAUDIO_ERROR_INVALID_DEVICE: rtaudio_error_t = 4;
57#[doc = "< A device in use was disconnected."]
58pub const RTAUDIO_ERROR_DEVICE_DISCONNECT: rtaudio_error_t = 5;
59#[doc = "< An error occurred during memory allocation."]
60pub const RTAUDIO_ERROR_MEMORY_ERROR: rtaudio_error_t = 6;
61#[doc = "< An invalid parameter was specified to a function."]
62pub const RTAUDIO_ERROR_INVALID_PARAMETER: rtaudio_error_t = 7;
63#[doc = "< The function was called incorrectly."]
64pub const RTAUDIO_ERROR_INVALID_USE: rtaudio_error_t = 8;
65#[doc = "< A system driver error occurred."]
66pub const RTAUDIO_ERROR_DRIVER_ERROR: rtaudio_error_t = 9;
67#[doc = "< A system error occurred."]
68pub const RTAUDIO_ERROR_SYSTEM_ERROR: rtaudio_error_t = 10;
69#[doc = "< A thread error occurred."]
70pub const RTAUDIO_ERROR_THREAD_ERROR: rtaudio_error_t = 11;
71
72#[doc = "! RtAudio error callback function prototype.\n*!\n\\param err Type of error.\n\\param msg Error description.\n\nSee \\ref RtAudioErrorCallback.\n*/"]
73pub type rtaudio_error_cb_t =
74 ::std::option::Option<unsafe extern "C" fn(err: rtaudio_error_t, msg: *const c_char)>;
75
76#[doc = "! Audio API specifier. See \\ref RtAudio::Api."]
77pub type rtaudio_api_t = c_int;
78#[doc = "< Search for a working compiled API."]
79pub const RTAUDIO_API_UNSPECIFIED: rtaudio_api_t = 0;
80#[doc = "< Macintosh OS-X Core Audio API."]
81pub const RTAUDIO_API_MACOSX_CORE: rtaudio_api_t = 1;
82#[doc = "< The Advanced Linux Sound Architecture API."]
83pub const RTAUDIO_API_LINUX_ALSA: rtaudio_api_t = 2;
84#[doc = "< The Jack Low-Latency Audio Server API."]
85pub const RTAUDIO_API_UNIX_JACK: rtaudio_api_t = 3;
86#[doc = "< The Linux PulseAudio API."]
87pub const RTAUDIO_API_LINUX_PULSE: rtaudio_api_t = 4;
88#[doc = "< The Linux Open Sound System API."]
89pub const RTAUDIO_API_LINUX_OSS: rtaudio_api_t = 5;
90#[doc = "< The Steinberg Audio Stream I/O API."]
91pub const RTAUDIO_API_WINDOWS_ASIO: rtaudio_api_t = 6;
92#[doc = "< The Microsoft WASAPI API."]
93pub const RTAUDIO_API_WINDOWS_WASAPI: rtaudio_api_t = 7;
94#[doc = "< The Microsoft DirectSound API."]
95pub const RTAUDIO_API_WINDOWS_DS: rtaudio_api_t = 8;
96#[doc = "< A compilable but non-functional API."]
97pub const RTAUDIO_API_DUMMY: rtaudio_api_t = 9;
98#[doc = "< Number of values in this enum."]
99pub const RTAUDIO_API_NUM: rtaudio_api_t = 10;
100
101#[doc = "! The public device information structure for returning queried values.\n! See \\ref RtAudio::DeviceInfo."]
102#[repr(C)]
103#[derive(Debug, Copy, Clone)]
104pub struct rtaudio_device_info {
105 pub id: c_uint,
106 pub output_channels: c_uint,
107 pub input_channels: c_uint,
108 pub duplex_channels: c_uint,
109 pub is_default_output: c_int,
110 pub is_default_input: c_int,
111 pub native_formats: rtaudio_format_t,
112 pub preferred_sample_rate: c_uint,
113 pub sample_rates: [c_uint; NUM_SAMPLE_RATES],
114 pub name: [c_char; MAX_NAME_LENGTH],
115}
116#[doc = "! The public device information structure for returning queried values.\n! See \\ref RtAudio::DeviceInfo."]
117pub type rtaudio_device_info_t = rtaudio_device_info;
118
119#[doc = "! The structure for specifying input or output stream parameters.\n! See \\ref RtAudio::StreamParameters."]
120#[repr(C)]
121#[derive(Debug, Copy, Clone)]
122pub struct rtaudio_stream_parameters {
123 pub device_id: c_uint,
124 pub num_channels: c_uint,
125 pub first_channel: c_uint,
126}
127#[doc = "! The structure for specifying input or output stream parameters.\n! See \\ref RtAudio::StreamParameters."]
128pub type rtaudio_stream_parameters_t = rtaudio_stream_parameters;
129
130#[doc = "! The structure for specifying stream options.\n! See \\ref RtAudio::StreamOptions."]
131#[repr(C)]
132#[derive(Debug, Copy, Clone)]
133pub struct rtaudio_stream_options {
134 pub flags: rtaudio_stream_flags_t,
135 pub num_buffers: c_uint,
136 pub priority: c_int,
137 pub name: [c_char; MAX_NAME_LENGTH],
138}
139#[doc = "! The structure for specifying stream options.\n! See \\ref RtAudio::StreamOptions."]
140pub type rtaudio_stream_options_t = rtaudio_stream_options;
141
142#[repr(C)]
143#[derive(Debug, Copy, Clone)]
144pub struct rtaudio {
145 _unused: [u8; 0],
146}
147pub type rtaudio_t = *mut rtaudio;
148
149extern "C" {
150 #[doc = "! Determine the current RtAudio version. See \\ref RtAudio::getVersion()."]
151 pub fn rtaudio_version() -> *const c_char;
152
153 #[doc = "! Determine the number of available compiled audio APIs, the length\n! of the array returned by rtaudio_compiled_api(). See \\ref\n! RtAudio::getCompiledApi()."]
154 pub fn rtaudio_get_num_compiled_apis() -> c_uint;
155
156 #[doc = "! Return an array of rtaudio_api_t compiled into this instance of\n! RtAudio. This array is static (do not free it) and has the length\n! returned by rtaudio_get_num_compiled_apis(). See \\ref\n! RtAudio::getCompiledApi()."]
157 pub fn rtaudio_compiled_api() -> *const rtaudio_api_t;
158
159 #[doc = "! Return the name of a specified rtaudio_api_t. This string can be\n! used to look up an API by rtaudio_compiled_api_by_name(). See\n! \\ref RtAudio::getApiName()."]
160 pub fn rtaudio_api_name(api: rtaudio_api_t) -> *const c_char;
161
162 #[doc = "! Return the display name of a specified rtaudio_api_t. See \\ref\n! RtAudio::getApiDisplayName()."]
163 pub fn rtaudio_api_display_name(api: rtaudio_api_t) -> *const c_char;
164
165 #[doc = "! Return the rtaudio_api_t having the given name. See \\ref\n! RtAudio::getCompiledApiByName()."]
166 pub fn rtaudio_compiled_api_by_name(name: *const c_char) -> rtaudio_api_t;
167
168 pub fn rtaudio_error(audio: rtaudio_t) -> *const c_char;
169
170 pub fn rtaudio_error_type(audio: rtaudio_t) -> rtaudio_error_t;
171
172 #[doc = "! Create an instance of struct rtaudio."]
173 pub fn rtaudio_create(api: rtaudio_api_t) -> rtaudio_t;
174
175 #[doc = "! Free an instance of struct rtaudio."]
176 pub fn rtaudio_destroy(audio: rtaudio_t);
177
178 #[doc = "! Returns the audio API specifier for the current instance of\n! RtAudio. See RtAudio::getCurrentApi()."]
179 pub fn rtaudio_current_api(audio: rtaudio_t) -> rtaudio_api_t;
180
181 #[doc = "! Queries for the number of audio devices available. See \\ref\n! RtAudio::getDeviceCount()."]
182 pub fn rtaudio_device_count(audio: rtaudio_t) -> c_int;
183
184 #[doc = "! Returns the audio device ID corresponding to a given index\n! value (valid index values are between 0 and rtaudio_device_count()-1).\n! Note that a return value of 0 is invalid, which will occur if the\n! index value is out of bounds or no devices are found. See \\ref\n! RtAudio::getDeviceIds()."]
185 pub fn rtaudio_get_device_id(audio: rtaudio_t, i: c_int) -> c_uint;
186
187 #[doc = "! Return a struct rtaudio_device_info for a specified device ID.\n! See \\ref RtAudio::getDeviceInfo()."]
188 pub fn rtaudio_get_device_info(audio: rtaudio_t, id: c_uint) -> rtaudio_device_info_t;
189
190 #[doc = "! Returns the device id of the default output device. See \\ref\n! RtAudio::getDefaultOutputDevice()."]
191 pub fn rtaudio_get_default_output_device(audio: rtaudio_t) -> c_uint;
192
193 #[doc = "! Returns the device id of the default input device. See \\ref\n! RtAudio::getDefaultInputDevice()."]
194 pub fn rtaudio_get_default_input_device(audio: rtaudio_t) -> c_uint;
195
196 #[doc = "! Opens a stream with the specified parameters. See \\ref RtAudio::openStream().\n! \\return an \\ref rtaudio_error."]
197 pub fn rtaudio_open_stream(
198 audio: rtaudio_t,
199 output_params: *mut rtaudio_stream_parameters_t,
200 input_params: *mut rtaudio_stream_parameters_t,
201 format: rtaudio_format_t,
202 sample_rate: c_uint,
203 buffer_frames: *mut c_uint,
204 cb: rtaudio_cb_t,
205 userdata: *mut c_void,
206 options: *mut rtaudio_stream_options_t,
207 errcb: rtaudio_error_cb_t,
208 ) -> rtaudio_error_t;
209
210 #[doc = "! Closes a stream and frees any associated stream memory. See \\ref RtAudio::closeStream()."]
211 pub fn rtaudio_close_stream(audio: rtaudio_t);
212
213 #[doc = "! Starts a stream. See \\ref RtAudio::startStream()."]
214 pub fn rtaudio_start_stream(audio: rtaudio_t) -> rtaudio_error_t;
215
216 #[doc = "! Stop a stream, allowing any samples remaining in the output queue\n! to be played. See \\ref RtAudio::stopStream()."]
217 pub fn rtaudio_stop_stream(audio: rtaudio_t) -> rtaudio_error_t;
218
219 #[doc = "! Stop a stream, discarding any samples remaining in the\n! input/output queue. See \\ref RtAudio::abortStream()."]
220 pub fn rtaudio_abort_stream(audio: rtaudio_t) -> rtaudio_error_t;
221
222 #[doc = "! Returns 1 if a stream is open and false if not. See \\ref RtAudio::isStreamOpen()."]
223 pub fn rtaudio_is_stream_open(audio: rtaudio_t) -> c_int;
224
225 #[doc = "! Returns 1 if a stream is running and false if it is stopped or not\n! open. See \\ref RtAudio::isStreamRunning()."]
226 pub fn rtaudio_is_stream_running(audio: rtaudio_t) -> c_int;
227
228 #[doc = "! Returns the number of elapsed seconds since the stream was\n! started. See \\ref RtAudio::getStreamTime()."]
229 pub fn rtaudio_get_stream_time(audio: rtaudio_t) -> f64;
230
231 #[doc = "! Set the stream time to a time in seconds greater than or equal to\n! 0.0. See \\ref RtAudio::setStreamTime()."]
232 pub fn rtaudio_set_stream_time(audio: rtaudio_t, time: f64);
233
234 #[doc = "! Returns the internal stream latency in sample frames. See \\ref\n! RtAudio::getStreamLatency()."]
235 pub fn rtaudio_get_stream_latency(audio: rtaudio_t) -> c_long;
236
237 #[doc = "! Returns actual sample rate in use by the stream. See \\ref\n! RtAudio::getStreamSampleRate()."]
238 pub fn rtaudio_get_stream_sample_rate(audio: rtaudio_t) -> c_uint;
239
240 #[doc = "! Specify whether warning messages should be printed to stderr. See\n! \\ref RtAudio::showWarnings()."]
241 pub fn rtaudio_show_warnings(audio: rtaudio_t, show: c_int);
242}