summaryrefslogtreecommitdiff
path: root/doc/latex/classRtAudio.tex
blob: af914e0af83080b6aaadd89fe1e0c6c00146f3b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
\section{Rt\-Audio  Class Reference}
\label{classRtAudio}\index{RtAudio@{Rt\-Audio}}
{\tt \#include $<$Rt\-Audio.h$>$}

\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef unsigned long {\bf RTAUDIO\_\-FORMAT}
\item 
typedef int ($\ast$ {\bf RTAUDIO\_\-CALLBACK} )(char $\ast$buffer, int buffer\-Size, void $\ast$user\-Data)
\item 
enum \{ {\bf MAX\_\-SAMPLE\_\-RATES} =  14 
 \}
\end{CompactItemize}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Rt\-Audio} ()
\begin{CompactList}\small\item\em The default constructor.\item\end{CompactList}\item 
{\bf Rt\-Audio} (int $\ast$stream\-ID, int output\-Device, int output\-Channels, int input\-Device, int input\-Channels, {\bf RTAUDIO\_\-FORMAT} format, int sample\-Rate, int $\ast$buffer\-Size, int number\-Of\-Buffers)
\begin{CompactList}\small\item\em A constructor which can be used to open a stream during instantiation.\item\end{CompactList}\item 
{\bf $\sim$Rt\-Audio} ()
\begin{CompactList}\small\item\em The destructor.\item\end{CompactList}\item 
int {\bf open\-Stream} (int output\-Device, int output\-Channels, int input\-Device, int input\-Channels, {\bf RTAUDIO\_\-FORMAT} format, int sample\-Rate, int $\ast$buffer\-Size, int number\-Of\-Buffers)
\begin{CompactList}\small\item\em A public method for opening a stream with the specified parameters.\item\end{CompactList}\item 
void {\bf set\-Stream\-Callback} (int stream\-ID, {\bf RTAUDIO\_\-CALLBACK} callback, void $\ast$user\-Data)
\begin{CompactList}\small\item\em A public method which sets a user-defined callback function for a given stream.\item\end{CompactList}\item 
void {\bf cancel\-Stream\-Callback} (int stream\-ID)
\begin{CompactList}\small\item\em A public method which cancels a callback process and function for a given stream.\item\end{CompactList}\item 
int {\bf get\-Device\-Count} (void)
\begin{CompactList}\small\item\em A public method which returns the number of audio devices found.\item\end{CompactList}\item 
void {\bf get\-Device\-Info} (int device, {\bf RTAUDIO\_\-DEVICE} $\ast$info)
\begin{CompactList}\small\item\em Fill a user-supplied {\bf RTAUDIO\_\-DEVICE} {\rm (p.\,\pageref{structRtAudio_1_1RTAUDIO__DEVICE})} structure for a specified device.\item\end{CompactList}\item 
char$\ast$ const {\bf get\-Stream\-Buffer} (int stream\-ID)
\begin{CompactList}\small\item\em A public method which returns a pointer to the buffer for an open stream.\item\end{CompactList}\item 
void {\bf tick\-Stream} (int stream\-ID)
\begin{CompactList}\small\item\em Public method used to trigger processing of input/output data for a stream.\item\end{CompactList}\item 
void {\bf close\-Stream} (int stream\-ID)
\begin{CompactList}\small\item\em Public method which closes a stream and frees any associated buffers.\item\end{CompactList}\item 
void {\bf start\-Stream} (int stream\-ID)
\begin{CompactList}\small\item\em Public method which starts a stream.\item\end{CompactList}\item 
void {\bf stop\-Stream} (int stream\-ID)
\begin{CompactList}\small\item\em Stop a stream, allowing any samples remaining in the queue to be played out and/or read in.\item\end{CompactList}\item 
void {\bf abort\-Stream} (int stream\-ID)
\begin{CompactList}\small\item\em Stop a stream, discarding any samples remaining in the input/output queue.\item\end{CompactList}\item 
int {\bf stream\-Will\-Block} (int stream\-ID)
\begin{CompactList}\small\item\em Queries a stream to determine whether a call to the {\bf tick\-Stream}() {\rm (p.\,\pageref{classRtAudio_a9})} method will block.\item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
const {\bf RTAUDIO\_\-FORMAT} {\bf RTAUDIO\_\-SINT8}
\item 
const {\bf RTAUDIO\_\-FORMAT} {\bf RTAUDIO\_\-SINT16}
\item 
const {\bf RTAUDIO\_\-FORMAT} {\bf RTAUDIO\_\-SINT24}
\item 
const {\bf RTAUDIO\_\-FORMAT} {\bf RTAUDIO\_\-SINT32}
\item 
const {\bf RTAUDIO\_\-FORMAT} {\bf RTAUDIO\_\-FLOAT32}
\item 
const {\bf RTAUDIO\_\-FORMAT} {\bf RTAUDIO\_\-FLOAT64}
\end{CompactItemize}


