From: wittend99 Date: Fri, 18 May 2012 02:06:15 +0000 (+0000) Subject: Catching up before things get into a snarl. X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=9ee711eb0cb443d2ca1dd4e8052f04a74a80cb08;p=freetel-svn-tracking.git Catching up before things get into a snarl. git-svn-id: https://svn.code.sf.net/p/freetel/code@475 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2/extern/include/portaudiocpp/AsioDeviceAdapter.hxx b/fdmdv2/extern/include/portaudiocpp/AsioDeviceAdapter.hxx index 1964b6a2..3291457a 100644 --- a/fdmdv2/extern/include/portaudiocpp/AsioDeviceAdapter.hxx +++ b/fdmdv2/extern/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 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_; + }; } #endif // INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX diff --git a/fdmdv2/extern/include/portaudiocpp/AutoSystem.hxx b/fdmdv2/extern/include/portaudiocpp/AutoSystem.hxx index 16cac5ed..7c5889e5 100644 --- a/fdmdv2/extern/include/portaudiocpp/AutoSystem.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/BlockingStream.hxx b/fdmdv2/extern/include/portaudiocpp/BlockingStream.hxx index 37fa7665..9653550f 100644 --- a/fdmdv2/extern/include/portaudiocpp/BlockingStream.hxx +++ b/fdmdv2/extern/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(); - - void open(const StreamParameters ¶meters); - - void read(void *buffer, unsigned long numFrames); - void write(const void *buffer, unsigned long numFrames); - - signed long availableReadSize() const; - signed long availableWriteSize() const; - - private: - BlockingStream(const BlockingStream &); // non-copyable - BlockingStream &operator=(const BlockingStream &); // non-copyable - }; + ////// + /// @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 read(void *buffer, unsigned long numFrames); + void write(const void *buffer, unsigned long numFrames); + + signed long availableReadSize() const; + signed long availableWriteSize() const; + + private: + BlockingStream(const BlockingStream &); // non-copyable + BlockingStream &operator=(const BlockingStream &); // non-copyable + }; diff --git a/fdmdv2/extern/include/portaudiocpp/CFunCallbackStream.hxx b/fdmdv2/extern/include/portaudiocpp/CFunCallbackStream.hxx index b3e3b5c1..f4d5918d 100644 --- a/fdmdv2/extern/include/portaudiocpp/CFunCallbackStream.hxx +++ b/fdmdv2/extern/include/portaudiocpp/CFunCallbackStream.hxx @@ -12,7 +12,7 @@ // Forward declaration(s) namespace portaudio { - class StreamParameters; + class StreamParameters; } // --------------------------------------------------------------------------------------- @@ -20,27 +20,27 @@ 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 // --------------------------------------------------------------------------------------- diff --git a/fdmdv2/extern/include/portaudiocpp/CallbackInterface.hxx b/fdmdv2/extern/include/portaudiocpp/CallbackInterface.hxx index d498ec5b..c9236cdd 100644 --- a/fdmdv2/extern/include/portaudiocpp/CallbackInterface.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/CallbackStream.hxx b/fdmdv2/extern/include/portaudiocpp/CallbackStream.hxx index 0382275e..8ee6d4c4 100644 --- a/fdmdv2/extern/include/portaudiocpp/CallbackStream.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/CppFunCallbackStream.hxx b/fdmdv2/extern/include/portaudiocpp/CppFunCallbackStream.hxx index e0c00127..08d1aabe 100644 --- a/fdmdv2/extern/include/portaudiocpp/CppFunCallbackStream.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/Device.hxx b/fdmdv2/extern/include/portaudiocpp/Device.hxx index ffde7aa8..db5018fa 100644 --- a/fdmdv2/extern/include/portaudiocpp/Device.hxx +++ b/fdmdv2/extern/include/portaudiocpp/Device.hxx @@ -14,8 +14,8 @@ // Forward declaration(s): namespace portaudio { - class System; - class HostApi; + class System; + class HostApi; } // --------------------------------------------------------------------------------------- @@ -24,64 +24,64 @@ 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); - bool operator!=(const Device &rhs); - - // 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/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); + bool operator!=(const Device &rhs); + + // 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 diff --git a/fdmdv2/extern/include/portaudiocpp/DirectionSpecificStreamParameters.hxx b/fdmdv2/extern/include/portaudiocpp/DirectionSpecificStreamParameters.hxx index dd5ae0b9..5001149b 100644 --- a/fdmdv2/extern/include/portaudiocpp/DirectionSpecificStreamParameters.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/Exception.hxx b/fdmdv2/extern/include/portaudiocpp/Exception.hxx index a70c2f1d..96e4ad2f 100644 --- a/fdmdv2/extern/include/portaudiocpp/Exception.hxx +++ b/fdmdv2/extern/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 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_; + }; } // namespace portaudio diff --git a/fdmdv2/extern/include/portaudiocpp/HostApi.hxx b/fdmdv2/extern/include/portaudiocpp/HostApi.hxx index 899fc42d..a51cfe07 100644 --- a/fdmdv2/extern/include/portaudiocpp/HostApi.hxx +++ b/fdmdv2/extern/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; - - // query info: id, name, numDevices - PaHostApiTypeId typeId() const; - PaHostApiIndex index() const; - const char *name() const; - int deviceCount() const; - - // iterate devices - DeviceIterator devicesBegin(); - DeviceIterator devicesEnd(); - - // default devices - Device &defaultInputDevice() const; - Device &defaultOutputDevice() const; - - // comparison operators - bool operator==(const HostApi &rhs) const; - bool operator!=(const HostApi &rhs) const; - - private: - const PaHostApiInfo *info_; - Device **devices_; - - private: - friend class System; - - explicit HostApi(PaHostApiIndex index); - ~HostApi(); - - HostApi(const HostApi &); // non-copyable - HostApi &operator=(const HostApi &); // non-copyable - }; + ////// + /// @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; + + // query info: id, name, numDevices + PaHostApiTypeId typeId() const; + PaHostApiIndex index() const; + const char *name() const; + int deviceCount() const; + + // iterate devices + DeviceIterator devicesBegin(); + DeviceIterator devicesEnd(); + + // default devices + Device &defaultInputDevice() const; + Device &defaultOutputDevice() const; + + // comparison operators + bool operator==(const HostApi &rhs) const; + bool operator!=(const HostApi &rhs) const; + + private: + const PaHostApiInfo *info_; + Device **devices_; + + private: + friend class System; + + explicit HostApi(PaHostApiIndex index); + ~HostApi(); + + HostApi(const HostApi &); // non-copyable + HostApi &operator=(const HostApi &); // non-copyable + }; } diff --git a/fdmdv2/extern/include/portaudiocpp/InterfaceCallbackStream.hxx b/fdmdv2/extern/include/portaudiocpp/InterfaceCallbackStream.hxx index e496dd27..5e03035b 100644 --- a/fdmdv2/extern/include/portaudiocpp/InterfaceCallbackStream.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/MemFunCallbackStream.hxx b/fdmdv2/extern/include/portaudiocpp/MemFunCallbackStream.hxx index a9e50ca6..a04c5be3 100644 --- a/fdmdv2/extern/include/portaudiocpp/MemFunCallbackStream.hxx +++ b/fdmdv2/extern/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 stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim - ////// - template - 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(&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 stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim + ////// + template + 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(&adapter_)); + + if (err != paNoError) + throw PaException(err); + } + }; } // portaudio diff --git a/fdmdv2/extern/include/portaudiocpp/PortAudioCpp.hxx b/fdmdv2/extern/include/portaudiocpp/PortAudioCpp.hxx index f11e7fb9..9b9dfe36 100644 --- a/fdmdv2/extern/include/portaudiocpp/PortAudioCpp.hxx +++ b/fdmdv2/extern/include/portaudiocpp/PortAudioCpp.hxx @@ -6,23 +6,23 @@ ////// /// @mainpage PortAudioCpp /// -///

