Upgrade to RtAudio v5.1.0

This commit is contained in:
vsonnier 2019-04-18 06:58:04 +02:00
parent d43f30f0c7
commit a000446610
3 changed files with 764 additions and 417 deletions

View File

@ -1,15 +1,19 @@
RtAudio - a set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO and WASAPI) operating systems.
# RtAudio
By Gary P. Scavone, 2001-2017 (and many other developers!)
[![Build Status](https://travis-ci.org/thestk/rtaudio.svg?branch=master)](https://travis-ci.org/thestk/rtaudio)
A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO and WASAPI) operating systems.
By Gary P. Scavone, 2001-2019 (and many other developers!)
This distribution of RtAudio contains the following:
doc: RtAudio documentation (see doc/html/index.html)
tests: example RtAudio programs
include: header and source files necessary for ASIO, DS & OSS compilation
tests/Windows: Visual C++ .net test program workspace and projects
- doc: RtAudio documentation (see doc/html/index.html)
- tests: example RtAudio programs
- include: header and source files necessary for ASIO, DS & OSS compilation
- tests/Windows: Visual C++ .net test program workspace and projects
OVERVIEW:
## Overview
RtAudio is a set of C++ classes that provides a common API (Application Programming Interface) for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X and Windows (DirectSound, ASIO and WASAPI) operating systems. RtAudio significantly simplifies the process of interacting with computer audio hardware. It was designed with the following objectives:
@ -24,17 +28,17 @@ RtAudio is a set of C++ classes that provides a common API (Application Programm
RtAudio incorporates the concept of audio streams, which represent audio output (playback) and/or input (recording). Available audio devices and their capabilities can be enumerated and then specified when opening a stream. Where applicable, multiple API support can be compiled and a particular API specified when creating an RtAudio instance. See the \ref apinotes section for information specific to each of the supported audio APIs.
FURTHER READING:
## Further Reading
For complete documentation on RtAudio, see the doc directory of the distribution or surf to http://www.music.mcgill.ca/~gary/rtaudio/.
LEGAL AND ETHICAL:
## Legal and ethical:
The RtAudio license is similar to the MIT License.
RtAudio: a set of realtime audio i/o C++ classes
Copyright (c) 2001-2017 Gary P. Scavone
Copyright (c) 2001-2019 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,11 @@
and OSS), Macintosh OS X (CoreAudio and Jack), and Windows
(DirectSound, ASIO and WASAPI) operating systems.
RtAudio GitHub site: https://github.com/thestk/rtaudio
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2017 Gary P. Scavone
Copyright (c) 2001-2019 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@ -45,7 +46,21 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
#define RTAUDIO_VERSION "5.0.0"
#define RTAUDIO_VERSION "5.1.0"
#if defined _WIN32 || defined __CYGWIN__
#if defined(RTAUDIO_EXPORT)
#define RTAUDIO_DLL_PUBLIC __declspec(dllexport)
#else
#define RTAUDIO_DLL_PUBLIC
#endif
#else
#if __GNUC__ >= 4
#define RTAUDIO_DLL_PUBLIC __attribute__( (visibility( "default" )) )
#else
#define RTAUDIO_DLL_PUBLIC
#endif
#endif
#include <string>
#include <vector>
@ -102,7 +117,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
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 Direct Sound, make this difficult).
(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
@ -179,6 +194,7 @@ static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output
\param userData A pointer to optional data provided by the client
when opening the stream (default = NULL).
\return
To continue normal stream operation, the RtAudioCallback function
should return a value of zero. To stop the stream and drain the
output buffer, the function should return a value of one. To abort
@ -200,7 +216,7 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
*/
/************************************************************************/
class RtAudioError : public std::runtime_error
class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
{
public:
//! Defined RtAudioError types.
@ -260,7 +276,7 @@ typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string
class RtApi;
class RtAudio
class RTAUDIO_DLL_PUBLIC RtAudio
{
public:
@ -274,8 +290,9 @@ class RtAudio
MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */
WINDOWS_WASAPI, /*!< The Microsoft WASAPI API. */
WINDOWS_ASIO, /*!< The Steinberg Audio Stream I/O API. */
WINDOWS_DS, /*!< The Microsoft Direct Sound API. */
RTAUDIO_DUMMY /*!< A compilable but non-functional API. */
WINDOWS_DS, /*!< The Microsoft DirectSound API. */
RTAUDIO_DUMMY, /*!< A compilable but non-functional API. */
NUM_APIS /*!< Number of values in this enum. */
};
//! The public device information structure for returning queried values.
@ -288,7 +305,7 @@ class RtAudio
bool isDefaultOutput; /*!< true if this is the default output device. */
bool isDefaultInput; /*!< true if this is the default input device. */
std::vector<unsigned int> sampleRates; /*!< Supported sample rates (queried from list of standard rates). */
unsigned int preferredSampleRate; /*!< Preferred sample rate, eg. for WASAPI the system sample rate. */
unsigned int preferredSampleRate; /*!< Preferred sample rate, e.g. for WASAPI the system sample rate. */
RtAudioFormat nativeFormats; /*!< Bit mask of supported data formats. */
// Default constructor.
@ -333,7 +350,7 @@ class RtAudio
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 Direct Sound, make this difficult).
(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
@ -387,6 +404,29 @@ class RtAudio
*/
static void getCompiledApi( std::vector<RtAudio::Api> &apis );
//! Return the name of a specified compiled audio API.
/*!
This obtains a short lower-case name used for identification purposes.
This value is guaranteed to remain identical across library versions.
If the API is unknown, this function will return the empty string.
*/
static std::string getApiName( RtAudio::Api api );
//! Return the display name of a specified compiled audio API.
/*!
This obtains a long name used for display purposes.
If the API is unknown, this function will return the empty string.
*/
static std::string getApiDisplayName( RtAudio::Api api );
//! Return the compiled audio API having the given name.
/*!
A case insensitive comparison will check the specified name
against the list of compiled APIs, and return the one which
matches. On failure, the function returns UNSPECIFIED.
*/
static RtAudio::Api getCompiledApiByName( const std::string &name );
//! The class constructor.
/*!
The constructor performs minor initialization tasks. An exception
@ -583,6 +623,7 @@ class RtAudio
#endif
#include <windows.h>
#include <process.h>
#include <stdint.h>
typedef uintptr_t ThreadHandle;
typedef CRITICAL_SECTION StreamMutex;
@ -651,7 +692,6 @@ class S24 {
return *this;
}
S24( const S24& v ) { *this = v; }
S24( const double& d ) { *this = (int) d; }
S24( const float& f ) { *this = (int) f; }
S24( const signed short& s ) { *this = (int) s; }
@ -671,7 +711,7 @@ class S24 {
#include <sstream>
class RtApi
class RTAUDIO_DLL_PUBLIC RtApi
{
public:
@ -864,7 +904,6 @@ public:
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
@ -900,7 +939,6 @@ public:
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
@ -935,7 +973,6 @@ public:
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
@ -973,7 +1010,6 @@ public:
void startStream( void );
void stopStream( void );
void abortStream( void );
long getStreamLatency( void );
// This function is intended for internal use only. It must be
// public because it is called by the internal callback handler,
@ -1003,7 +1039,7 @@ class RtApiWasapi : public RtApi
{
public:
RtApiWasapi();
~RtApiWasapi();
virtual ~RtApiWasapi();
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; }
unsigned int getDeviceCount( void );