\subsection{Member Typedef Documentation}
\index{RtAudio@{Rt\-Audio}!RTAUDIO_FORMAT@{RTAUDIO\_\-FORMAT}}
\index{RTAUDIO_FORMAT@{RTAUDIO\_\-FORMAT}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef unsigned long Rt\-Audio::RTAUDIO\_\-FORMAT}\label{classRtAudio_s0}


\index{RtAudio@{Rt\-Audio}!RTAUDIO_CALLBACK@{RTAUDIO\_\-CALLBACK}}
\index{RTAUDIO_CALLBACK@{RTAUDIO\_\-CALLBACK}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ Rt\-Audio::RTAUDIO\_\-CALLBACK)(char $\ast$buffer, int buffer\-Size, void $\ast$user\-Data)}\label{classRtAudio_s1}




\subsection{Member Enumeration Documentation}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}\label{classRtAudio_s3}


\begin{Desc}
\item[{\bf Enumeration values:}]\par
\begin{description}
\index{MAX_SAMPLE_RATES@{MAX\_\-SAMPLE\_\-RATES}!RtAudio@{Rt\-Audio}}\index{RtAudio@{RtAudio}!MAX_SAMPLE_RATES@{MAX\_\-SAMPLE\_\-RATES}}\item[
{\em MAX\_\-SAMPLE\_\-RATES}\label{classRtAudio_s3s2}
]\end{description}
\end{Desc}



\subsection{Constructor \& Destructor Documentation}
\index{RtAudio@{Rt\-Audio}!RtAudio@{RtAudio}}
\index{RtAudio@{RtAudio}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Rt\-Audio::Rt\-Audio ()}\label{classRtAudio_a0}


The default constructor.

Probes the system to make sure at least one audio input/output device is available and determines the api-specific identifier for each device found. An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} error can be thrown if no devices are found or if a memory allocation error occurs. \index{RtAudio@{Rt\-Audio}!RtAudio@{RtAudio}}
\index{RtAudio@{RtAudio}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Rt\-Audio::Rt\-Audio (int $\ast$ {\em stream\-ID}, int {\em output\-Device}, int {\em output\-Channels}, int {\em input\-Device}, int {\em input\-Channels}, {\bf RTAUDIO\_\-FORMAT} {\em format}, int {\em sample\-Rate}, int $\ast$ {\em buffer\-Size}, int {\em number\-Of\-Buffers})}\label{classRtAudio_a1}


A constructor which can be used to open a stream during instantiation.

