Version 4.2.0

This commit is contained in:
Gary Scavone
2009-03-24 23:02:14 -04:00
committed by Stephen Sinclair
parent cf06b7598b
commit a6381b9d38
281 changed files with 17152 additions and 12000 deletions

View File

@@ -9,7 +9,7 @@
RtAudio WWW site: http://music.mcgill.ca/~gary/rtaudio/
RtAudio: a realtime audio i/o C++ class
RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2004 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
@@ -37,7 +37,7 @@
*/
/************************************************************************/
// RtAudio: Version 3.0.1, 22 March 2004
// RtAudio: Version 3.0.2, pre-release for STK 4.2.0
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
@@ -127,17 +127,27 @@ class RtApi
{
public:
enum StreamState {
STREAM_STOPPED,
STREAM_RUNNING
};
RtApi();
virtual ~RtApi();
void openStream( int outputDevice, int outputChannels,
int inputDevice, int inputChannels,
RtAudioFormat format, int sampleRate,
int *bufferSize, int numberOfBuffers );
void openStream( int outputDevice, int outputChannels,
int inputDevice, int inputChannels,
RtAudioFormat format, int sampleRate,
int *bufferSize, int *numberOfBuffers );
virtual void setStreamCallback( RtAudioCallback callback, void *userData ) = 0;
virtual void cancelStreamCallback() = 0;
int getDeviceCount(void);
RtAudioDeviceInfo getDeviceInfo( int device );
char * const getStreamBuffer();
RtApi::StreamState getStreamState() const;
virtual void tickStream() = 0;
virtual void closeStream();
virtual void startStream() = 0;
@@ -158,9 +168,13 @@ protected:
UNINITIALIZED = -75
};
enum StreamState {
STREAM_STOPPED,
STREAM_RUNNING
// A protected structure used for buffer conversion.
struct ConvertInfo {
int channels;
int inJump, outJump;
RtAudioFormat inFormat, outFormat;
std::vector<int> inOffset;
std::vector<int> outOffset;
};
// A protected structure for audio streams.
@@ -183,10 +197,10 @@ protected:
RtAudioFormat deviceFormat[2]; // Playback and record, respectively.
StreamMutex mutex;
CallbackInfo callbackInfo;
ConvertInfo convertInfo[2];
RtApiStream()
:apiHandle(0), userBuffer(0), deviceBuffer(0) {}
// mode(UNINITIALIZED), state(STREAM_STOPPED),
};
// A protected device structure for audio devices.
@@ -217,7 +231,7 @@ protected:
typedef float Float32;
typedef double Float64;
char message_[256];
char message_[1024];
int nDevices_;
std::vector<RtApiDevice> devices_;
RtApiStream stream_;
@@ -281,7 +295,7 @@ protected:
Protected method used to perform format, channel number, and/or interleaving
conversions between the user and device buffers.
*/
void convertStreamBuffer( StreamMode mode );
void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info );
//! Protected common method used to perform byte-swapping on buffers.
void byteSwapBuffer( char *buffer, int samples, RtAudioFormat format );
@@ -350,6 +364,20 @@ public:
RtAudioFormat format, int sampleRate,
int *bufferSize, int numberOfBuffers, RtAudioApi api=UNSPECIFIED );
//! An overloaded constructor which opens a stream and also returns \c numberOfBuffers parameter via pointer argument.
/*!
See the previous constructor call for details. This overloaded
version differs only in that it takes a pointer argument for the
\c numberOfBuffers parameter and returns the value used by the
audio device (which may be different from that requested). Note
that the \c numberofBuffers parameter is not used with the Linux
Jack, Macintosh CoreAudio, and Windows ASIO APIs.
*/
RtAudio( int outputDevice, int outputChannels,
int inputDevice, int inputChannels,
RtAudioFormat format, int sampleRate,
int *bufferSize, int *numberOfBuffers, RtAudioApi api=UNSPECIFIED );
//! The destructor.
/*!
Stops and closes an open stream and devices and deallocates
@@ -389,6 +417,20 @@ public:
RtAudioFormat format, int sampleRate,
int *bufferSize, int numberOfBuffers );
//! A public method for opening a stream and also returning \c numberOfBuffers parameter via pointer argument.
/*!
See the previous function call for details. This overloaded
version differs only in that it takes a pointer argument for the
\c numberOfBuffers parameter and returns the value used by the
audio device (which may be different from that requested). Note
that the \c numberofBuffers parameter is not used with the Linux
Jack, Macintosh CoreAudio, and Windows ASIO APIs.
*/
void openStream( int outputDevice, int outputChannels,
int inputDevice, int inputChannels,
RtAudioFormat format, int sampleRate,
int *bufferSize, int *numberOfBuffers );
//! A public method which sets a user-defined callback function for a given stream.
/*!
This method assigns a callback function to a previously opened