PortAudioCpp - A Native C++ Binding of PortAudio V19

+///

PortAudioCpp - A Native C++ Binding of PortAudio V19

///

PortAudio

///

-/// 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. ///

///

PortAudioCpp

///

-/// 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'. ///

///

@@ -30,15 +30,15 @@ ///

    ///
  • Structured object model.
  • ///
  • C++ exception handling instead of C-style error return codes.
  • -///
  • Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes +///
  • Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes /// derived from a given interface.
  • ///
  • STL compliant iterators to host APIs and devices.
  • ///
  • Some additional convenience functions to more easily set up and use PortAudio.
  • ///
///

///

-/// 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. ///

///

@@ -50,12 +50,12 @@ /// Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant. ///

///

-/// 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 explaination of all of the /// concepts used, please consult the PortAudio documentation. ///

///

-/// 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 the PortAudio license for more details. ///

///

Links

@@ -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/fdmdv2/extern/include/portaudiocpp/SampleDataFormat.hxx b/fdmdv2/extern/include/portaudiocpp/SampleDataFormat.hxx index a7e25b24..5224768b 100644 --- a/fdmdv2/extern/include/portaudiocpp/SampleDataFormat.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/Stream.hxx b/fdmdv2/extern/include/portaudiocpp/Stream.hxx index 8a255ec7..80c363d0 100644 --- a/fdmdv2/extern/include/portaudiocpp/Stream.hxx +++ b/fdmdv2/extern/include/portaudiocpp/Stream.hxx @@ -8,7 +8,7 @@ // Forward declaration(s): namespace portaudio { - class StreamParameters; + class StreamParameters; } // --------------------------------------------------------------------------------------- @@ -18,61 +18,61 @@ 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(); - - virtual void close(); - bool isOpen() const; - - // Additional set up: - void setStreamFinishedCallback(PaStreamFinishedCallback *callback); - - // State management: - void start(); - void stop(); - void abort(); - - 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-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(); - - protected: - Stream(); // abstract class - - PaStream *stream_; - - private: - Stream(const Stream &); // non-copyable - Stream &operator=(const Stream &); // non-copyable - }; + ////// + /// @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(); + + virtual void close(); + bool isOpen() const; + + // Additional set up: + void setStreamFinishedCallback(PaStreamFinishedCallback *callback); + + // State management: + void start(); + void stop(); + void abort(); + + 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-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(); + + protected: + Stream(); // abstract class + + PaStream *stream_; + + private: + Stream(const Stream &); // non-copyable + Stream &operator=(const Stream &); // non-copyable + }; } // namespace portaudio diff --git a/fdmdv2/extern/include/portaudiocpp/StreamParameters.hxx b/fdmdv2/extern/include/portaudiocpp/StreamParameters.hxx index 2b6aa2ef..d9b90e9e 100644 --- a/fdmdv2/extern/include/portaudiocpp/StreamParameters.hxx +++ b/fdmdv2/extern/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/fdmdv2/extern/include/portaudiocpp/System.hxx b/fdmdv2/extern/include/portaudiocpp/System.hxx index f5fb7132..014cc20b 100644 --- a/fdmdv2/extern/include/portaudiocpp/System.hxx +++ b/fdmdv2/extern/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,82 +22,82 @@ 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 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 - // ------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------- - 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 diff --git a/fdmdv2/extern/include/portaudiocpp/SystemDeviceIterator.hxx b/fdmdv2/extern/include/portaudiocpp/SystemDeviceIterator.hxx index 613fc3db..8dc8ed67 100644 --- a/fdmdv2/extern/include/portaudiocpp/SystemDeviceIterator.hxx +++ b/fdmdv2/extern/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); - bool operator!=(const DeviceIterator &rhs); - - 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); + bool operator!=(const DeviceIterator &rhs); + + private: + friend class System; + friend class HostApi; + Device **ptr_; + }; } // namespace portaudio diff --git a/fdmdv2/extern/include/portaudiocpp/SystemHostApiIterator.hxx b/fdmdv2/extern/include/portaudiocpp/SystemHostApiIterator.hxx index b9b13b85..82988776 100644 --- a/fdmdv2/extern/include/portaudiocpp/SystemHostApiIterator.hxx +++ b/fdmdv2/extern/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); - bool operator!=(const HostApiIterator &rhs); - - 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); + bool operator!=(const HostApiIterator &rhs); + + private: + friend class System; + HostApi **ptr_; + }; } // namespace portaudio diff --git a/fdmdv2/extern/lib/libportaudio.a b/fdmdv2/extern/lib/libportaudio.a new file mode 100644 index 00000000..e5b3b049 Binary files /dev/null and b/fdmdv2/extern/lib/libportaudio.a differ diff --git a/fdmdv2/extern/lib/libportaudio.la b/fdmdv2/extern/lib/libportaudio.la new file mode 100644 index 00000000..934a2133 --- /dev/null +++ b/fdmdv2/extern/lib/libportaudio.la @@ -0,0 +1,41 @@ +# libportaudio.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4 Debian-2.4-2ubuntu1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libportaudio.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lwinmm -lole32 -luuid' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libportaudio. +current=2 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib' diff --git a/fdmdv2/pa_cppbinding_test/gui.cpp b/fdmdv2/pa_cppbinding_test/gui.cpp index 9fd40a68..1a2d09e2 100644 --- a/fdmdv2/pa_cppbinding_test/gui.cpp +++ b/fdmdv2/pa_cppbinding_test/gui.cpp @@ -26,7 +26,9 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t wxBoxSizer* mainSizer; mainSizer = new wxBoxSizer( wxVERTICAL ); - m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_audioInfo = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_audioInfo->SetMinSize( wxSize( 65,65 ) ); + wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 4, 4, 1, 1 ); fgSizer1->AddGrowableCol( 3 ); @@ -37,41 +39,61 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticText1 = new wxStaticText( m_panel1, wxID_ANY, _("Input, Output:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + m_staticText1 = new wxStaticText( m_audioInfo, wxID_ANY, _("Input, Output:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); m_staticText1->Wrap( -1 ); fgSizer1->Add( m_staticText1, 1, wxALL|wxEXPAND, 5 ); - m_comboBox1 = new wxComboBox( m_panel1, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgSizer1->Add( m_comboBox1, 1, wxALL|wxEXPAND, 5 ); + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer( wxVERTICAL ); + + bSizer2->SetMinSize( wxSize( 65,65 ) ); + m_comboBoxLeft = new wxComboBox( m_audioInfo, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_SIMPLE ); + m_comboBoxLeft->SetToolTip( _("Input Audio Interface") ); + m_comboBoxLeft->SetMinSize( wxSize( 65,65 ) ); + + bSizer2->Add( m_comboBoxLeft, 1, wxALL|wxEXPAND, 5 ); + + + fgSizer1->Add( bSizer2, 1, wxEXPAND|wxFIXED_MINSIZE, 5 ); + + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + + bSizer3->SetMinSize( wxSize( 65,65 ) ); + m_comboBoxRight = new wxComboBox( m_audioInfo, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_SIMPLE ); + m_comboBoxRight->SetToolTip( _("Output Audio Interface") ); + m_comboBoxRight->SetMinSize( wxSize( 65,65 ) ); + + bSizer3->Add( m_comboBoxRight, 1, wxALL|wxEXPAND, 5 ); + - m_comboBox2 = new wxComboBox( m_panel1, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgSizer1->Add( m_comboBox2, 1, wxALL|wxEXPAND, 5 ); + fgSizer1->Add( bSizer3, 1, wxEXPAND, 5 ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticText2 = new wxStaticText( m_panel1, wxID_ANY, _("Behavor:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + m_staticText2 = new wxStaticText( m_audioInfo, wxID_ANY, _("Behavor:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); m_staticText2->Wrap( -1 ); - fgSizer1->Add( m_staticText2, 1, wxALL|wxEXPAND, 5 ); + fgSizer1->Add( m_staticText2, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL|wxEXPAND, 5 ); - m_gauge1 = new wxGauge( m_panel1, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH ); + m_gauge1 = new wxGauge( m_audioInfo, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH ); fgSizer1->Add( m_gauge1, 1, wxALL|wxEXPAND, 5 ); - m_slider1 = new wxSlider( m_panel1, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL ); + m_slider1 = new wxSlider( m_audioInfo, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_SELRANGE|wxSL_TOP ); fgSizer1->Add( m_slider1, 1, wxALL|wxEXPAND, 5 ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticText5 = new wxStaticText( m_panel1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5 = new wxStaticText( m_audioInfo, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_staticText5->Wrap( -1 ); fgSizer1->Add( m_staticText5, 1, wxALL|wxEXPAND, 5 ); - m_toggleBtn2 = new wxToggleButton( m_panel1, wxID_ANY, _("On / Off"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtn2 = new wxToggleButton( m_audioInfo, wxID_ANY, _("On / Off"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtn2->SetValue( true ); fgSizer1->Add( m_toggleBtn2, 1, wxALL|wxEXPAND, 5 ); - m_toggleBtn3 = new wxToggleButton( m_panel1, wxID_ANY, _("On / Off"), wxDefaultPosition, wxDefaultSize, 0 ); + m_toggleBtn3 = new wxToggleButton( m_audioInfo, wxID_ANY, _("On / Off"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtn3->SetValue( true ); fgSizer1->Add( m_toggleBtn3, 0, wxALL|wxEXPAND, 5 ); @@ -84,15 +106,15 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t fgSizer1->Add( 0, 0, 1, 0, 5 ); - m_button1 = new wxButton( m_panel1, wxID_ANY, _("Exit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button1 = new wxButton( m_audioInfo, wxID_ANY, _("Exit"), wxDefaultPosition, wxDefaultSize, 0 ); m_button1->SetDefault(); fgSizer1->Add( m_button1, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 ); - m_panel1->SetSizer( fgSizer1 ); - m_panel1->Layout(); - fgSizer1->Fit( m_panel1 ); - mainSizer->Add( m_panel1, 1, wxALL|wxEXPAND, 0 ); + m_audioInfo->SetSizer( fgSizer1 ); + m_audioInfo->Layout(); + fgSizer1->Fit( m_audioInfo ); + mainSizer->Add( m_audioInfo, 1, wxALL|wxEXPAND|wxFIXED_MINSIZE, 0 ); this->SetSizer( mainSizer ); @@ -104,8 +126,8 @@ MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& t // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnCloseFrame ) ); this->Connect( menuFileExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnExitClick ) ); - m_comboBox1->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboLeft ), NULL, this ); - m_comboBox2->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboRight ), NULL, this ); + m_comboBoxLeft->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboLeft ), NULL, this ); + m_comboBoxRight->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboRight ), NULL, this ); m_slider1->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( MainFrameBase::OnScroll ), NULL, this ); m_slider1->Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( MainFrameBase::OnScroll ), NULL, this ); m_slider1->Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( MainFrameBase::OnScroll ), NULL, this ); @@ -125,8 +147,8 @@ MainFrameBase::~MainFrameBase() // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnCloseFrame ) ); this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnExitClick ) ); - m_comboBox1->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboLeft ), NULL, this ); - m_comboBox2->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboRight ), NULL, this ); + m_comboBoxLeft->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboLeft ), NULL, this ); + m_comboBoxRight->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrameBase::OnComboRight ), NULL, this ); m_slider1->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( MainFrameBase::OnScroll ), NULL, this ); m_slider1->Disconnect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( MainFrameBase::OnScroll ), NULL, this ); m_slider1->Disconnect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( MainFrameBase::OnScroll ), NULL, this ); diff --git a/fdmdv2/pa_cppbinding_test/gui.fbp b/fdmdv2/pa_cppbinding_test/gui.fbp index e63361aa..3b3b63e8 100644 --- a/fdmdv2/pa_cppbinding_test/gui.fbp +++ b/fdmdv2/pa_cppbinding_test/gui.fbp @@ -3,7 +3,7 @@ - C++ + C++|Python|XRC 1 source_name 0 @@ -120,7 +120,7 @@ - + 1 1 1 @@ -200,7 +200,7 @@ - + &File m_menuFile protected @@ -228,7 +228,7 @@ none 0 - wxALL|wxEXPAND + wxALL|wxEXPAND|wxFIXED_MINSIZE 1 1 @@ -263,9 +263,9 @@ 0 - + 65,65 1 - m_panel1 + m_audioInfo 1 @@ -275,7 +275,7 @@ Resizable 1 - + ; 0 @@ -320,21 +320,21 @@ none 4 1 - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -419,201 +419,223 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxFIXED_MINSIZE 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox1 - 1 - - - protected - 1 - - Resizable - -1 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Combo! - - - - - OnComboLeft - - - - - - - - - - - - - - - - - - - - - - - - + + 65,65 + bSizer2 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 65,65 + 1 + m_comboBoxLeft + 1 + + + protected + 1 + + Resizable + -1 + 1 + + wxCB_SIMPLE + + 0 + Input Audio Interface + + wxFILTER_NONE + wxDefaultValidator + + + + + + + OnComboLeft + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox2 - 1 - - - protected - 1 - - Resizable - -1 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Combo! - - - - - OnComboRight - - - - - - - - - - - - - - - - - - - - - - - - + + 65,65 + bSizer3 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 65,65 + 1 + m_comboBoxRight + 1 + + + protected + 1 + + Resizable + -1 + 1 + + wxCB_SIMPLE + + 0 + Output Audio Interface + + wxFILTER_NONE + wxDefaultValidator + + + + + + + OnComboRight + + + + + + + + + + + + + + + + + + + + + + + + + + - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 - wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL|wxEXPAND 1 - + 1 1 1 @@ -696,11 +718,11 @@ - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -783,11 +805,11 @@ - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -834,7 +856,7 @@ Resizable 1 - wxSL_HORIZONTAL + wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_SELRANGE|wxSL_TOP 0 @@ -891,21 +913,21 @@ - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -988,11 +1010,11 @@ - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -1075,11 +1097,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -1162,41 +1184,41 @@ - + 5 1 - + 0 protected 0 - + 5 1 - + 0 protected 0 - + 5 1 - + 0 protected 0 - + 5 wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL 0 - + 1 1 1 diff --git a/fdmdv2/pa_cppbinding_test/gui.h b/fdmdv2/pa_cppbinding_test/gui.h index 94d27b7d..b0fd86e1 100644 --- a/fdmdv2/pa_cppbinding_test/gui.h +++ b/fdmdv2/pa_cppbinding_test/gui.h @@ -22,11 +22,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -44,10 +44,10 @@ class MainFrameBase : public wxFrame protected: wxMenuBar* m_menuBar; wxMenu* m_menuFile; - wxPanel* m_panel1; + wxPanel* m_audioInfo; wxStaticText* m_staticText1; - wxComboBox* m_comboBox1; - wxComboBox* m_comboBox2; + wxComboBox* m_comboBoxLeft; + wxComboBox* m_comboBoxRight; wxStaticText* m_staticText2; wxGauge* m_gauge1; wxSlider* m_slider1; diff --git a/fdmdv2/pa_cppbinding_test/main.cpp b/fdmdv2/pa_cppbinding_test/main.cpp index 89772f2c..24aecd4f 100644 --- a/fdmdv2/pa_cppbinding_test/main.cpp +++ b/fdmdv2/pa_cppbinding_test/main.cpp @@ -50,3 +50,184 @@ void MainFrame::OnExitClick(wxCommandEvent& event) { Destroy(); } + +void MainFrame::printSupportedStandardSampleRates( + const portaudio::DirectionSpecificStreamParameters &inputParameters, + const portaudio::DirectionSpecificStreamParameters &outputParameters) +{ + static double STANDARD_SAMPLE_RATES[] = { + 8000.0, + 9600.0, + 11025.0, + 12000.0, + 16000.0, + 22050.0, + 24000.0, + 32000.0, + 44100.0, + 48000.0, + 88200.0, + 96000.0, + 192000.0, + -1 + }; // negative terminated list + + int printCount = 0; + + for (int i = 0; STANDARD_SAMPLE_RATES[i] > 0; ++i) + { + portaudio::StreamParameters tmp = portaudio::StreamParameters(inputParameters, outputParameters, STANDARD_SAMPLE_RATES[i], 0, paNoFlag); + if (tmp.isSupported()) + { + if (printCount == 0) + { + std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2 + printCount = 1; + } + else if (printCount == 4) + { + std::cout << "," << std::endl; + std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2 + printCount = 1; + } + else + { + std::cout << ", " << STANDARD_SAMPLE_RATES[i]; // 8.2 + ++printCount; + } + } + } + if (printCount == 0) + { + std::cout << "None" << std::endl; + } + else + { + std::cout << std::endl; + } +} + +int MainFrame::populateAudioInfo() +{ + + try + { + portaudio::AutoSystem autoSys; + portaudio::System &sys = portaudio::System::instance(); + + std::cout << "PortAudio version number = " << sys.version() << std::endl; + std::cout << "PortAudio version text = '" << sys.versionText() << "'" << std::endl; + + int numDevices = sys.deviceCount(); + std::cout << "Number of devices = " << numDevices << std::endl; + + for (portaudio::System::DeviceIterator i = sys.devicesBegin(); i != sys.devicesEnd(); ++i) + { + std::cout << "--------------------------------------- device #" << (*i).index() << std::endl; + + // Mark global and API specific default devices: + bool defaultDisplayed = false; + + if ((*i).isSystemDefaultInputDevice()) + { + std::cout << "[ Default Input"; + defaultDisplayed = true; + } + else if ((*i).isHostApiDefaultInputDevice()) + { + std::cout << "[ Default " << (*i).hostApi().name() << " Input"; + defaultDisplayed = true; + } + if ((*i).isSystemDefaultOutputDevice()) + { + std::cout << (defaultDisplayed ? "," : "["); + std::cout << " Default Output"; + defaultDisplayed = true; + } + else if ((*i).isHostApiDefaultOutputDevice()) + { + std::cout << (defaultDisplayed ? "," : "["); + std::cout << " Default " << (*i).hostApi().name() << " Output"; + defaultDisplayed = true; + } + if (defaultDisplayed) + { + std::cout << " ]" << std::endl; + } + // Print device info: + std::cout << "Name = " << (*i).name() << std::endl; + std::cout << "Host API = " << (*i).hostApi().name() << std::endl; + std::cout << "Max inputs = " << (*i).maxInputChannels() << ", Max outputs = " << (*i).maxOutputChannels() << std::endl; + + std::cout << "Default low input latency = " << (*i).defaultLowInputLatency() << std::endl; // 8.3 + std::cout << "Default low output latency = " << (*i).defaultLowOutputLatency() << std::endl; // 8.3 + std::cout << "Default high input latency = " << (*i).defaultHighInputLatency() << std::endl; // 8.3 + std::cout << "Default high output latency = " << (*i).defaultHighOutputLatency() << std::endl; // 8.3 + +#ifdef WIN32 + // ASIO specific latency information: + if ((*i).hostApi().typeId() == paASIO) + { + portaudio::AsioDeviceAdapter asioDevice((*i)); + + std::cout << "ASIO minimum buffer size = " << asioDevice.minBufferSize() << std::endl; + std::cout << "ASIO maximum buffer size = " << asioDevice.maxBufferSize() << std::endl; + std::cout << "ASIO preferred buffer size = " << asioDevice.preferredBufferSize() << std::endl; + + if (asioDevice.granularity() == -1) + { + std::cout << "ASIO buffer granularity = power of 2" << std::endl; + } + else + { + std::cout << "ASIO buffer granularity = " << asioDevice.granularity() << std::endl; + } + } +#endif // WIN32 + + std::cout << "Default sample rate = " << (*i).defaultSampleRate() << std::endl; // 8.2 + + // Poll for standard sample rates: + portaudio::DirectionSpecificStreamParameters inputParameters((*i), (*i).maxInputChannels(), portaudio::INT16, true, 0.0, NULL); + portaudio::DirectionSpecificStreamParameters outputParameters((*i), (*i).maxOutputChannels(), portaudio::INT16, true, 0.0, NULL); + if (inputParameters.numChannels() > 0) + { + std::cout << "Supported standard sample rates" << std::endl; + std::cout << " for half-duplex 16 bit " << inputParameters.numChannels() << " channel input = " << std::endl; + printSupportedStandardSampleRates(inputParameters, portaudio::DirectionSpecificStreamParameters::null()); + } + if (outputParameters.numChannels() > 0) + { + std::cout << "Supported standard sample rates" << std::endl; + std::cout << " for half-duplex 16 bit " << outputParameters.numChannels() << " channel output = " << std::endl; + printSupportedStandardSampleRates(portaudio::DirectionSpecificStreamParameters::null(), outputParameters); + } + if (inputParameters.numChannels() > 0 && outputParameters.numChannels() > 0) + { + std::cout << "Supported standard sample rates" << std::endl; + std::cout << " for full-duplex 16 bit " << inputParameters.numChannels() << " channel input, " << outputParameters.numChannels() << " channel output = " << std::endl; + printSupportedStandardSampleRates(inputParameters, outputParameters); + } + } + std::cout << "----------------------------------------------" << std::endl; + } + catch (const portaudio::PaException &e) + { + std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl; + } + catch (const portaudio::PaCppException &e) + { + std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl; + } + catch (const std::exception &e) + { + std::cout << "A generic exception occured: " << e.what() << std::endl; + } + catch (...) + { + std::cout << "An unknown exception occured." << std::endl; + } + return 0; +} + + diff --git a/fdmdv2/pa_cppbinding_test/main.h b/fdmdv2/pa_cppbinding_test/main.h index fe0e9138..5684cd66 100644 --- a/fdmdv2/pa_cppbinding_test/main.h +++ b/fdmdv2/pa_cppbinding_test/main.h @@ -10,14 +10,16 @@ * Notes: Note that all GUI creation code is declared in * gui.h source file which is generated by wxFormBuilder. *********************************************************************/ - #ifndef __main__ #define __main__ // main wxWidgets header file #include #include -#include +#include "portaudiocpp/PortAudioCpp.hxx" +#ifdef WIN32 +#include "../extern/include/portaudiocpp/AsioDeviceAdapter.hxx" +#endif // gui classes generated by wxFormBuilder #include "gui.h" @@ -49,6 +51,10 @@ class MainFrame : public MainFrameBase // protected event handlers virtual void OnCloseFrame(wxCloseEvent& event); virtual void OnExitClick(wxCommandEvent& event); + void printSupportedStandardSampleRates( + const portaudio::DirectionSpecificStreamParameters &inputParameters, + const portaudio::DirectionSpecificStreamParameters &outputParameters); + int populateAudioInfo(); }; #endif //__main__ diff --git a/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.mk b/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.mk index 6d20f74e..7c2527c9 100644 --- a/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.mk +++ b/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.mk @@ -41,11 +41,11 @@ MakeDirCommand :=makedir CmpOptions := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) C_CmpOptions := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) LinkOptions := -mwindows -s $(shell wx-config --debug=no --libs --unicode=yes) -IncludePath := $(IncludeSwitch). $(IncludeSwitch)./ $(IncludeSwitch)../extern/include/ $(IncludeSwitch)../pa_cpp_binding/ +IncludePath := $(IncludeSwitch). $(IncludeSwitch)./ $(IncludeSwitch)C:/bin/MinGW/msys/1.0/local/include $(IncludeSwitch)./portaudiocpp IncludePCH := RcIncludePath := -Libs := -LibPath := $(LibraryPathSwitch). +Libs := $(LibrarySwitch)portaudiocpp.la $(LibrarySwitch)portaudio.la +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)../../extern/lib/ ## diff --git a/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.project b/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.project index 07b83817..066f5a17 100644 --- a/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.project +++ b/fdmdv2/pa_cppbinding_test/pa_cppbinding_test.project @@ -2,7 +2,7 @@ - + @@ -14,26 +14,28 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -52,7 +54,11 @@ - + + + + + @@ -87,11 +93,16 @@ - - + + - + + + + + +