The specified output and/or input device identifiers correspond to those enumerated via the {\bf get\-Device\-Info}() {\rm (p.\,\pageref{classRtAudio_a7})} method. If device = 0, the default or first available devices meeting the given parameters is selected. If an output or input channel value is zero, the corresponding device value is ignored. When a stream is successfully opened, its identifier is returned via the \char`\"{}stream\-ID\char`\"{} pointer. An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} can be thrown if no devices are found for the given parameters, if a memory allocation error occurs, or if a driver error occurs. \begin{Desc}
\item[{\bf See also: }]\par
{\bf open\-Stream}() {\rm (p.\,\pageref{classRtAudio_a3})} \end{Desc}
\index{RtAudio@{Rt\-Audio}!~RtAudio@{$\sim$RtAudio}}
\index{~RtAudio@{$\sim$RtAudio}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Rt\-Audio::$\sim$Rt\-Audio ()}\label{classRtAudio_a2}


The destructor.

Stops and closes any open streams and devices and deallocates buffer and structure memory. 

\subsection{Member Function Documentation}
\index{RtAudio@{Rt\-Audio}!openStream@{openStream}}
\index{openStream@{openStream}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Rt\-Audio::open\-Stream (int {\em output\-Device}, int {\em output\-Channels}, int {\em input\-Device}, int {\em input\-Channels}, {\bf RTAUDIO\_\-FORMAT} {\em format}, int {\em sample\-Rate}, int $\ast$ {\em buffer\-Size}, int {\em number\-Of\-Buffers})}\label{classRtAudio_a3}


A public method for opening a stream with the specified parameters.

If successful, the opened stream ID is returned. Otherwise, an {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} is thrown.\begin{Desc}
\item[{\bf Parameters: }]\par
\begin{description}
\item[
{\em output\-Device:}]If equal to 0, the default or first device found meeting the given parameters is opened. Otherwise, the device number should correspond to one of those enumerated via the {\bf get\-Device\-Info}() {\rm (p.\,\pageref{classRtAudio_a7})} method. \item[
{\em output\-Channels:}]The desired number of output channels. If equal to zero, the output\-Device identifier is ignored. \item[
{\em input\-Device:}]If equal to 0, the default or first device found meeting the given parameters is opened. Otherwise, the device number should correspond to one of those enumerated via the {\bf get\-Device\-Info}() {\rm (p.\,\pageref{classRtAudio_a7})} method. \item[
{\em input\-Channels:}]The desired number of input channels. If equal to zero, the input\-Device identifier is ignored. \item[
{\em format:}]An RTAUDIO\_\-FORMAT specifying the desired sample data format. \item[
{\em sample\-Rate:}]The desired sample rate (sample frames per second). \item[
{\em buffer\-Size:}]A pointer value indicating the desired internal buffer size in sample frames. The actual value used by the device is returned via the same pointer. A value of zero can be specified, in which case the lowest allowable value is determined. \item[
{\em number\-Of\-Buffers:}]A value which can be used to help control device latency. More buffers typically result in more robust performance, though at a cost of greater latency. A value of zero can be specified, in which case the lowest allowable value is used. \end{description}
\end{Desc}
\index{RtAudio@{Rt\-Audio}!setStreamCallback@{setStreamCallback}}
\index{setStreamCallback@{setStreamCallback}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::set\-Stream\-Callback (int {\em stream\-ID}, {\bf RTAUDIO\_\-CALLBACK} {\em callback}, void $\ast$ {\em user\-Data})}\label{classRtAudio_a4}


A public method which sets a user-defined callback function for a given stream.

This method assigns a callback function to a specific, previously opened stream for non-blocking stream functionality. A separate process is initiated, though the user function is called only when the stream is \char`\"{}running\char`\"{} (between calls to the {\bf start\-Stream}() {\rm (p.\,\pageref{classRtAudio_a11})} and {\bf stop\-Stream}() {\rm (p.\,\pageref{classRtAudio_a12})} methods, respectively). The callback process remains active for the duration of the stream and is automatically shutdown when the stream is closed (via the {\bf close\-Stream}() {\rm (p.\,\pageref{classRtAudio_a10})} method or by object destruction). The callback process can also be shutdown and the user function de-referenced through an explicit call to the {\bf cancel\-Stream\-Callback}() {\rm (p.\,\pageref{classRtAudio_a5})} method. Note that a single stream can use only blocking or callback functionality at the same time, though it is possible to alternate modes on the same stream through the use of the {\bf set\-Stream\-Callback}() {\rm (p.\,\pageref{classRtAudio_a4})} and {\bf cancel\-Stream\-Callback}() {\rm (p.\,\pageref{classRtAudio_a5})} methods (the blocking {\bf tick\-Stream}() {\rm (p.\,\pageref{classRtAudio_a9})} method can be used before a callback is set and/or after a callback is cancelled). An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid device argument. \index{RtAudio@{Rt\-Audio}!cancelStreamCallback@{cancelStreamCallback}}
\index{cancelStreamCallback@{cancelStreamCallback}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::cancel\-Stream\-Callback (int {\em stream\-ID})}\label{classRtAudio_a5}


