91124cf104e85c3a5e8b9e885d233f30f2210fcd
[rtaudio-cdist.git] / RtAudio.h
1 /************************************************************************/
2 /*! \class RtAudio
3     \brief Realtime audio i/o C++ classes.
4
5     RtAudio provides a common API (Application Programming Interface)
6     for realtime audio input/output across Linux (native ALSA, Jack,
7     and OSS), Macintosh OS X (CoreAudio and Jack), and Windows
8     (DirectSound, ASIO and WASAPI) operating systems.
9
10     RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
11
12     RtAudio: realtime audio i/o C++ classes
13     Copyright (c) 2001-2017 Gary P. Scavone
14
15     Permission is hereby granted, free of charge, to any person
16     obtaining a copy of this software and associated documentation files
17     (the "Software"), to deal in the Software without restriction,
18     including without limitation the rights to use, copy, modify, merge,
19     publish, distribute, sublicense, and/or sell copies of the Software,
20     and to permit persons to whom the Software is furnished to do so,
21     subject to the following conditions:
22
23     The above copyright notice and this permission notice shall be
24     included in all copies or substantial portions of the Software.
25
26     Any person wishing to distribute modifications to the Software is
27     asked to send the modifications to the original developer so that
28     they can be incorporated into the canonical version.  This is,
29     however, not a binding provision of this license.
30
31     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
35     ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
36     CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37     WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 */
39 /************************************************************************/
40
41 /*!
42   \file RtAudio.h
43  */
44
45 #ifndef __RTAUDIO_H
46 #define __RTAUDIO_H
47
48 #define RTAUDIO_VERSION "5.0.0"
49
50 #if defined _WIN32 || defined __CYGWIN__
51   #define RTAUDIO_DLL_PUBLIC
52 #else
53   #if __GNUC__ >= 4
54     #define RTAUDIO_DLL_PUBLIC __attribute__( (visibility( "default" )) )
55   #else
56     #define RTAUDIO_DLL_PUBLIC
57   #endif
58 #endif
59
60 #include <string>
61 #include <vector>
62 #include <stdexcept>
63 #include <iostream>
64
65 /*! \typedef typedef unsigned long RtAudioFormat;
66     \brief RtAudio data format type.
67
68     Support for signed integers and floats.  Audio data fed to/from an
69     RtAudio stream is assumed to ALWAYS be in host byte order.  The
70     internal routines will automatically take care of any necessary
71     byte-swapping between the host format and the soundcard.  Thus,
72     endian-ness is not a concern in the following format definitions.
73
74     - \e RTAUDIO_SINT8:   8-bit signed integer.
75     - \e RTAUDIO_SINT16:  16-bit signed integer.
76     - \e RTAUDIO_SINT24:  24-bit signed integer.
77     - \e RTAUDIO_SINT32:  32-bit signed integer.
78     - \e RTAUDIO_FLOAT32: Normalized between plus/minus 1.0.
79     - \e RTAUDIO_FLOAT64: Normalized between plus/minus 1.0.
80 */
81 typedef unsigned long RtAudioFormat;
82 static const RtAudioFormat RTAUDIO_SINT8 = 0x1;    // 8-bit signed integer.
83 static const RtAudioFormat RTAUDIO_SINT16 = 0x2;   // 16-bit signed integer.
84 static const RtAudioFormat RTAUDIO_SINT24 = 0x4;   // 24-bit signed integer.
85 static const RtAudioFormat RTAUDIO_SINT32 = 0x8;   // 32-bit signed integer.
86 static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0.
87 static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0.
88
89 /*! \typedef typedef unsigned long RtAudioStreamFlags;
90     \brief RtAudio stream option flags.
91
92     The following flags can be OR'ed together to allow a client to
93     make changes to the default stream behavior:
94
95     - \e RTAUDIO_NONINTERLEAVED:   Use non-interleaved buffers (default = interleaved).
96     - \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
97     - \e RTAUDIO_HOG_DEVICE:       Attempt grab device for exclusive use.
98     - \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only).
99     - \e RTAUDIO_JACK_DONT_CONNECT: Do not automatically connect ports (JACK only).
100
101     By default, RtAudio streams pass and receive audio data from the
102     client in an interleaved format.  By passing the
103     RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio
104     data will instead be presented in non-interleaved buffers.  In
105     this case, each buffer argument in the RtAudioCallback function
106     will point to a single array of data, with \c nFrames samples for
107     each channel concatenated back-to-back.  For example, the first
108     sample of data for the second channel would be located at index \c
109     nFrames (assuming the \c buffer pointer was recast to the correct
110     data type for the stream).
111
112     Certain audio APIs offer a number of parameters that influence the
113     I/O latency of a stream.  By default, RtAudio will attempt to set
114     these parameters internally for robust (glitch-free) performance
115     (though some APIs, like Windows Direct Sound, make this difficult).
116     By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream()
117     function, internal stream settings will be influenced in an attempt
118     to minimize stream latency, though possibly at the expense of stream
119     performance.
120
121     If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to
122     open the input and/or output stream device(s) for exclusive use.
123     Note that this is not possible with all supported audio APIs.
124
125     If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt 
126     to select realtime scheduling (round-robin) for the callback thread.
127
128     If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
129     open the "default" PCM device when using the ALSA API. Note that this
130     will override any specified input or output device id.
131
132     If the RTAUDIO_JACK_DONT_CONNECT flag is set, RtAudio will not attempt
133     to automatically connect the ports of the client to the audio device.
134 */
135 typedef unsigned int RtAudioStreamFlags;
136 static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1;    // Use non-interleaved buffers (default = interleaved).
137 static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2;  // Attempt to set stream parameters for lowest possible latency.
138 static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4;        // Attempt grab device and prevent use by others.
139 static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread.
140 static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only).
141 static const RtAudioStreamFlags RTAUDIO_JACK_DONT_CONNECT = 0x20; // Do not automatically connect ports (JACK only).
142
143 /*! \typedef typedef unsigned long RtAudioStreamStatus;
144     \brief RtAudio stream status (over- or underflow) flags.
145
146     Notification of a stream over- or underflow is indicated by a
147     non-zero stream \c status argument in the RtAudioCallback function.
148     The stream status can be one of the following two options,
149     depending on whether the stream is open for output and/or input:
150
151     - \e RTAUDIO_INPUT_OVERFLOW:   Input data was discarded because of an overflow condition at the driver.
152     - \e RTAUDIO_OUTPUT_UNDERFLOW: The output buffer ran low, likely producing a break in the output sound.
153 */
154 typedef unsigned int RtAudioStreamStatus;
155 static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1;    // Input data was discarded because of an overflow condition at the driver.
156 static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2;  // The output buffer ran low, likely causing a gap in the output sound.
157
158 //! RtAudio callback function prototype.
159 /*!
160    All RtAudio clients must create a function of type RtAudioCallback
161    to read and/or write data from/to the audio stream.  When the
162    underlying audio system is ready for new input or output data, this
163    function will be invoked.
164
165    \param outputBuffer For output (or duplex) streams, the client
166           should write \c nFrames of audio sample frames into this
167           buffer.  This argument should be recast to the datatype
168           specified when the stream was opened.  For input-only
169           streams, this argument will be NULL.
170
171    \param inputBuffer For input (or duplex) streams, this buffer will
172           hold \c nFrames of input audio sample frames.  This
173           argument should be recast to the datatype specified when the
174           stream was opened.  For output-only streams, this argument
175           will be NULL.
176
177    \param nFrames The number of sample frames of input or output
178           data in the buffers.  The actual buffer size in bytes is
179           dependent on the data type and number of channels in use.
180
181    \param streamTime The number of seconds that have elapsed since the
182           stream was started.
183
184    \param status If non-zero, this argument indicates a data overflow
185           or underflow condition for the stream.  The particular
186           condition can be determined by comparison with the
187           RtAudioStreamStatus flags.
188
189    \param userData A pointer to optional data provided by the client
190           when opening the stream (default = NULL).
191
192    To continue normal stream operation, the RtAudioCallback function
193    should return a value of zero.  To stop the stream and drain the
194    output buffer, the function should return a value of one.  To abort
195    the stream immediately, the client should return a value of two.
196  */
197 typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
198                                 unsigned int nFrames,
199                                 double streamTime,
200                                 RtAudioStreamStatus status,
201                                 void *userData );
202
203 /************************************************************************/
204 /*! \class RtAudioError
205     \brief Exception handling class for RtAudio.
206
207     The RtAudioError class is quite simple but it does allow errors to be
208     "caught" by RtAudioError::Type. See the RtAudio documentation to know
209     which methods can throw an RtAudioError.
210 */
211 /************************************************************************/
212
213 class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
214 {
215  public:
216   //! Defined RtAudioError types.
217   enum Type {
218     WARNING,           /*!< A non-critical error. */
219     DEBUG_WARNING,     /*!< A non-critical error which might be useful for debugging. */
220     UNSPECIFIED,       /*!< The default, unspecified error type. */
221     NO_DEVICES_FOUND,  /*!< No devices found on system. */
222     INVALID_DEVICE,    /*!< An invalid device ID was specified. */
223     MEMORY_ERROR,      /*!< An error occured during memory allocation. */
224     INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
225     INVALID_USE,       /*!< The function was called incorrectly. */
226     DRIVER_ERROR,      /*!< A system driver error occured. */
227     SYSTEM_ERROR,      /*!< A system error occured. */
228     THREAD_ERROR       /*!< A thread error occured. */
229   };
230
231   //! The constructor.
232   RtAudioError( const std::string& message,
233                 Type type = RtAudioError::UNSPECIFIED )
234     : std::runtime_error(message), type_(type) {}
235
236   //! Prints thrown error message to stderr.
237   virtual void printMessage( void ) const
238     { std::cerr << '\n' << what() << "\n\n"; }
239
240   //! Returns the thrown error message type.
241   virtual const Type& getType(void) const { return type_; }
242
243   //! Returns the thrown error message string.
244   virtual const std::string getMessage(void) const
245     { return std::string(what()); }
246
247  protected:
248   Type type_;
249 };
250
251 //! RtAudio error callback function prototype.
252 /*!
253     \param type Type of error.
254     \param errorText Error description.
255  */
256 typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string &errorText );
257
258 // **************************************************************** //
259 //
260 // RtAudio class declaration.
261 //
262 // RtAudio is a "controller" used to select an available audio i/o
263 // interface.  It presents a common API for the user to call but all
264 // functionality is implemented by the class RtApi and its
265 // subclasses.  RtAudio creates an instance of an RtApi subclass
266 // based on the user's API choice.  If no choice is made, RtAudio
267 // attempts to make a "logical" API selection.
268 //
269 // **************************************************************** //
270
271 class RtApi;
272
273 class RTAUDIO_DLL_PUBLIC RtAudio
274 {
275  public:
276
277   //! Audio API specifier arguments.
278   enum Api {
279     UNSPECIFIED,    /*!< Search for a working compiled API. */
280     LINUX_ALSA,     /*!< The Advanced Linux Sound Architecture API. */
281     LINUX_PULSE,    /*!< The Linux PulseAudio API. */
282     LINUX_OSS,      /*!< The Linux Open Sound System API. */
283     UNIX_JACK,      /*!< The Jack Low-Latency Audio Server API. */
284     MACOSX_CORE,    /*!< Macintosh OS-X Core Audio API. */
285     WINDOWS_WASAPI, /*!< The Microsoft WASAPI API. */
286     WINDOWS_ASIO,   /*!< The Steinberg Audio Stream I/O API. */
287     WINDOWS_DS,     /*!< The Microsoft Direct Sound API. */
288     RTAUDIO_DUMMY   /*!< A compilable but non-functional API. */
289   };
290
291   //! The public device information structure for returning queried values.
292   struct DeviceInfo {
293     bool probed;                  /*!< true if the device capabilities were successfully probed. */
294     std::string name;             /*!< Character string device identifier. */
295     unsigned int outputChannels;  /*!< Maximum output channels supported by device. */
296     unsigned int inputChannels;   /*!< Maximum input channels supported by device. */
297     unsigned int duplexChannels;  /*!< Maximum simultaneous input/output channels supported by device. */
298     bool isDefaultOutput;         /*!< true if this is the default output device. */
299     bool isDefaultInput;          /*!< true if this is the default input device. */
300     std::vector<unsigned int> sampleRates; /*!< Supported sample rates (queried from list of standard rates). */
301     unsigned int preferredSampleRate; /*!< Preferred sample rate, eg. for WASAPI the system sample rate. */
302     RtAudioFormat nativeFormats;  /*!< Bit mask of supported data formats. */
303
304     // Default constructor.
305     DeviceInfo()
306       :probed(false), outputChannels(0), inputChannels(0), duplexChannels(0),
307        isDefaultOutput(false), isDefaultInput(false), preferredSampleRate(0), nativeFormats(0) {}
308   };
309
310   //! The structure for specifying input or ouput stream parameters.
311   struct StreamParameters {
312     unsigned int deviceId;     /*!< Device index (0 to getDeviceCount() - 1). */
313     unsigned int nChannels;    /*!< Number of channels. */
314     unsigned int firstChannel; /*!< First channel index on device (default = 0). */
315
316     // Default constructor.
317     StreamParameters()
318       : deviceId(0), nChannels(0), firstChannel(0) {}
319   };
320
321   //! The structure for specifying stream options.
322   /*!
323     The following flags can be OR'ed together to allow a client to
324     make changes to the default stream behavior:
325
326     - \e RTAUDIO_NONINTERLEAVED:    Use non-interleaved buffers (default = interleaved).
327     - \e RTAUDIO_MINIMIZE_LATENCY:  Attempt to set stream parameters for lowest possible latency.
328     - \e RTAUDIO_HOG_DEVICE:        Attempt grab device for exclusive use.
329     - \e RTAUDIO_SCHEDULE_REALTIME: Attempt to select realtime scheduling for callback thread.
330     - \e RTAUDIO_ALSA_USE_DEFAULT:  Use the "default" PCM device (ALSA only).
331
332     By default, RtAudio streams pass and receive audio data from the
333     client in an interleaved format.  By passing the
334     RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio
335     data will instead be presented in non-interleaved buffers.  In
336     this case, each buffer argument in the RtAudioCallback function
337     will point to a single array of data, with \c nFrames samples for
338     each channel concatenated back-to-back.  For example, the first
339     sample of data for the second channel would be located at index \c
340     nFrames (assuming the \c buffer pointer was recast to the correct
341     data type for the stream).
342
343     Certain audio APIs offer a number of parameters that influence the
344     I/O latency of a stream.  By default, RtAudio will attempt to set
345     these parameters internally for robust (glitch-free) performance
346     (though some APIs, like Windows Direct Sound, make this difficult).
347     By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream()
348     function, internal stream settings will be influenced in an attempt
349     to minimize stream latency, though possibly at the expense of stream
350     performance.
351
352     If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to
353     open the input and/or output stream device(s) for exclusive use.
354     Note that this is not possible with all supported audio APIs.
355
356     If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt 
357     to select realtime scheduling (round-robin) for the callback thread.
358     The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME
359     flag is set. It defines the thread's realtime priority.
360
361     If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
362     open the "default" PCM device when using the ALSA API. Note that this
363     will override any specified input or output device id.
364
365     The \c numberOfBuffers parameter can be used to control stream
366     latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs
367     only.  A value of two is usually the smallest allowed.  Larger
368     numbers can potentially result in more robust stream performance,
369     though likely at the cost of stream latency.  The value set by the
370     user is replaced during execution of the RtAudio::openStream()
371     function by the value actually used by the system.
372
373     The \c streamName parameter can be used to set the client name
374     when using the Jack API.  By default, the client name is set to
375     RtApiJack.  However, if you wish to create multiple instances of
376     RtAudio with Jack, each instance must have a unique client name.
377   */
378   struct StreamOptions {
379     RtAudioStreamFlags flags;      /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT). */
380     unsigned int numberOfBuffers;  /*!< Number of stream buffers. */
381     std::string streamName;        /*!< A stream name (currently used only in Jack). */
382     int priority;                  /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */
383
384     // Default constructor.
385     StreamOptions()
386     : flags(0), numberOfBuffers(0), priority(0) {}
387   };
388
389   //! A static function to determine the current RtAudio version.
390   static std::string getVersion( void );
391
392   //! A static function to determine the available compiled audio APIs.
393   /*!
394     The values returned in the std::vector can be compared against
395     the enumerated list values.  Note that there can be more than one
396     API compiled for certain operating systems.
397   */
398   static void getCompiledApi( std::vector<RtAudio::Api> &apis );
399
400   //! Return the name of a specified compiled audio API.
401   /*!
402     If the API is unknown or not compiled, this function will return
403     the empty string.
404   */
405   static const std::string &getCompiledApiName( RtAudio::Api api );
406
407   //! Return the compiled audio API having the given name.
408   /*!
409     A case insensitive comparison will check the specified name
410     against the list of compiled APIs, and return the one which
411     matches. On failure, the function returns UNSPECIFIED.
412   */
413   static RtAudio::Api getCompiledApiByName( const std::string &name );
414
415   //! The class constructor.
416   /*!
417     The constructor performs minor initialization tasks.  An exception
418     can be thrown if no API support is compiled.
419
420     If no API argument is specified and multiple API support has been
421     compiled, the default order of use is JACK, ALSA, OSS (Linux
422     systems) and ASIO, DS (Windows systems).
423   */
424   RtAudio( RtAudio::Api api=UNSPECIFIED );
425
426   //! The destructor.
427   /*!
428     If a stream is running or open, it will be stopped and closed
429     automatically.
430   */
431   ~RtAudio();
432
433   //! Returns the audio API specifier for the current instance of RtAudio.
434   RtAudio::Api getCurrentApi( void );
435
436   //! A public function that queries for the number of audio devices available.
437   /*!
438     This function performs a system query of available devices each time it
439     is called, thus supporting devices connected \e after instantiation. If
440     a system error occurs during processing, a warning will be issued. 
441   */
442   unsigned int getDeviceCount( void );
443
444   //! Return an RtAudio::DeviceInfo structure for a specified device number.
445   /*!
446
447     Any device integer between 0 and getDeviceCount() - 1 is valid.
448     If an invalid argument is provided, an RtAudioError (type = INVALID_USE)
449     will be thrown.  If a device is busy or otherwise unavailable, the
450     structure member "probed" will have a value of "false" and all
451     other members are undefined.  If the specified device is the
452     current default input or output device, the corresponding
453     "isDefault" member will have a value of "true".
454   */
455   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
456
457   //! A function that returns the index of the default output device.
458   /*!
459     If the underlying audio API does not provide a "default
460     device", or if no devices are available, the return value will be
461     0.  Note that this is a valid device identifier and it is the
462     client's responsibility to verify that a device is available
463     before attempting to open a stream.
464   */
465   unsigned int getDefaultOutputDevice( void );
466
467   //! A function that returns the index of the default input device.
468   /*!
469     If the underlying audio API does not provide a "default
470     device", or if no devices are available, the return value will be
471     0.  Note that this is a valid device identifier and it is the
472     client's responsibility to verify that a device is available
473     before attempting to open a stream.
474   */
475   unsigned int getDefaultInputDevice( void );
476
477   //! A public function for opening a stream with the specified parameters.
478   /*!
479     An RtAudioError (type = SYSTEM_ERROR) is thrown if a stream cannot be
480     opened with the specified parameters or an error occurs during
481     processing.  An RtAudioError (type = INVALID_USE) is thrown if any
482     invalid device ID or channel number parameters are specified.
483
484     \param outputParameters Specifies output stream parameters to use
485            when opening a stream, including a device ID, number of channels,
486            and starting channel number.  For input-only streams, this
487            argument should be NULL.  The device ID is an index value between
488            0 and getDeviceCount() - 1.
489     \param inputParameters Specifies input stream parameters to use
490            when opening a stream, including a device ID, number of channels,
491            and starting channel number.  For output-only streams, this
492            argument should be NULL.  The device ID is an index value between
493            0 and getDeviceCount() - 1.
494     \param format An RtAudioFormat specifying the desired sample data format.
495     \param sampleRate The desired sample rate (sample frames per second).
496     \param *bufferFrames A pointer to a value indicating the desired
497            internal buffer size in sample frames.  The actual value
498            used by the device is returned via the same pointer.  A
499            value of zero can be specified, in which case the lowest
500            allowable value is determined.
501     \param callback A client-defined function that will be invoked
502            when input data is available and/or output data is needed.
503     \param userData An optional pointer to data that can be accessed
504            from within the callback function.
505     \param options An optional pointer to a structure containing various
506            global stream options, including a list of OR'ed RtAudioStreamFlags
507            and a suggested number of stream buffers that can be used to 
508            control stream latency.  More buffers typically result in more
509            robust performance, though at a cost of greater latency.  If a
510            value of zero is specified, a system-specific median value is
511            chosen.  If the RTAUDIO_MINIMIZE_LATENCY flag bit is set, the
512            lowest allowable value is used.  The actual value used is
513            returned via the structure argument.  The parameter is API dependent.
514     \param errorCallback A client-defined function that will be invoked
515            when an error has occured.
516   */
517   void openStream( RtAudio::StreamParameters *outputParameters,
518                    RtAudio::StreamParameters *inputParameters,
519                    RtAudioFormat format, unsigned int sampleRate,
520                    unsigned int *bufferFrames, RtAudioCallback callback,
521                    void *userData = NULL, RtAudio::StreamOptions *options = NULL, RtAudioErrorCallback errorCallback = NULL );
522
523   //! A function that closes a stream and frees any associated stream memory.
524   /*!
525     If a stream is not open, this function issues a warning and
526     returns (no exception is thrown).
527   */
528   void closeStream( void );
529
530   //! A function that starts a stream.
531   /*!
532     An RtAudioError (type = SYSTEM_ERROR) is thrown if an error occurs
533     during processing.  An RtAudioError (type = INVALID_USE) is thrown if a
534     stream is not open.  A warning is issued if the stream is already
535     running.
536   */
537   void startStream( void );
538
539   //! Stop a stream, allowing any samples remaining in the output queue to be played.
540   /*!
541     An RtAudioError (type = SYSTEM_ERROR) is thrown if an error occurs
542     during processing.  An RtAudioError (type = INVALID_USE) is thrown if a
543     stream is not open.  A warning is issued if the stream is already
544     stopped.
545   */
546   void stopStream( void );
547
548   //! Stop a stream, discarding any samples remaining in the input/output queue.
549   /*!
550     An RtAudioError (type = SYSTEM_ERROR) is thrown if an error occurs
551     during processing.  An RtAudioError (type = INVALID_USE) is thrown if a
552     stream is not open.  A warning is issued if the stream is already
553     stopped.
554   */
555   void abortStream( void );
556
557   //! Returns true if a stream is open and false if not.
558   bool isStreamOpen( void ) const;
559
560   //! Returns true if the stream is running and false if it is stopped or not open.
561   bool isStreamRunning( void ) const;
562
563   //! Returns the number of elapsed seconds since the stream was started.
564   /*!
565     If a stream is not open, an RtAudioError (type = INVALID_USE) will be thrown.
566   */
567   double getStreamTime( void );
568
569   //! Set the stream time to a time in seconds greater than or equal to 0.0.
570   /*!
571     If a stream is not open, an RtAudioError (type = INVALID_USE) will be thrown.
572   */
573   void setStreamTime( double time );
574
575   //! Returns the internal stream latency in sample frames.
576   /*!
577     The stream latency refers to delay in audio input and/or output
578     caused by internal buffering by the audio system and/or hardware.
579     For duplex streams, the returned value will represent the sum of
580     the input and output latencies.  If a stream is not open, an
581     RtAudioError (type = INVALID_USE) will be thrown.  If the API does not
582     report latency, the return value will be zero.
583   */
584   long getStreamLatency( void );
585
586  //! Returns actual sample rate in use by the stream.
587  /*!
588    On some systems, the sample rate used may be slightly different
589    than that specified in the stream parameters.  If a stream is not
590    open, an RtAudioError (type = INVALID_USE) will be thrown.
591  */
592   unsigned int getStreamSampleRate( void );
593
594   //! Specify whether warning messages should be printed to stderr.
595   void showWarnings( bool value = true );
596
597  protected:
598
599   void openRtApi( RtAudio::Api api );
600   RtApi *rtapi_;
601 };
602
603 // Operating system dependent thread functionality.
604 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__)
605
606   #ifndef NOMINMAX
607     #define NOMINMAX
608   #endif
609   #include <windows.h>
610   #include <process.h>
611
612   typedef uintptr_t ThreadHandle;
613   typedef CRITICAL_SECTION StreamMutex;
614
615 #elif defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
616   // Using pthread library for various flavors of unix.
617   #include <pthread.h>
618
619   typedef pthread_t ThreadHandle;
620   typedef pthread_mutex_t StreamMutex;
621
622 #else // Setup for "dummy" behavior
623
624   #define __RTAUDIO_DUMMY__
625   typedef int ThreadHandle;
626   typedef int StreamMutex;
627
628 #endif
629
630 // This global structure type is used to pass callback information
631 // between the private RtAudio stream structure and global callback
632 // handling functions.
633 struct CallbackInfo {
634   void *object;    // Used as a "this" pointer.
635   ThreadHandle thread;
636   void *callback;
637   void *userData;
638   void *errorCallback;
639   void *apiInfo;   // void pointer for API specific callback information
640   bool isRunning;
641   bool doRealtime;
642   int priority;
643
644   // Default constructor.
645   CallbackInfo()
646   :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false), priority(0) {}
647 };
648
649 // **************************************************************** //
650 //
651 // RtApi class declaration.
652 //
653 // Subclasses of RtApi contain all API- and OS-specific code necessary
654 // to fully implement the RtAudio API.
655 //
656 // Note that RtApi is an abstract base class and cannot be
657 // explicitly instantiated.  The class RtAudio will create an
658 // instance of an RtApi subclass (RtApiOss, RtApiAlsa,
659 // RtApiJack, RtApiCore, RtApiDs, or RtApiAsio).
660 //
661 // **************************************************************** //
662
663 #pragma pack(push, 1)
664 class S24 {
665
666  protected:
667   unsigned char c3[3];
668
669  public:
670   S24() {}
671
672   S24& operator = ( const int& i ) {
673     c3[0] = (i & 0x000000ff);
674     c3[1] = (i & 0x0000ff00) >> 8;
675     c3[2] = (i & 0x00ff0000) >> 16;
676     return *this;
677   }
678
679   S24( const S24& v ) { *this = v; }
680   S24( const double& d ) { *this = (int) d; }
681   S24( const float& f ) { *this = (int) f; }
682   S24( const signed short& s ) { *this = (int) s; }
683   S24( const char& c ) { *this = (int) c; }
684
685   int asInt() {
686     int i = c3[0] | (c3[1] << 8) | (c3[2] << 16);
687     if (i & 0x800000) i |= ~0xffffff;
688     return i;
689   }
690 };
691 #pragma pack(pop)
692
693 #if defined( HAVE_GETTIMEOFDAY )
694   #include <sys/time.h>
695 #endif
696
697 #include <sstream>
698
699 class RTAUDIO_DLL_PUBLIC RtApi
700 {
701 public:
702
703   RtApi();
704   virtual ~RtApi();
705   virtual RtAudio::Api getCurrentApi( void ) = 0;
706   virtual unsigned int getDeviceCount( void ) = 0;
707   virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
708   virtual unsigned int getDefaultInputDevice( void );
709   virtual unsigned int getDefaultOutputDevice( void );
710   void openStream( RtAudio::StreamParameters *outputParameters,
711                    RtAudio::StreamParameters *inputParameters,
712                    RtAudioFormat format, unsigned int sampleRate,
713                    unsigned int *bufferFrames, RtAudioCallback callback,
714                    void *userData, RtAudio::StreamOptions *options,
715                    RtAudioErrorCallback errorCallback );
716   virtual void closeStream( void );
717   virtual void startStream( void ) = 0;
718   virtual void stopStream( void ) = 0;
719   virtual void abortStream( void ) = 0;
720   long getStreamLatency( void );
721   unsigned int getStreamSampleRate( void );
722   virtual double getStreamTime( void );
723   virtual void setStreamTime( double time );
724   bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; }
725   bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; }
726   void showWarnings( bool value ) { showWarnings_ = value; }
727
728
729 protected:
730
731   static const unsigned int MAX_SAMPLE_RATES;
732   static const unsigned int SAMPLE_RATES[];
733
734   enum { FAILURE, SUCCESS };
735
736   enum StreamState {
737     STREAM_STOPPED,
738     STREAM_STOPPING,
739     STREAM_RUNNING,
740     STREAM_CLOSED = -50
741   };
742
743   enum StreamMode {
744     OUTPUT,
745     INPUT,
746     DUPLEX,
747     UNINITIALIZED = -75
748   };
749
750   // A protected structure used for buffer conversion.
751   struct ConvertInfo {
752     int channels;
753     int inJump, outJump;
754     RtAudioFormat inFormat, outFormat;
755     std::vector<int> inOffset;
756     std::vector<int> outOffset;
757   };
758
759   // A protected structure for audio streams.
760   struct RtApiStream {
761     unsigned int device[2];    // Playback and record, respectively.
762     void *apiHandle;           // void pointer for API specific stream handle information
763     StreamMode mode;           // OUTPUT, INPUT, or DUPLEX.
764     StreamState state;         // STOPPED, RUNNING, or CLOSED
765     char *userBuffer[2];       // Playback and record, respectively.
766     char *deviceBuffer;
767     bool doConvertBuffer[2];   // Playback and record, respectively.
768     bool userInterleaved;
769     bool deviceInterleaved[2]; // Playback and record, respectively.
770     bool doByteSwap[2];        // Playback and record, respectively.
771     unsigned int sampleRate;
772     unsigned int bufferSize;
773     unsigned int nBuffers;
774     unsigned int nUserChannels[2];    // Playback and record, respectively.
775     unsigned int nDeviceChannels[2];  // Playback and record channels, respectively.
776     unsigned int channelOffset[2];    // Playback and record, respectively.
777     unsigned long latency[2];         // Playback and record, respectively.
778     RtAudioFormat userFormat;
779     RtAudioFormat deviceFormat[2];    // Playback and record, respectively.
780     StreamMutex mutex;
781     CallbackInfo callbackInfo;
782     ConvertInfo convertInfo[2];
783     double streamTime;         // Number of elapsed seconds since the stream started.
784
785 #if defined(HAVE_GETTIMEOFDAY)
786     struct timeval lastTickTimestamp;
787 #endif
788
789     RtApiStream()
790       :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
791   };
792
793   typedef S24 Int24;
794   typedef signed short Int16;
795   typedef signed int Int32;
796   typedef float Float32;
797   typedef double Float64;
798
799   std::ostringstream errorStream_;
800   std::string errorText_;
801   bool showWarnings_;
802   RtApiStream stream_;
803   bool firstErrorOccurred_;
804
805   /*!
806     Protected, api-specific method that attempts to open a device
807     with the given parameters.  This function MUST be implemented by
808     all subclasses.  If an error is encountered during the probe, a
809     "warning" message is reported and FAILURE is returned. A
810     successful probe is indicated by a return value of SUCCESS.
811   */
812   virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
813                                 unsigned int firstChannel, unsigned int sampleRate,
814                                 RtAudioFormat format, unsigned int *bufferSize,
815                                 RtAudio::StreamOptions *options );
816
817   //! A protected function used to increment the stream time.
818   void tickStreamTime( void );
819
820   //! Protected common method to clear an RtApiStream structure.
821   void clearStreamInfo();
822
823   /*!
824     Protected common method that throws an RtAudioError (type =
825     INVALID_USE) if a stream is not open.
826   */
827   void verifyStream( void );
828
829   //! Protected common error method to allow global control over error handling.
830   void error( RtAudioError::Type type );
831
832   /*!
833     Protected method used to perform format, channel number, and/or interleaving
834     conversions between the user and device buffers.
835   */
836   void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info );
837
838   //! Protected common method used to perform byte-swapping on buffers.
839   void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format );
840
841   //! Protected common method that returns the number of bytes for a given format.
842   unsigned int formatBytes( RtAudioFormat format );
843
844   //! Protected common method that sets up the parameters for buffer conversion.
845   void setConvertInfo( StreamMode mode, unsigned int firstChannel );
846 };
847
848 // **************************************************************** //
849 //
850 // Inline RtAudio definitions.
851 //
852 // **************************************************************** //
853
854 inline RtAudio::Api RtAudio :: getCurrentApi( void ) { return rtapi_->getCurrentApi(); }
855 inline unsigned int RtAudio :: getDeviceCount( void ) { return rtapi_->getDeviceCount(); }
856 inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
857 inline unsigned int RtAudio :: getDefaultInputDevice( void ) { return rtapi_->getDefaultInputDevice(); }
858 inline unsigned int RtAudio :: getDefaultOutputDevice( void ) { return rtapi_->getDefaultOutputDevice(); }
859 inline void RtAudio :: closeStream( void ) { return rtapi_->closeStream(); }
860 inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); }
861 inline void RtAudio :: stopStream( void )  { return rtapi_->stopStream(); }
862 inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
863 inline bool RtAudio :: isStreamOpen( void ) const { return rtapi_->isStreamOpen(); }
864 inline bool RtAudio :: isStreamRunning( void ) const { return rtapi_->isStreamRunning(); }
865 inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); }
866 inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }
867 inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); }
868 inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTime( time ); }
869 inline void RtAudio :: showWarnings( bool value ) { rtapi_->showWarnings( value ); }
870
871 // RtApi Subclass prototypes.
872
873 #if defined(__MACOSX_CORE__)
874
875 #include <CoreAudio/AudioHardware.h>
876
877 class RtApiCore: public RtApi
878 {
879 public:
880
881   RtApiCore();
882   ~RtApiCore();
883   RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; }
884   unsigned int getDeviceCount( void );
885   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
886   unsigned int getDefaultOutputDevice( void );
887   unsigned int getDefaultInputDevice( void );
888   void closeStream( void );
889   void startStream( void );
890   void stopStream( void );
891   void abortStream( void );
892   long getStreamLatency( void );
893
894   // This function is intended for internal use only.  It must be
895   // public because it is called by the internal callback handler,
896   // which is not a member of RtAudio.  External use of this function
897   // will most likely produce highly undesireable results!
898   bool callbackEvent( AudioDeviceID deviceId,
899                       const AudioBufferList *inBufferList,
900                       const AudioBufferList *outBufferList );
901
902   private:
903
904   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
905                         unsigned int firstChannel, unsigned int sampleRate,
906                         RtAudioFormat format, unsigned int *bufferSize,
907                         RtAudio::StreamOptions *options );
908   static const char* getErrorCode( OSStatus code );
909 };
910
911 #endif
912
913 #if defined(__UNIX_JACK__)
914
915 class RtApiJack: public RtApi
916 {
917 public:
918
919   RtApiJack();
920   ~RtApiJack();
921   RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; }
922   unsigned int getDeviceCount( void );
923   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
924   void closeStream( void );
925   void startStream( void );
926   void stopStream( void );
927   void abortStream( void );
928   long getStreamLatency( void );
929
930   // This function is intended for internal use only.  It must be
931   // public because it is called by the internal callback handler,
932   // which is not a member of RtAudio.  External use of this function
933   // will most likely produce highly undesireable results!
934   bool callbackEvent( unsigned long nframes );
935
936   private:
937
938   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
939                         unsigned int firstChannel, unsigned int sampleRate,
940                         RtAudioFormat format, unsigned int *bufferSize,
941                         RtAudio::StreamOptions *options );
942
943   bool shouldAutoconnect_;
944 };
945
946 #endif
947
948 #if defined(__WINDOWS_ASIO__)
949
950 class RtApiAsio: public RtApi
951 {
952 public:
953
954   RtApiAsio();
955   ~RtApiAsio();
956   RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; }
957   unsigned int getDeviceCount( void );
958   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
959   void closeStream( void );
960   void startStream( void );
961   void stopStream( void );
962   void abortStream( void );
963   long getStreamLatency( void );
964
965   // This function is intended for internal use only.  It must be
966   // public because it is called by the internal callback handler,
967   // which is not a member of RtAudio.  External use of this function
968   // will most likely produce highly undesireable results!
969   bool callbackEvent( long bufferIndex );
970
971   private:
972
973   std::vector<RtAudio::DeviceInfo> devices_;
974   void saveDeviceInfo( void );
975   bool coInitialized_;
976   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
977                         unsigned int firstChannel, unsigned int sampleRate,
978                         RtAudioFormat format, unsigned int *bufferSize,
979                         RtAudio::StreamOptions *options );
980 };
981
982 #endif
983
984 #if defined(__WINDOWS_DS__)
985
986 class RtApiDs: public RtApi
987 {
988 public:
989
990   RtApiDs();
991   ~RtApiDs();
992   RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; }
993   unsigned int getDeviceCount( void );
994   unsigned int getDefaultOutputDevice( void );
995   unsigned int getDefaultInputDevice( void );
996   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
997   void closeStream( void );
998   void startStream( void );
999   void stopStream( void );
1000   void abortStream( void );
1001   long getStreamLatency( void );
1002
1003   // This function is intended for internal use only.  It must be
1004   // public because it is called by the internal callback handler,
1005   // which is not a member of RtAudio.  External use of this function
1006   // will most likely produce highly undesireable results!
1007   void callbackEvent( void );
1008
1009   private:
1010
1011   bool coInitialized_;
1012   bool buffersRolling;
1013   long duplexPrerollBytes;
1014   std::vector<struct DsDevice> dsDevices;
1015   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
1016                         unsigned int firstChannel, unsigned int sampleRate,
1017                         RtAudioFormat format, unsigned int *bufferSize,
1018                         RtAudio::StreamOptions *options );
1019 };
1020
1021 #endif
1022
1023 #if defined(__WINDOWS_WASAPI__)
1024
1025 struct IMMDeviceEnumerator;
1026
1027 class RtApiWasapi : public RtApi
1028 {
1029 public:
1030   RtApiWasapi();
1031   ~RtApiWasapi();
1032
1033   RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; }
1034   unsigned int getDeviceCount( void );
1035   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1036   unsigned int getDefaultOutputDevice( void );
1037   unsigned int getDefaultInputDevice( void );
1038   void closeStream( void );
1039   void startStream( void );
1040   void stopStream( void );
1041   void abortStream( void );
1042
1043 private:
1044   bool coInitialized_;
1045   IMMDeviceEnumerator* deviceEnumerator_;
1046
1047   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1048                         unsigned int firstChannel, unsigned int sampleRate,
1049                         RtAudioFormat format, unsigned int* bufferSize,
1050                         RtAudio::StreamOptions* options );
1051
1052   static DWORD WINAPI runWasapiThread( void* wasapiPtr );
1053   static DWORD WINAPI stopWasapiThread( void* wasapiPtr );
1054   static DWORD WINAPI abortWasapiThread( void* wasapiPtr );
1055   void wasapiThread();
1056 };
1057
1058 #endif
1059
1060 #if defined(__LINUX_ALSA__)
1061
1062 class RtApiAlsa: public RtApi
1063 {
1064 public:
1065
1066   RtApiAlsa();
1067   ~RtApiAlsa();
1068   RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; }
1069   unsigned int getDeviceCount( void );
1070   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1071   void closeStream( void );
1072   void startStream( void );
1073   void stopStream( void );
1074   void abortStream( void );
1075
1076   // This function is intended for internal use only.  It must be
1077   // public because it is called by the internal callback handler,
1078   // which is not a member of RtAudio.  External use of this function
1079   // will most likely produce highly undesireable results!
1080   void callbackEvent( void );
1081
1082   private:
1083
1084   std::vector<RtAudio::DeviceInfo> devices_;
1085   void saveDeviceInfo( void );
1086   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
1087                         unsigned int firstChannel, unsigned int sampleRate,
1088                         RtAudioFormat format, unsigned int *bufferSize,
1089                         RtAudio::StreamOptions *options );
1090 };
1091
1092 #endif
1093
1094 #if defined(__LINUX_PULSE__)
1095
1096 class RtApiPulse: public RtApi
1097 {
1098 public:
1099   ~RtApiPulse();
1100   RtAudio::Api getCurrentApi() { return RtAudio::LINUX_PULSE; }
1101   unsigned int getDeviceCount( void );
1102   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1103   void closeStream( void );
1104   void startStream( void );
1105   void stopStream( void );
1106   void abortStream( void );
1107
1108   // This function is intended for internal use only.  It must be
1109   // public because it is called by the internal callback handler,
1110   // which is not a member of RtAudio.  External use of this function
1111   // will most likely produce highly undesireable results!
1112   void callbackEvent( void );
1113
1114   private:
1115
1116   std::vector<RtAudio::DeviceInfo> devices_;
1117   void saveDeviceInfo( void );
1118   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1119                         unsigned int firstChannel, unsigned int sampleRate,
1120                         RtAudioFormat format, unsigned int *bufferSize,
1121                         RtAudio::StreamOptions *options );
1122 };
1123
1124 #endif
1125
1126 #if defined(__LINUX_OSS__)
1127
1128 class RtApiOss: public RtApi
1129 {
1130 public:
1131
1132   RtApiOss();
1133   ~RtApiOss();
1134   RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; }
1135   unsigned int getDeviceCount( void );
1136   RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1137   void closeStream( void );
1138   void startStream( void );
1139   void stopStream( void );
1140   void abortStream( void );
1141
1142   // This function is intended for internal use only.  It must be
1143   // public because it is called by the internal callback handler,
1144   // which is not a member of RtAudio.  External use of this function
1145   // will most likely produce highly undesireable results!
1146   void callbackEvent( void );
1147
1148   private:
1149
1150   bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, 
1151                         unsigned int firstChannel, unsigned int sampleRate,
1152                         RtAudioFormat format, unsigned int *bufferSize,
1153                         RtAudio::StreamOptions *options );
1154 };
1155
1156 #endif
1157
1158 #if defined(__RTAUDIO_DUMMY__)
1159
1160 class RtApiDummy: public RtApi
1161 {
1162 public:
1163
1164   RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtAudioError::WARNING ); }
1165   RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; }
1166   unsigned int getDeviceCount( void ) { return 0; }
1167   RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) { RtAudio::DeviceInfo info; return info; }
1168   void closeStream( void ) {}
1169   void startStream( void ) {}
1170   void stopStream( void ) {}
1171   void abortStream( void ) {}
1172
1173   private:
1174
1175   bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/, 
1176                         unsigned int /*firstChannel*/, unsigned int /*sampleRate*/,
1177                         RtAudioFormat /*format*/, unsigned int * /*bufferSize*/,
1178                         RtAudio::StreamOptions * /*options*/ ) { return false; }
1179 };
1180
1181 #endif
1182
1183 #endif
1184
1185 // Indentation settings for Vim and Emacs
1186 //
1187 // Local Variables:
1188 // c-basic-offset: 2
1189 // indent-tabs-mode: nil
1190 // End:
1191 //
1192 // vim: et sts=2 sw=2