diff options
Diffstat (limited to '3rdparty/portaudio/bindings/cpp/include')
20 files changed, 794 insertions, 802 deletions
diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx index 26957c4f35b..ba40481ae9d 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx @@ -4,41 +4,41 @@ namespace portaudio { - // Forward declaration(s): - class Device; - - // Declaration(s): - ////// - /// @brief Adapts the given Device to an ASIO specific extension. - /// - /// Deleting the AsioDeviceAdapter does not affect the underlaying - /// Device. - ////// - class AsioDeviceAdapter - { - public: - AsioDeviceAdapter(Device &device); - - Device &device(); - - long minBufferSize() const; - long maxBufferSize() const; - long preferredBufferSize() const; - long granularity() const; - - void showControlPanel(void *systemSpecific); - - const char *inputChannelName(int channelIndex) const; - const char *outputChannelName(int channelIndex) const; - - private: - Device *device_; - - long minBufferSize_; - long maxBufferSize_; - long preferredBufferSize_; - long granularity_; - }; + // Forward declaration(s): + class Device; + + // Declaration(s): + ////// + /// @brief Adapts the given Device to an ASIO specific extension. + /// + /// Deleting the AsioDeviceAdapter does not affect the underlying + /// Device. + ////// + class AsioDeviceAdapter + { + public: + AsioDeviceAdapter(Device &device); + + Device &device(); + + long minBufferSize() const; + long maxBufferSize() const; + long preferredBufferSize() const; + long granularity() const; + + void showControlPanel(void *systemSpecific); + + const char *inputChannelName(int channelIndex) const; + const char *outputChannelName(int channelIndex) const; + + private: + Device *device_; + + long minBufferSize_; + long maxBufferSize_; + long preferredBufferSize_; + long granularity_; + }; } #endif // INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AutoSystem.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AutoSystem.hxx index 47e2ec1d53b..be4da1a06ff 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AutoSystem.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/AutoSystem.hxx @@ -11,48 +11,48 @@ namespace portaudio { - ////// - /// @brief A RAII idiom class to ensure automatic clean-up when an exception is - /// raised. - /// - /// A simple helper class which uses the 'Resource Acquisition is Initialization' - /// idiom (RAII). Use this class to initialize/terminate the System rather than - /// using System directly. AutoSystem must be created on stack and must be valid - /// throughout the time you wish to use PortAudioCpp. Your 'main' function might be - /// a good place for it. - /// - /// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually - /// a good idea to make a reference to the System which can be accessed directly. - /// @verbatim - /// portaudio::AutoSys autoSys; - /// portaudio::System &sys = portaudio::System::instance(); - /// @endverbatim - ////// - class AutoSystem - { - public: - AutoSystem(bool initialize = true) - { - if (initialize) - System::initialize(); - } - - ~AutoSystem() - { - if (System::exists()) - System::terminate(); - } - - void initialize() - { - System::initialize(); - } - - void terminate() - { - System::terminate(); - } - }; + ////// + /// @brief A RAII idiom class to ensure automatic clean-up when an exception is + /// raised. + /// + /// A simple helper class which uses the 'Resource Acquisition is Initialization' + /// idiom (RAII). Use this class to initialize/terminate the System rather than + /// using System directly. AutoSystem must be created on stack and must be valid + /// throughout the time you wish to use PortAudioCpp. Your 'main' function might be + /// a good place for it. + /// + /// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually + /// a good idea to make a reference to the System which can be accessed directly. + /// @verbatim + /// portaudio::AutoSys autoSys; + /// portaudio::System &sys = portaudio::System::instance(); + /// @endverbatim + ////// + class AutoSystem + { + public: + AutoSystem(bool initialize = true) + { + if (initialize) + System::initialize(); + } + + ~AutoSystem() + { + if (System::exists()) + System::terminate(); + } + + void initialize() + { + System::initialize(); + } + + void terminate() + { + System::terminate(); + } + }; } // namespace portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/BlockingStream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/BlockingStream.hxx index 158dfa08ded..c1bcac7d9ce 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/BlockingStream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/BlockingStream.hxx @@ -12,28 +12,28 @@ namespace portaudio - ////// - /// @brief Stream class for blocking read/write-style input and output. - ////// - class BlockingStream : public Stream - { - public: - BlockingStream(); - BlockingStream(const StreamParameters ¶meters); - ~BlockingStream(); + ////// + /// @brief Stream class for blocking read/write-style input and output. + ////// + class BlockingStream : public Stream + { + public: + BlockingStream(); + BlockingStream(const StreamParameters ¶meters); + ~BlockingStream(); - void open(const StreamParameters ¶meters); + void open(const StreamParameters ¶meters); - void read(void *buffer, unsigned long numFrames); - void write(const void *buffer, unsigned long numFrames); + void read(void *buffer, unsigned long numFrames); + void write(const void *buffer, unsigned long numFrames); - signed long availableReadSize() const; - signed long availableWriteSize() const; + signed long availableReadSize() const; + signed long availableWriteSize() const; - private: - BlockingStream(const BlockingStream &); // non-copyable - BlockingStream &operator=(const BlockingStream &); // non-copyable - }; + private: + BlockingStream(const BlockingStream &); // non-copyable + BlockingStream &operator=(const BlockingStream &); // non-copyable + }; @@ -42,4 +42,3 @@ namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx index 1c7faa8684f..d66996c9e7e 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx @@ -12,7 +12,7 @@ // Forward declaration(s) namespace portaudio { - class StreamParameters; + class StreamParameters; } // --------------------------------------------------------------------------------------- @@ -20,30 +20,29 @@ namespace portaudio // Declaration(s): namespace portaudio { - // ----------------------------------------------------------------------------------- - - ////// - /// @brief Callback stream using a free function with C linkage. It's important that the function - /// the passed function pointer points to is declared ``extern "C"''. - ////// - class CFunCallbackStream : public CallbackStream - { - public: - CFunCallbackStream(); - CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); - ~CFunCallbackStream(); - - void open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); - - private: - CFunCallbackStream(const CFunCallbackStream &); // non-copyable - CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable - }; - - // ----------------------------------------------------------------------------------- + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Callback stream using a free function with C linkage. It's important that the function + /// the passed function pointer points to is declared ``extern "C"''. + ////// + class CFunCallbackStream : public CallbackStream + { + public: + CFunCallbackStream(); + CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); + ~CFunCallbackStream(); + + void open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); + + private: + CFunCallbackStream(const CFunCallbackStream &); // non-copyable + CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable + }; + + // ----------------------------------------------------------------------------------- } // portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx index b30614899da..9cf3fad51b9 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx @@ -9,34 +9,34 @@ namespace portaudio { - // ----------------------------------------------------------------------------------- - - ////// - /// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the - /// paCallbackFun method). - ////// - class CallbackInterface - { - public: - virtual ~CallbackInterface() {} - - virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0; - }; - - // ----------------------------------------------------------------------------------- - - namespace impl - { - extern "C" - { - int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, - void *userData); - } // extern "C" - } - - // ----------------------------------------------------------------------------------- + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the + /// paCallbackFun method). + ////// + class CallbackInterface + { + public: + virtual ~CallbackInterface() {} + + virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0; + }; + + // ----------------------------------------------------------------------------------- + + namespace impl + { + extern "C" + { + int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, + void *userData); + } // extern "C" + } + + // ----------------------------------------------------------------------------------- } // namespace portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackStream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackStream.hxx index 7268b14d3a8..bb8f3810c24 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackStream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CallbackStream.hxx @@ -14,23 +14,23 @@ namespace portaudio { - ////// - /// @brief Base class for all Streams which use a callback-based mechanism. - ////// - class CallbackStream : public Stream - { - protected: - CallbackStream(); - virtual ~CallbackStream(); - - public: - // stream info (time-varying) - double cpuLoad() const; - - private: - CallbackStream(const CallbackStream &); // non-copyable - CallbackStream &operator=(const CallbackStream &); // non-copyable - }; + ////// + /// @brief Base class for all Streams which use a callback-based mechanism. + ////// + class CallbackStream : public Stream + { + protected: + CallbackStream(); + virtual ~CallbackStream(); + + public: + // stream info (time-varying) + double cpuLoad() const; + + private: + CallbackStream(const CallbackStream &); // non-copyable + CallbackStream &operator=(const CallbackStream &); // non-copyable + }; } // namespace portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx index 3f219eef87f..c43b64316d1 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx @@ -12,7 +12,7 @@ // Forward declaration(s): namespace portaudio { - class StreamParameters; + class StreamParameters; } // --------------------------------------------------------------------------------------- @@ -22,61 +22,61 @@ namespace portaudio { - namespace impl - { - extern "C" - { - int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, - void *userData); - } // extern "C" - } - - // ----------------------------------------------------------------------------------- - - ////// - /// @brief Callback stream using a C++ function (either a free function or a static function) - /// callback. - ////// - class FunCallbackStream : public CallbackStream - { - public: - typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, - void *userData); - - // ------------------------------------------------------------------------------- - - ////// - /// @brief Simple structure containing a function pointer to the C++ callback function and a - /// (void) pointer to the user supplied data. - ////// - struct CppToCCallbackData - { - CppToCCallbackData(); - CppToCCallbackData(CallbackFunPtr funPtr, void *userData); - void init(CallbackFunPtr funPtr, void *userData); - - CallbackFunPtr funPtr; - void *userData; - }; - - // ------------------------------------------------------------------------------- - - FunCallbackStream(); - FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); - ~FunCallbackStream(); - - void open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); - - private: - FunCallbackStream(const FunCallbackStream &); // non-copyable - FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable - - CppToCCallbackData adapterData_; - - void open(const StreamParameters ¶meters); - }; + namespace impl + { + extern "C" + { + int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, + void *userData); + } // extern "C" + } + + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Callback stream using a C++ function (either a free function or a static function) + /// callback. + ////// + class FunCallbackStream : public CallbackStream + { + public: + typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, + void *userData); + + // ------------------------------------------------------------------------------- + + ////// + /// @brief Simple structure containing a function pointer to the C++ callback function and a + /// (void) pointer to the user supplied data. + ////// + struct CppToCCallbackData + { + CppToCCallbackData(); + CppToCCallbackData(CallbackFunPtr funPtr, void *userData); + void init(CallbackFunPtr funPtr, void *userData); + + CallbackFunPtr funPtr; + void *userData; + }; + + // ------------------------------------------------------------------------------- + + FunCallbackStream(); + FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); + ~FunCallbackStream(); + + void open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); + + private: + FunCallbackStream(const FunCallbackStream &); // non-copyable + FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable + + CppToCCallbackData adapterData_; + + void open(const StreamParameters ¶meters); + }; } // portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Device.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Device.hxx index 3c6c3c0c74f..2b21361beeb 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Device.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Device.hxx @@ -14,8 +14,8 @@ // Forward declaration(s): namespace portaudio { - class System; - class HostApi; + class System; + class HostApi; } // --------------------------------------------------------------------------------------- @@ -24,68 +24,67 @@ namespace portaudio namespace portaudio { - ////// - /// @brief Class which represents a PortAudio device in the System. - /// - /// A single physical device in the system may have multiple PortAudio - /// Device representations using different HostApi 's though. A Device - /// can be half-duplex or full-duplex. A half-duplex Device can be used - /// to create a half-duplex Stream. A full-duplex Device can be used to - /// create a full-duplex Stream. If supported by the HostApi, two - /// half-duplex Devices can even be used to create a full-duplex Stream. - /// - /// Note that Device objects are very light-weight and can be passed around - /// by-value. - ////// - class Device - { - public: - // query info: name, max in channels, max out channels, - // default low/hight input/output latency, default sample rate - PaDeviceIndex index() const; - const char *name() const; - int maxInputChannels() const; - int maxOutputChannels() const; - PaTime defaultLowInputLatency() const; - PaTime defaultHighInputLatency() const; - PaTime defaultLowOutputLatency() const; - PaTime defaultHighOutputLatency() const; - double defaultSampleRate() const; - - bool isInputOnlyDevice() const; // extended - bool isOutputOnlyDevice() const; // extended - bool isFullDuplexDevice() const; // extended - bool isSystemDefaultInputDevice() const; // extended - bool isSystemDefaultOutputDevice() const; // extended - bool isHostApiDefaultInputDevice() const; // extended - bool isHostApiDefaultOutputDevice() const; // extended - - bool operator==(const Device &rhs) const; - bool operator!=(const Device &rhs) const; - - // host api reference - HostApi &hostApi(); - const HostApi &hostApi() const; - - private: - PaDeviceIndex index_; - const PaDeviceInfo *info_; - - private: - friend class System; - - explicit Device(PaDeviceIndex index); - ~Device(); - - Device(const Device &); // non-copyable - Device &operator=(const Device &); // non-copyable - }; - - // ----------------------------------------------------------------------------------- + ////// + /// @brief Class which represents a PortAudio device in the System. + /// + /// A single physical device in the system may have multiple PortAudio + /// Device representations using different HostApi 's though. A Device + /// can be half-duplex or full-duplex. A half-duplex Device can be used + /// to create a half-duplex Stream. A full-duplex Device can be used to + /// create a full-duplex Stream. If supported by the HostApi, two + /// half-duplex Devices can even be used to create a full-duplex Stream. + /// + /// Note that Device objects are very light-weight and can be passed around + /// by-value. + ////// + class Device + { + public: + // query info: name, max in channels, max out channels, + // default low/high input/output latency, default sample rate + PaDeviceIndex index() const; + const char *name() const; + int maxInputChannels() const; + int maxOutputChannels() const; + PaTime defaultLowInputLatency() const; + PaTime defaultHighInputLatency() const; + PaTime defaultLowOutputLatency() const; + PaTime defaultHighOutputLatency() const; + double defaultSampleRate() const; + + bool isInputOnlyDevice() const; // extended + bool isOutputOnlyDevice() const; // extended + bool isFullDuplexDevice() const; // extended + bool isSystemDefaultInputDevice() const; // extended + bool isSystemDefaultOutputDevice() const; // extended + bool isHostApiDefaultInputDevice() const; // extended + bool isHostApiDefaultOutputDevice() const; // extended + + bool operator==(const Device &rhs) const; + bool operator!=(const Device &rhs) const; + + // host api reference + HostApi &hostApi(); + const HostApi &hostApi() const; + + private: + PaDeviceIndex index_; + const PaDeviceInfo *info_; + + private: + friend class System; + + explicit Device(PaDeviceIndex index); + ~Device(); + + Device(const Device &); // non-copyable + Device &operator=(const Device &); // non-copyable + }; + + // ----------------------------------------------------------------------------------- } // namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_DEVICE_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx index bc2474269e1..d09a7c58544 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx @@ -15,7 +15,7 @@ // Forward declaration(s): namespace portaudio { - class Device; + class Device; } // --------------------------------------------------------------------------------------- @@ -24,50 +24,50 @@ namespace portaudio namespace portaudio { - ////// - /// @brief All parameters for one direction (either in or out) of a Stream. Together with - /// parameters common to both directions, two DirectionSpecificStreamParameters can make up - /// a StreamParameters object which contains all parameters for a Stream. - ////// - class DirectionSpecificStreamParameters - { - public: - static DirectionSpecificStreamParameters null(); + ////// + /// @brief All parameters for one direction (either in or out) of a Stream. Together with + /// parameters common to both directions, two DirectionSpecificStreamParameters can make up + /// a StreamParameters object which contains all parameters for a Stream. + ////// + class DirectionSpecificStreamParameters + { + public: + static DirectionSpecificStreamParameters null(); - DirectionSpecificStreamParameters(); - DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format, - bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo); + DirectionSpecificStreamParameters(); + DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format, + bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo); - // Set up methods: - void setDevice(const Device &device); - void setNumChannels(int numChannels); + // Set up methods: + void setDevice(const Device &device); + void setNumChannels(int numChannels); - void setSampleFormat(SampleDataFormat format, bool interleaved = true); - void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true); + void setSampleFormat(SampleDataFormat format, bool interleaved = true); + void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true); - void setSuggestedLatency(PaTime latency); + void setSuggestedLatency(PaTime latency); - void setHostApiSpecificStreamInfo(void *streamInfo); + void setHostApiSpecificStreamInfo(void *streamInfo); - // Accessor methods: - PaStreamParameters *paStreamParameters(); - const PaStreamParameters *paStreamParameters() const; + // Accessor methods: + PaStreamParameters *paStreamParameters(); + const PaStreamParameters *paStreamParameters() const; - Device &device() const; - int numChannels() const; + Device &device() const; + int numChannels() const; - SampleDataFormat sampleFormat() const; - bool isSampleFormatInterleaved() const; - bool isSampleFormatHostApiSpecific() const; - PaSampleFormat hostApiSpecificSampleFormat() const; + SampleDataFormat sampleFormat() const; + bool isSampleFormatInterleaved() const; + bool isSampleFormatHostApiSpecific() const; + PaSampleFormat hostApiSpecificSampleFormat() const; - PaTime suggestedLatency() const; + PaTime suggestedLatency() const; - void *hostApiSpecificStreamInfo() const; - - private: - PaStreamParameters paStreamParameters_; - }; + void *hostApiSpecificStreamInfo() const; + + private: + PaStreamParameters paStreamParameters_; + }; } // namespace portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Exception.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Exception.hxx index f5249c97942..908de4cc1f0 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Exception.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Exception.hxx @@ -12,92 +12,92 @@ namespace portaudio { - ////// - /// @brief Base class for all exceptions PortAudioCpp can throw. - /// - /// Class is derived from std::exception. - ////// - class Exception : public std::exception - { - public: - virtual ~Exception() throw() {} - - virtual const char *what() const throw() = 0; - }; - - // ----------------------------------------------------------------------------------- - - ////// - /// @brief Wrapper for PortAudio error codes to C++ exceptions. - /// - /// It wraps up PortAudio's error handling mechanism using - /// C++ exceptions and is derived from std::exception for - /// easy exception handling and to ease integration with - /// other code. - /// - /// To know what exceptions each function may throw, look up - /// the errors that can occure in the PortAudio documentation - /// for the equivalent functions. - /// - /// Some functions are likely to throw an exception (such as - /// Stream::open(), etc) and these should always be called in - /// try{} catch{} blocks and the thrown exceptions should be - /// handled properly (ie. the application shouldn't just abort, - /// but merely display a warning dialog to the user or something). - /// However nearly all functions in PortAudioCpp are capable - /// of throwing exceptions. When a function like Stream::isStopped() - /// throws an exception, it's such an exceptional state that it's - /// not likely that it can be recovered. PaExceptions such as these - /// can ``safely'' be left to be handled by some outer catch-all-like - /// mechanism for unrecoverable errors. - ////// - class PaException : public Exception - { - public: - explicit PaException(PaError error); - - const char *what() const throw(); - - PaError paError() const; - const char *paErrorText() const; - - bool isHostApiError() const; // extended - long lastHostApiError() const; - const char *lastHostApiErrorText() const; - - bool operator==(const PaException &rhs) const; - bool operator!=(const PaException &rhs) const; - - private: - PaError error_; - }; - - // ----------------------------------------------------------------------------------- - - ////// - /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an - /// equivalent PortAudio error code). - ////// - class PaCppException : public Exception - { - public: - enum ExceptionSpecifier - { - UNABLE_TO_ADAPT_DEVICE - }; - - PaCppException(ExceptionSpecifier specifier); - - const char *what() const throw(); - - ExceptionSpecifier specifier() const; - - bool operator==(const PaCppException &rhs) const; - bool operator!=(const PaCppException &rhs) const; - - private: - ExceptionSpecifier specifier_; - }; + ////// + /// @brief Base class for all exceptions PortAudioCpp can throw. + /// + /// Class is derived from std::exception. + ////// + class Exception : public std::exception + { + public: + virtual ~Exception() throw() {} + + virtual const char *what() const throw() = 0; + }; + + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Wrapper for PortAudio error codes to C++ exceptions. + /// + /// It wraps up PortAudio's error handling mechanism using + /// C++ exceptions and is derived from std::exception for + /// easy exception handling and to ease integration with + /// other code. + /// + /// To know what exceptions each function may throw, look up + /// the errors that can occur in the PortAudio documentation + /// for the equivalent functions. + /// + /// Some functions are likely to throw an exception (such as + /// Stream::open(), etc) and these should always be called in + /// try{} catch{} blocks and the thrown exceptions should be + /// handled properly (ie. the application shouldn't just abort, + /// but merely display a warning dialog to the user or something). + /// However nearly all functions in PortAudioCpp are capable + /// of throwing exceptions. When a function like Stream::isStopped() + /// throws an exception, it's such an exceptional state that it's + /// not likely that it can be recovered. PaExceptions such as these + /// can ``safely'' be left to be handled by some outer catch-all-like + /// mechanism for unrecoverable errors. + ////// + class PaException : public Exception + { + public: + explicit PaException(PaError error); + + const char *what() const throw(); + + PaError paError() const; + const char *paErrorText() const; + + bool isHostApiError() const; // extended + long lastHostApiError() const; + const char *lastHostApiErrorText() const; + + bool operator==(const PaException &rhs) const; + bool operator!=(const PaException &rhs) const; + + private: + PaError error_; + }; + + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an + /// equivalent PortAudio error code). + ////// + class PaCppException : public Exception + { + public: + enum ExceptionSpecifier + { + UNABLE_TO_ADAPT_DEVICE + }; + + PaCppException(ExceptionSpecifier specifier); + + const char *what() const throw(); + + ExceptionSpecifier specifier() const; + + bool operator==(const PaCppException &rhs) const; + bool operator!=(const PaCppException &rhs) const; + + private: + ExceptionSpecifier specifier_; + }; } // namespace portaudio @@ -105,4 +105,3 @@ namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/HostApi.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/HostApi.hxx index ce397ca6c75..5020793b9a2 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/HostApi.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/HostApi.hxx @@ -12,7 +12,7 @@ // Forward declaration(s): namespace portaudio { - class Device; + class Device; } // --------------------------------------------------------------------------------------- @@ -22,50 +22,50 @@ namespace portaudio { - ////// - /// @brief HostApi represents a host API (usually type of driver) in the System. - /// - /// A single System can support multiple HostApi's each one typically having - /// a set of Devices using that HostApi (usually driver type). All Devices in - /// the HostApi can be enumerated and the default input/output Device for this - /// HostApi can be retreived. - ////// - class HostApi - { - public: - typedef System::DeviceIterator DeviceIterator; + ////// + /// @brief HostApi represents a host API (usually type of driver) in the System. + /// + /// A single System can support multiple HostApi's each one typically having + /// a set of Devices using that HostApi (usually driver type). All Devices in + /// the HostApi can be enumerated and the default input/output Device for this + /// HostApi can be retrieved. + ////// + class HostApi + { + public: + typedef System::DeviceIterator DeviceIterator; - // query info: id, name, numDevices - PaHostApiTypeId typeId() const; - PaHostApiIndex index() const; - const char *name() const; - int deviceCount() const; + // query info: id, name, numDevices + PaHostApiTypeId typeId() const; + PaHostApiIndex index() const; + const char *name() const; + int deviceCount() const; - // iterate devices - DeviceIterator devicesBegin(); - DeviceIterator devicesEnd(); + // iterate devices + DeviceIterator devicesBegin(); + DeviceIterator devicesEnd(); - // default devices - Device &defaultInputDevice() const; - Device &defaultOutputDevice() const; + // default devices + Device &defaultInputDevice() const; + Device &defaultOutputDevice() const; - // comparison operators - bool operator==(const HostApi &rhs) const; - bool operator!=(const HostApi &rhs) const; + // comparison operators + bool operator==(const HostApi &rhs) const; + bool operator!=(const HostApi &rhs) const; - private: - const PaHostApiInfo *info_; - Device **devices_; + private: + const PaHostApiInfo *info_; + Device **devices_; - private: - friend class System; + private: + friend class System; - explicit HostApi(PaHostApiIndex index); - ~HostApi(); + explicit HostApi(PaHostApiIndex index); + ~HostApi(); - HostApi(const HostApi &); // non-copyable - HostApi &operator=(const HostApi &); // non-copyable - }; + HostApi(const HostApi &); // non-copyable + HostApi &operator=(const HostApi &); // non-copyable + }; } @@ -73,4 +73,3 @@ namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx index 5aa49e741cf..63ebf40b596 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx @@ -12,8 +12,8 @@ // Forward declaration(s) namespace portaudio { - class StreamParameters; - class CallbackInterface; + class StreamParameters; + class CallbackInterface; } // --------------------------------------------------------------------------------------- @@ -23,23 +23,23 @@ namespace portaudio { - ////// - /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface - /// interface. - ////// - class InterfaceCallbackStream : public CallbackStream - { - public: - InterfaceCallbackStream(); - InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance); - ~InterfaceCallbackStream(); - - void open(const StreamParameters ¶meters, CallbackInterface &instance); - - private: - InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable - InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable - }; + ////// + /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface + /// interface. + ////// + class InterfaceCallbackStream : public CallbackStream + { + public: + InterfaceCallbackStream(); + InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance); + ~InterfaceCallbackStream(); + + void open(const StreamParameters ¶meters, CallbackInterface &instance); + + private: + InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable + InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable + }; } // portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx index 01cf37b2016..7ef1d4a3c36 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx @@ -17,87 +17,87 @@ namespace portaudio { - ////// - /// @brief Callback stream using a class's member function as a callback. Template argument T is the type of the - /// class of which a member function is going to be used. - /// - /// Example usage: - /// @verbatim MemFunCallback<MyClass> stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim - ////// - template<typename T> - class MemFunCallbackStream : public CallbackStream - { - public: - typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *, - PaStreamCallbackFlags); - - // ------------------------------------------------------------------------------- - - MemFunCallbackStream() - { - } - - MemFunCallbackStream(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun) - { - open(parameters); - } - - ~MemFunCallbackStream() - { - close(); - } - - void open(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) - { - // XXX: need to check if already open? - - adapter_.init(instance, memFun); - open(parameters); - } - - private: - MemFunCallbackStream(const MemFunCallbackStream &); // non-copyable - MemFunCallbackStream &operator=(const MemFunCallbackStream &); // non-copyable - - ////// - /// @brief Inner class which adapts a member function callback to a CallbackInterface compliant - /// class (so it can be adapted using the paCallbackAdapter function). - ////// - class MemFunToCallbackInterfaceAdapter : public CallbackInterface - { - public: - MemFunToCallbackInterfaceAdapter() {} - MemFunToCallbackInterfaceAdapter(T &instance, CallbackFunPtr memFun) : instance_(&instance), memFun_(memFun) {} - - void init(T &instance, CallbackFunPtr memFun) - { - instance_ = &instance; - memFun_ = memFun; - } - - int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, - const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) - { - return (instance_->*memFun_)(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags); - } - - private: - T *instance_; - CallbackFunPtr memFun_; - }; - - MemFunToCallbackInterfaceAdapter adapter_; - - void open(const StreamParameters ¶meters) - { - PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), - parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, - static_cast<void *>(&adapter_)); - - if (err != paNoError) - throw PaException(err); - } - }; + ////// + /// @brief Callback stream using a class's member function as a callback. Template argument T is the type of the + /// class of which a member function is going to be used. + /// + /// Example usage: + /// @verbatim MemFunCallback<MyClass> stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim + ////// + template<typename T> + class MemFunCallbackStream : public CallbackStream + { + public: + typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *, + PaStreamCallbackFlags); + + // ------------------------------------------------------------------------------- + + MemFunCallbackStream() + { + } + + MemFunCallbackStream(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun) + { + open(parameters); + } + + ~MemFunCallbackStream() + { + close(); + } + + void open(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) + { + // XXX: need to check if already open? + + adapter_.init(instance, memFun); + open(parameters); + } + + private: + MemFunCallbackStream(const MemFunCallbackStream &); // non-copyable + MemFunCallbackStream &operator=(const MemFunCallbackStream &); // non-copyable + + ////// + /// @brief Inner class which adapts a member function callback to a CallbackInterface compliant + /// class (so it can be adapted using the paCallbackAdapter function). + ////// + class MemFunToCallbackInterfaceAdapter : public CallbackInterface + { + public: + MemFunToCallbackInterfaceAdapter() {} + MemFunToCallbackInterfaceAdapter(T &instance, CallbackFunPtr memFun) : instance_(&instance), memFun_(memFun) {} + + void init(T &instance, CallbackFunPtr memFun) + { + instance_ = &instance; + memFun_ = memFun; + } + + int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) + { + return (instance_->*memFun_)(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags); + } + + private: + T *instance_; + CallbackFunPtr memFun_; + }; + + MemFunToCallbackInterfaceAdapter adapter_; + + void open(const StreamParameters ¶meters) + { + PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), + parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, + static_cast<void *>(&adapter_)); + + if (err != paNoError) + throw PaException(err); + } + }; } // portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx index 96df96e7248..2c4df8f068f 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx @@ -6,23 +6,23 @@ ////// /// @mainpage PortAudioCpp /// -/// <h1>PortAudioCpp - A Native C++ Binding of PortAudio V19</h1> +/// <h1>PortAudioCpp - A Native C++ Binding of PortAudio V19</h1> /// <h2>PortAudio</h2> /// <p> -/// PortAudio is a portable and mature C API for accessing audio hardware. It offers both callback-based and blocking -/// style input and output, deals with sample data format conversions, dithering and much more. There are a large number -/// of implementations available for various platforms including Windows MME, Windows DirectX, Windows and MacOS (Classic) -/// ASIO, MacOS Classic SoundManager, MacOS X CoreAudio, OSS (Linux), Linux ALSA, JACK (MacOS X and Linux) and SGI Irix -/// AL. Note that, currently not all of these implementations are equally complete or up-to-date (as PortAudio V19 is -/// still in development). Because PortAudio has a C API, it can easily be called from a variety of other programming +/// PortAudio is a portable and mature C API for accessing audio hardware. It offers both callback-based and blocking +/// style input and output, deals with sample data format conversions, dithering and much more. There are a large number +/// of implementations available for various platforms including Windows MME, Windows DirectX, Windows and MacOS (Classic) +/// ASIO, MacOS Classic SoundManager, MacOS X CoreAudio, OSS (Linux), Linux ALSA, JACK (MacOS X and Linux) and SGI Irix +/// AL. Note that, currently not all of these implementations are equally complete or up-to-date (as PortAudio V19 is +/// still in development). Because PortAudio has a C API, it can easily be called from a variety of other programming /// languages. /// </p> /// <h2>PortAudioCpp</h2> /// <p> -/// Although, it is possible to use PortAudio's C API from within a C++ program, this is usually a little awkward -/// as procedural and object-oriented paradigms need to be mixed. PortAudioCpp aims to resolve this by encapsulating -/// PortAudio's C API to form an equivalent object-oriented C++ API. It provides a more natural integration of PortAudio -/// into C++ programs as well as a more structured interface. PortAudio's concepts were preserved as much as possible and +/// Although, it is possible to use PortAudio's C API from within a C++ program, this is usually a little awkward +/// as procedural and object-oriented paradigms need to be mixed. PortAudioCpp aims to resolve this by encapsulating +/// PortAudio's C API to form an equivalent object-oriented C++ API. It provides a more natural integration of PortAudio +/// into C++ programs as well as a more structured interface. PortAudio's concepts were preserved as much as possible and /// no additional features were added except for some `convenience methods'. /// </p> /// <p> @@ -30,15 +30,15 @@ /// <ul> /// <li>Structured object model.</li> /// <li>C++ exception handling instead of C-style error return codes.</li> -/// <li>Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes +/// <li>Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes /// derived from a given interface.</li> /// <li>STL compliant iterators to host APIs and devices.</li> /// <li>Some additional convenience functions to more easily set up and use PortAudio.</li> /// </ul> /// </p> /// <p> -/// PortAudioCpp requires a recent version of the PortAudio V19 source code. This can be obtained from CVS or as a snapshot -/// from the website. The examples also require the ASIO 2 SDK which can be obtained from the Steinberg website. Alternatively, the +/// PortAudioCpp requires a recent version of the PortAudio V19 source code. This can be obtained from CVS or as a snapshot +/// from the website. The examples also require the ASIO 2 SDK which can be obtained from the Steinberg website. Alternatively, the /// examples can easily be modified to compile without needing ASIO. /// </p> /// <p> @@ -50,12 +50,12 @@ /// Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant. /// </p> /// <p> -/// This documentation mainly provides information specific to PortAudioCpp. For a more complete explaination of all of the +/// This documentation mainly provides information specific to PortAudioCpp. For a more complete explanation of all of the /// concepts used, please consult the PortAudio documentation. /// </p> /// <p> -/// PortAudioCpp was developed by Merlijn Blaauw with many great suggestions and help from Ross Bencina. Ludwig Schwardt provided -/// GNU/Linux build files and checked G++ compatibility. PortAudioCpp may be used under the same licensing, conditions and +/// PortAudioCpp was developed by Merlijn Blaauw with many great suggestions and help from Ross Bencina. Ludwig Schwardt provided +/// GNU/Linux build files and checked G++ compatibility. PortAudioCpp may be used under the same licensing, conditions and /// warranty as PortAudio. See <a href="http://www.portaudio.com/license.html">the PortAudio license</a> for more details. /// </p> /// <h2>Links</h2> @@ -69,8 +69,8 @@ ////// /// @namespace portaudio /// -/// To avoid name collision, everything in PortAudioCpp is in the portaudio -/// namespace. If this name is too long it's usually pretty safe to use an +/// To avoid name collision, everything in PortAudioCpp is in the portaudio +/// namespace. If this name is too long it's usually pretty safe to use an /// alias like ``namespace pa = portaudio;''. ////// diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx index 1d3a1d9ea6c..a15d367adc6 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx @@ -11,21 +11,21 @@ namespace portaudio { - ////// - /// @brief PortAudio sample data formats. - /// - /// Small helper enum to wrap the PortAudio defines. - ////// - enum SampleDataFormat - { - INVALID_FORMAT = 0, - FLOAT32 = paFloat32, - INT32 = paInt32, - INT24 = paInt24, - INT16 = paInt16, - INT8 = paInt8, - UINT8 = paUInt8 - }; + ////// + /// @brief PortAudio sample data formats. + /// + /// Small helper enum to wrap the PortAudio defines. + ////// + enum SampleDataFormat + { + INVALID_FORMAT = 0, + FLOAT32 = paFloat32, + INT32 = paInt32, + INT24 = paInt24, + INT16 = paInt16, + INT8 = paInt8, + UINT8 = paUInt8 + }; } // namespace portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Stream.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Stream.hxx index 1aed747e5f6..2725ba7499b 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Stream.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/Stream.hxx @@ -8,7 +8,7 @@ // Forward declaration(s): namespace portaudio { - class StreamParameters; + class StreamParameters; } // --------------------------------------------------------------------------------------- @@ -18,65 +18,64 @@ namespace portaudio { - ////// - /// @brief A Stream represents an active or inactive input and/or output data - /// stream in the System. - /// - /// Concrete Stream classes should ensure themselves being in a closed state at - /// destruction (i.e. by calling their own close() method in their deconstructor). - /// Following good C++ programming practices, care must be taken to ensure no - /// exceptions are thrown by the deconstructor of these classes. As a consequence, - /// clients need to explicitly call close() to ensure the stream closed successfully. - /// - /// The Stream object can be used to manipulate the Stream's state. Also, time-constant - /// and time-varying information about the Stream can be retreived. - ////// - class Stream - { - public: - // Opening/closing: - virtual ~Stream(); + ////// + /// @brief A Stream represents an active or inactive input and/or output data + /// stream in the System. + /// + /// Concrete Stream classes should ensure themselves being in a closed state at + /// destruction (i.e. by calling their own close() method in their deconstructor). + /// Following good C++ programming practices, care must be taken to ensure no + /// exceptions are thrown by the deconstructor of these classes. As a consequence, + /// clients need to explicitly call close() to ensure the stream closed successfully. + /// + /// The Stream object can be used to manipulate the Stream's state. Also, time-constant + /// and time-varying information about the Stream can be retrieved. + ////// + class Stream + { + public: + // Opening/closing: + virtual ~Stream(); - virtual void close(); - bool isOpen() const; + virtual void close(); + bool isOpen() const; - // Additional set up: - void setStreamFinishedCallback(PaStreamFinishedCallback *callback); + // Additional set up: + void setStreamFinishedCallback(PaStreamFinishedCallback *callback); - // State management: - void start(); - void stop(); - void abort(); + // State management: + void start(); + void stop(); + void abort(); - bool isStopped() const; - bool isActive() const; + bool isStopped() const; + bool isActive() const; - // Stream info (time-constant, but might become time-variant soon): - PaTime inputLatency() const; - PaTime outputLatency() const; - double sampleRate() const; + // Stream info (time-constant, but might become time-variant soon): + PaTime inputLatency() const; + PaTime outputLatency() const; + double sampleRate() const; - // Stream info (time-varying): - PaTime time() const; + // Stream info (time-varying): + PaTime time() const; - // Accessors for PortAudio PaStream, useful for interfacing - // with PortAudio add-ons (such as PortMixer) for instance: - const PaStream *paStream() const; - PaStream *paStream(); + // Accessors for PortAudio PaStream, useful for interfacing + // with PortAudio add-ons (such as PortMixer) for instance: + const PaStream *paStream() const; + PaStream *paStream(); - protected: - Stream(); // abstract class + protected: + Stream(); // abstract class - PaStream *stream_; + PaStream *stream_; - private: - Stream(const Stream &); // non-copyable - Stream &operator=(const Stream &); // non-copyable - }; + private: + Stream(const Stream &); // non-copyable + Stream &operator=(const Stream &); // non-copyable + }; } // namespace portaudio #endif // INCLUDED_PORTAUDIO_STREAM_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx index c0ec9a9aeb0..32f5f21a22e 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx @@ -13,61 +13,61 @@ namespace portaudio { - ////// - /// @brief The entire set of parameters needed to configure and open - /// a Stream. - /// - /// It contains parameters of input, output and shared parameters. - /// Using the isSupported() method, the StreamParameters can be - /// checked if opening a Stream using this StreamParameters would - /// succeed or not. Accessors are provided to higher-level parameters - /// aswell as the lower-level parameters which are mainly intended for - /// internal use. - ////// - class StreamParameters - { - public: - StreamParameters(); - StreamParameters(const DirectionSpecificStreamParameters &inputParameters, - const DirectionSpecificStreamParameters &outputParameters, double sampleRate, - unsigned long framesPerBuffer, PaStreamFlags flags); - - // Set up for direction-specific: - void setInputParameters(const DirectionSpecificStreamParameters ¶meters); - void setOutputParameters(const DirectionSpecificStreamParameters ¶meters); - - // Set up for common parameters: - void setSampleRate(double sampleRate); - void setFramesPerBuffer(unsigned long framesPerBuffer); - void setFlag(PaStreamFlags flag); - void unsetFlag(PaStreamFlags flag); - void clearFlags(); - - // Validation: - bool isSupported() const; - - // Accessors (direction-specific): - DirectionSpecificStreamParameters &inputParameters(); - const DirectionSpecificStreamParameters &inputParameters() const; - DirectionSpecificStreamParameters &outputParameters(); - const DirectionSpecificStreamParameters &outputParameters() const; - - // Accessors (common): - double sampleRate() const; - unsigned long framesPerBuffer() const; - PaStreamFlags flags() const; - bool isFlagSet(PaStreamFlags flag) const; - - private: - // Half-duplex specific parameters: - DirectionSpecificStreamParameters inputParameters_; - DirectionSpecificStreamParameters outputParameters_; - - // Common parameters: - double sampleRate_; - unsigned long framesPerBuffer_; - PaStreamFlags flags_; - }; + ////// + /// @brief The entire set of parameters needed to configure and open + /// a Stream. + /// + /// It contains parameters of input, output and shared parameters. + /// Using the isSupported() method, the StreamParameters can be + /// checked if opening a Stream using this StreamParameters would + /// succeed or not. Accessors are provided to higher-level parameters + /// aswell as the lower-level parameters which are mainly intended for + /// internal use. + ////// + class StreamParameters + { + public: + StreamParameters(); + StreamParameters(const DirectionSpecificStreamParameters &inputParameters, + const DirectionSpecificStreamParameters &outputParameters, double sampleRate, + unsigned long framesPerBuffer, PaStreamFlags flags); + + // Set up for direction-specific: + void setInputParameters(const DirectionSpecificStreamParameters ¶meters); + void setOutputParameters(const DirectionSpecificStreamParameters ¶meters); + + // Set up for common parameters: + void setSampleRate(double sampleRate); + void setFramesPerBuffer(unsigned long framesPerBuffer); + void setFlag(PaStreamFlags flag); + void unsetFlag(PaStreamFlags flag); + void clearFlags(); + + // Validation: + bool isSupported() const; + + // Accessors (direction-specific): + DirectionSpecificStreamParameters &inputParameters(); + const DirectionSpecificStreamParameters &inputParameters() const; + DirectionSpecificStreamParameters &outputParameters(); + const DirectionSpecificStreamParameters &outputParameters() const; + + // Accessors (common): + double sampleRate() const; + unsigned long framesPerBuffer() const; + PaStreamFlags flags() const; + bool isFlagSet(PaStreamFlags flag) const; + + private: + // Half-duplex specific parameters: + DirectionSpecificStreamParameters inputParameters_; + DirectionSpecificStreamParameters outputParameters_; + + // Common parameters: + double sampleRate_; + unsigned long framesPerBuffer_; + PaStreamFlags flags_; + }; } // namespace portaudio diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/System.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/System.hxx index d5ff9dd2b3c..bdd966ebfa2 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/System.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/System.hxx @@ -10,9 +10,9 @@ // Forward declaration(s): namespace portaudio { - class Device; - class Stream; - class HostApi; + class Device; + class Stream; + class HostApi; } // --------------------------------------------------------------------------------------- @@ -22,86 +22,85 @@ namespace portaudio { - ////// - /// @brief System singleton which represents the PortAudio system. - /// - /// The System is used to initialize/terminate PortAudio and provide - /// a single acccess point to the PortAudio System (instance()). - /// It can be used to iterate through all HostApi 's in the System as - /// well as all devices in the System. It also provides some utility - /// functionality of PortAudio. - /// - /// Terminating the System will also abort and close the open streams. - /// The Stream objects will need to be deallocated by the client though - /// (it's usually a good idea to have them cleaned up automatically). - ////// - class System - { - public: - class HostApiIterator; // forward declaration - class DeviceIterator; // forward declaration + ////// + /// @brief System singleton which represents the PortAudio system. + /// + /// The System is used to initialize/terminate PortAudio and provide + /// a single access point to the PortAudio System (instance()). + /// It can be used to iterate through all HostApi 's in the System as + /// well as all devices in the System. It also provides some utility + /// functionality of PortAudio. + /// + /// Terminating the System will also abort and close the open streams. + /// The Stream objects will need to be deallocated by the client though + /// (it's usually a good idea to have them cleaned up automatically). + ////// + class System + { + public: + class HostApiIterator; // forward declaration + class DeviceIterator; // forward declaration - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- - static int version(); - static const char *versionText(); + static int version(); + static const char *versionText(); - static void initialize(); - static void terminate(); + static void initialize(); + static void terminate(); - static System &instance(); - static bool exists(); + static System &instance(); + static bool exists(); - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- - // host apis: - HostApiIterator hostApisBegin(); - HostApiIterator hostApisEnd(); + // host apis: + HostApiIterator hostApisBegin(); + HostApiIterator hostApisEnd(); - HostApi &defaultHostApi(); + HostApi &defaultHostApi(); - HostApi &hostApiByTypeId(PaHostApiTypeId type); - HostApi &hostApiByIndex(PaHostApiIndex index); + HostApi &hostApiByTypeId(PaHostApiTypeId type); + HostApi &hostApiByIndex(PaHostApiIndex index); - int hostApiCount(); + int hostApiCount(); - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- - // devices: - DeviceIterator devicesBegin(); - DeviceIterator devicesEnd(); + // devices: + DeviceIterator devicesBegin(); + DeviceIterator devicesEnd(); - Device &defaultInputDevice(); - Device &defaultOutputDevice(); + Device &defaultInputDevice(); + Device &defaultOutputDevice(); - Device &deviceByIndex(PaDeviceIndex index); + Device &deviceByIndex(PaDeviceIndex index); - int deviceCount(); + int deviceCount(); - static Device &nullDevice(); + static Device &nullDevice(); - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- - // misc: - void sleep(long msec); - int sizeOfSample(PaSampleFormat format); + // misc: + void sleep(long msec); + int sizeOfSample(PaSampleFormat format); - private: - System(); - ~System(); + private: + System(); + ~System(); - static System *instance_; - static int initCount_; + static System *instance_; + static int initCount_; - static HostApi **hostApis_; - static Device **devices_; + static HostApi **hostApis_; + static Device **devices_; - static Device *nullDevice_; - }; + static Device *nullDevice_; + }; } // namespace portaudio #endif // INCLUDED_PORTAUDIO_SYSTEM_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx index ffa195d2872..d5ae31eba34 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx @@ -13,8 +13,8 @@ // Forward declaration(s): namespace portaudio { - class Device; - class HostApi; + class Device; + class HostApi; } // --------------------------------------------------------------------------------------- @@ -23,39 +23,39 @@ namespace portaudio namespace portaudio { - - ////// - /// @brief Iterator class for iterating through all Devices in a System. - /// - /// Devices will be iterated by iterating all Devices in each - /// HostApi in the System. Compliant with the STL bidirectional - /// iterator concept. - ////// - class System::DeviceIterator - { - public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef Device value_type; - typedef ptrdiff_t difference_type; - typedef Device * pointer; - typedef Device & reference; - - Device &operator*() const; - Device *operator->() const; - - DeviceIterator &operator++(); - DeviceIterator operator++(int); - DeviceIterator &operator--(); - DeviceIterator operator--(int); - - bool operator==(const DeviceIterator &rhs) const; - bool operator!=(const DeviceIterator &rhs) const; - - private: - friend class System; - friend class HostApi; - Device **ptr_; - }; + + ////// + /// @brief Iterator class for iterating through all Devices in a System. + /// + /// Devices will be iterated by iterating all Devices in each + /// HostApi in the System. Compliant with the STL bidirectional + /// iterator concept. + ////// + class System::DeviceIterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef Device value_type; + typedef ptrdiff_t difference_type; + typedef Device * pointer; + typedef Device & reference; + + Device &operator*() const; + Device *operator->() const; + + DeviceIterator &operator++(); + DeviceIterator operator++(int); + DeviceIterator &operator--(); + DeviceIterator operator--(int); + + bool operator==(const DeviceIterator &rhs) const; + bool operator!=(const DeviceIterator &rhs) const; + + private: + friend class System; + friend class HostApi; + Device **ptr_; + }; } // namespace portaudio @@ -63,4 +63,3 @@ namespace portaudio // --------------------------------------------------------------------------------------- #endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX - diff --git a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx index 3e6a978a326..a3e2f4b3c23 100644 --- a/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx +++ b/3rdparty/portaudio/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx @@ -13,7 +13,7 @@ // Forward declaration(s): namespace portaudio { - class HostApi; + class HostApi; } // --------------------------------------------------------------------------------------- @@ -23,35 +23,35 @@ namespace portaudio { - ////// - /// @brief Iterator class for iterating through all HostApis in a System. - /// - /// Compliant with the STL bidirectional iterator concept. - ////// - class System::HostApiIterator - { - public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef Device value_type; - typedef ptrdiff_t difference_type; - typedef HostApi * pointer; - typedef HostApi & reference; - - HostApi &operator*() const; - HostApi *operator->() const; - - HostApiIterator &operator++(); - HostApiIterator operator++(int); - HostApiIterator &operator--(); - HostApiIterator operator--(int); - - bool operator==(const HostApiIterator &rhs) const; - bool operator!=(const HostApiIterator &rhs) const; - - private: - friend class System; - HostApi **ptr_; - }; + ////// + /// @brief Iterator class for iterating through all HostApis in a System. + /// + /// Compliant with the STL bidirectional iterator concept. + ////// + class System::HostApiIterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef Device value_type; + typedef ptrdiff_t difference_type; + typedef HostApi * pointer; + typedef HostApi & reference; + + HostApi &operator*() const; + HostApi *operator->() const; + + HostApiIterator &operator++(); + HostApiIterator operator++(int); + HostApiIterator &operator--(); + HostApiIterator operator--(int); + + bool operator==(const HostApiIterator &rhs) const; + bool operator!=(const HostApiIterator &rhs) const; + + private: + friend class System; + HostApi **ptr_; + }; } // namespace portaudio |