A public method which cancels a callback process and function for a given stream.

This method shuts down a callback process and de-references the user function for a specific stream. Callback functionality can subsequently be restarted on the stream via the {\bf set\-Stream\-Callback}() {\rm (p.\,\pageref{classRtAudio_a4})} method. An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid device argument. \index{RtAudio@{Rt\-Audio}!getDeviceCount@{getDeviceCount}}
\index{getDeviceCount@{getDeviceCount}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Rt\-Audio::get\-Device\-Count (void)}\label{classRtAudio_a6}


A public method which returns the number of audio devices found.

\index{RtAudio@{Rt\-Audio}!getDeviceInfo@{getDeviceInfo}}
\index{getDeviceInfo@{getDeviceInfo}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::get\-Device\-Info (int {\em device}, {\bf RTAUDIO\_\-DEVICE} $\ast$ {\em info})}\label{classRtAudio_a7}


Fill a user-supplied {\bf RTAUDIO\_\-DEVICE} {\rm (p.\,\pageref{structRtAudio_1_1RTAUDIO__DEVICE})} structure for a specified device.

Any device between 0 and {\bf get\-Device\-Count}() {\rm (p.\,\pageref{classRtAudio_a6})}-1 is valid. If a device is busy or otherwise unavailable, the structure member \char`\"{}probed\char`\"{} has a value of \char`\"{}false\char`\"{}. The system default input and output devices are referenced by device identifier = 0. On systems which allow dynamic default device settings, the default devices are not identified by name (specific device enumerations are assigned device identifiers $>$ 0). An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid device argument. \index{RtAudio@{Rt\-Audio}!getStreamBuffer@{getStreamBuffer}}
\index{getStreamBuffer@{getStreamBuffer}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char $\ast$const Rt\-Audio::get\-Stream\-Buffer (int {\em stream\-ID})}\label{classRtAudio_a8}


A public method which returns a pointer to the buffer for an open stream.

The user should fill and/or read the buffer data in interleaved format and then call the {\bf tick\-Stream}() {\rm (p.\,\pageref{classRtAudio_a9})} method. An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid stream identifier. \index{RtAudio@{Rt\-Audio}!tickStream@{tickStream}}
\index{tickStream@{tickStream}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::tick\-Stream (int {\em stream\-ID})}\label{classRtAudio_a9}


Public method used to trigger processing of input/output data for a stream.

This method blocks until all buffer data is read/written. An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid stream identifier or if a driver error occurs. \index{RtAudio@{Rt\-Audio}!closeStream@{closeStream}}
\index{closeStream@{closeStream}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::close\-Stream (int {\em stream\-ID})}\label{classRtAudio_a10}


Public method which closes a stream and frees any associated buffers.

If an invalid stream identifier is specified, this method issues a warning and returns (an {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} is not thrown). \index{RtAudio@{Rt\-Audio}!startStream@{startStream}}
\index{startStream@{startStream}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::start\-Stream (int {\em stream\-ID})}\label{classRtAudio_a11}


Public method which starts a stream.

An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid stream identifier or if a driver error occurs. \index{RtAudio@{Rt\-Audio}!stopStream@{stopStream}}
\index{stopStream@{stopStream}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::stop\-Stream (int {\em stream\-ID})}\label{classRtAudio_a12}


Stop a stream, allowing any samples remaining in the queue to be played out and/or read in.

An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid stream identifier or if a driver error occurs. \index{RtAudio@{Rt\-Audio}!abortStream@{abortStream}}
\index{abortStream@{abortStream}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Rt\-Audio::abort\-Stream (int {\em stream\-ID})}\label{classRtAudio_a13}


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

An {\bf Rt\-Audio\-Error} {\rm (p.\,\pageref{classRtAudioError})} will be thrown for an invalid stream identifier or if a driver error occurs. \index{RtAudio@{Rt\-Audio}!streamWillBlock@{streamWillBlock}}
\index{streamWillBlock@{streamWillBlock}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Rt\-Audio::stream\-Will\-Block (int {\em stream\-ID})}\label{classRtAudio_a14}


Queries a stream to determine whether a call to the {\bf tick\-Stream}() {\rm (p.\,\pageref{classRtAudio_a9})} method will block.

A return value of 0 indicates that the stream will NOT block. A positive return value indicates the number of sample frames that cannot yet be processed without blocking. 

\subsection{Member Data Documentation}
\index{RtAudio@{Rt\-Audio}!RTAUDIO_SINT8@{RTAUDIO\_\-SINT8}}
\index{RTAUDIO_SINT8@{RTAUDIO\_\-SINT8}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf RTAUDIO\_\-FORMAT} Rt\-Audio::RTAUDIO\_\-SINT8\hspace{0.3cm}{\tt  [static]}}\label{classRtAudio_p0}


\index{RtAudio@{Rt\-Audio}!RTAUDIO_SINT16@{RTAUDIO\_\-SINT16}}
\index{RTAUDIO_SINT16@{RTAUDIO\_\-SINT16}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf RTAUDIO\_\-FORMAT} Rt\-Audio::RTAUDIO\_\-SINT16\hspace{0.3cm}{\tt  [static]}}\label{classRtAudio_p1}


\index{RtAudio@{Rt\-Audio}!RTAUDIO_SINT24@{RTAUDIO\_\-SINT24}}
\index{RTAUDIO_SINT24@{RTAUDIO\_\-SINT24}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf RTAUDIO\_\-FORMAT} Rt\-Audio::RTAUDIO\_\-SINT24\hspace{0.3cm}{\tt  [static]}}\label{classRtAudio_p2}


Upper 3 bytes of 32-bit integer. \index{RtAudio@{Rt\-Audio}!RTAUDIO_SINT32@{RTAUDIO\_\-SINT32}}
\index{RTAUDIO_SINT32@{RTAUDIO\_\-SINT32}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf RTAUDIO\_\-FORMAT} Rt\-Audio::RTAUDIO\_\-SINT32\hspace{0.3cm}{\tt  [static]}}\label{classRtAudio_p3}


\index{RtAudio@{Rt\-Audio}!RTAUDIO_FLOAT32@{RTAUDIO\_\-FLOAT32}}
\index{RTAUDIO_FLOAT32@{RTAUDIO\_\-FLOAT32}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf RTAUDIO\_\-FORMAT} Rt\-Audio::RTAUDIO\_\-FLOAT32\hspace{0.3cm}{\tt  [static]}}\label{classRtAudio_p4}


Normalized between plus/minus 1.0. \index{RtAudio@{Rt\-Audio}!RTAUDIO_FLOAT64@{RTAUDIO\_\-FLOAT64}}
\index{RTAUDIO_FLOAT64@{RTAUDIO\_\-FLOAT64}!RtAudio@{Rt\-Audio}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf RTAUDIO\_\-FORMAT} Rt\-Audio::RTAUDIO\_\-FLOAT64\hspace{0.3cm}{\tt  [static]}}\label{classRtAudio_p5}


Normalized between plus/minus 1.0. 

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf Rt\-Audio.h}\end{CompactItemize}