summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portaudio/bindings/cpp/source
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/portaudio/bindings/cpp/source')
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx106
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx173
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx56
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CMakeLists.txt26
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx28
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx24
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx122
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Device.cxx288
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx308
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx232
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx218
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx70
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx1
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Stream.cxx366
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/StreamParameters.cxx307
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/System.cxx571
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx108
-rw-r--r--3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx107
18 files changed, 1558 insertions, 1553 deletions
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx
index 3efc100f62f..e7fd1ee5fa9 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx
@@ -9,75 +9,73 @@
namespace portaudio
{
- AsioDeviceAdapter::AsioDeviceAdapter(Device &device)
- {
- if (device.hostApi().typeId() != paASIO)
- throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE);
+ AsioDeviceAdapter::AsioDeviceAdapter(Device &device)
+ {
+ if (device.hostApi().typeId() != paASIO)
+ throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE);
- device_ = &device;
+ device_ = &device;
- PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_,
- &preferredBufferSize_, &granularity_);
+ PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_,
+ &preferredBufferSize_, &granularity_);
- if (err != paNoError)
- throw PaException(err);
+ if (err != paNoError)
+ throw PaException(err);
- }
+ }
- Device &AsioDeviceAdapter::device()
- {
- return *device_;
- }
+ Device &AsioDeviceAdapter::device()
+ {
+ return *device_;
+ }
- long AsioDeviceAdapter::minBufferSize() const
- {
- return minBufferSize_;
- }
+ long AsioDeviceAdapter::minBufferSize() const
+ {
+ return minBufferSize_;
+ }
- long AsioDeviceAdapter::maxBufferSize() const
- {
- return maxBufferSize_;
- }
+ long AsioDeviceAdapter::maxBufferSize() const
+ {
+ return maxBufferSize_;
+ }
- long AsioDeviceAdapter::preferredBufferSize() const
- {
- return preferredBufferSize_;
- }
+ long AsioDeviceAdapter::preferredBufferSize() const
+ {
+ return preferredBufferSize_;
+ }
- long AsioDeviceAdapter::granularity() const
- {
- return granularity_;
- }
+ long AsioDeviceAdapter::granularity() const
+ {
+ return granularity_;
+ }
- void AsioDeviceAdapter::showControlPanel(void *systemSpecific)
- {
- PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific);
+ void AsioDeviceAdapter::showControlPanel(void *systemSpecific)
+ {
+ PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific);
- if (err != paNoError)
- throw PaException(err);
- }
+ if (err != paNoError)
+ throw PaException(err);
+ }
- const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const
- {
- const char *channelName;
- PaError err = PaAsio_GetInputChannelName(device_->index(), channelIndex, &channelName);
+ const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const
+ {
+ const char *channelName;
+ PaError err = PaAsio_GetInputChannelName(device_->index(), channelIndex, &channelName);
- if (err != paNoError)
- throw PaException(err);
+ if (err != paNoError)
+ throw PaException(err);
- return channelName;
- }
+ return channelName;
+ }
- const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const
- {
- const char *channelName;
- PaError err = PaAsio_GetOutputChannelName(device_->index(), channelIndex, &channelName);
+ const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const
+ {
+ const char *channelName;
+ PaError err = PaAsio_GetOutputChannelName(device_->index(), channelIndex, &channelName);
- if (err != paNoError)
- throw PaException(err);
+ if (err != paNoError)
+ throw PaException(err);
- return channelName;
- }
+ return channelName;
+ }
}
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx
index b26b9e81a4f..751e1f21b7e 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx
@@ -8,93 +8,90 @@
namespace portaudio
{
- // --------------------------------------------------------------------------------------
-
- BlockingStream::BlockingStream()
- {
- }
-
- BlockingStream::BlockingStream(const StreamParameters &parameters)
- {
- open(parameters);
- }
-
- BlockingStream::~BlockingStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
-
- // --------------------------------------------------------------------------------------
-
- void BlockingStream::open(const StreamParameters &parameters)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- // --------------------------------------------------------------------------------------
-
- void BlockingStream::read(void *buffer, unsigned long numFrames)
- {
- PaError err = Pa_ReadStream(stream_, buffer, numFrames);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- void BlockingStream::write(const void *buffer, unsigned long numFrames)
- {
- PaError err = Pa_WriteStream(stream_, buffer, numFrames);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- // --------------------------------------------------------------------------------------
-
- signed long BlockingStream::availableReadSize() const
- {
- signed long avail = Pa_GetStreamReadAvailable(stream_);
-
- if (avail < 0)
- {
- throw PaException(avail);
- }
-
- return avail;
- }
-
- signed long BlockingStream::availableWriteSize() const
- {
- signed long avail = Pa_GetStreamWriteAvailable(stream_);
-
- if (avail < 0)
- {
- throw PaException(avail);
- }
-
- return avail;
- }
-
- // --------------------------------------------------------------------------------------
+ // --------------------------------------------------------------------------------------
+
+ BlockingStream::BlockingStream()
+ {
+ }
+
+ BlockingStream::BlockingStream(const StreamParameters &parameters)
+ {
+ open(parameters);
+ }
+
+ BlockingStream::~BlockingStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
+
+ // --------------------------------------------------------------------------------------
+
+ void BlockingStream::open(const StreamParameters &parameters)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ // --------------------------------------------------------------------------------------
+
+ void BlockingStream::read(void *buffer, unsigned long numFrames)
+ {
+ PaError err = Pa_ReadStream(stream_, buffer, numFrames);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ void BlockingStream::write(const void *buffer, unsigned long numFrames)
+ {
+ PaError err = Pa_WriteStream(stream_, buffer, numFrames);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ // --------------------------------------------------------------------------------------
+
+ signed long BlockingStream::availableReadSize() const
+ {
+ signed long avail = Pa_GetStreamReadAvailable(stream_);
+
+ if (avail < 0)
+ {
+ throw PaException(avail);
+ }
+
+ return avail;
+ }
+
+ signed long BlockingStream::availableWriteSize() const
+ {
+ signed long avail = Pa_GetStreamWriteAvailable(stream_);
+
+ if (avail < 0)
+ {
+ throw PaException(avail);
+ }
+
+ return avail;
+ }
+
+ // --------------------------------------------------------------------------------------
} // portaudio
-
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx
index 9cceda9ab9e..7dcc751d121 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx
@@ -5,37 +5,37 @@
namespace portaudio
{
- CFunCallbackStream::CFunCallbackStream()
- {
- }
+ CFunCallbackStream::CFunCallbackStream()
+ {
+ }
- CFunCallbackStream::CFunCallbackStream(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData)
- {
- open(parameters, funPtr, userData);
- }
+ CFunCallbackStream::CFunCallbackStream(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData)
+ {
+ open(parameters, funPtr, userData);
+ }
- CFunCallbackStream::~CFunCallbackStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
+ CFunCallbackStream::~CFunCallbackStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
- // ---------------------------------------------------------------------------------==
+ // ---------------------------------------------------------------------------------==
- void CFunCallbackStream::open(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData);
+ void CFunCallbackStream::open(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData);
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
}
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CMakeLists.txt b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CMakeLists.txt
new file mode 100644
index 00000000000..cd4954191d9
--- /dev/null
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CMakeLists.txt
@@ -0,0 +1,26 @@
+find_package(ASIO)
+if(ASIO_FOUND)
+ set(portaudio-cpp-sources-asio AsioDeviceAdapter.cxx PARENT_SCOPE)
+else()
+ set(portaudio-cpp-sources-asio PARENT_SCOPE)
+endif()
+
+set(portaudio-cpp-sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/BlockingStream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/CFunCallbackStream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/CallbackInterface.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/CallbackStream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/CppFunCallbackStream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/Device.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/DirectionSpecificStreamParameters.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/Exception.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/HostApi.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/InterfaceCallbackStream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/MemFunCallbackStream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/Stream.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/StreamParameters.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/System.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/SystemDeviceIterator.cxx
+ ${CMAKE_CURRENT_SOURCE_DIR}/SystemHostApiIterator.cxx
+ PARENT_SCOPE
+)
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
index 01372612e49..30ad933126e 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
@@ -3,23 +3,21 @@
namespace portaudio
{
- namespace impl
- {
+ namespace impl
+ {
- //////
- /// Adapts any CallbackInterface object to a C-callable function (ie this function). A
- /// pointer to the object should be passed as ``userData'' when setting up the callback.
- //////
- int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
- const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
- {
- CallbackInterface *cb = static_cast<CallbackInterface *>(userData);
- return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
- }
+ //////
+ /// Adapts any CallbackInterface object to a C-callable function (ie this function). A
+ /// pointer to the object should be passed as ``userData'' when setting up the callback.
+ //////
+ int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+ {
+ CallbackInterface *cb = static_cast<CallbackInterface *>(userData);
+ return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
+ }
- } // namespace impl
+ } // namespace impl
} // namespace portaudio
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx
index b6c8e1d03ee..d295a0a5ae0 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx
@@ -2,19 +2,19 @@
namespace portaudio
{
- CallbackStream::CallbackStream()
- {
- }
+ CallbackStream::CallbackStream()
+ {
+ }
- CallbackStream::~CallbackStream()
- {
- }
+ CallbackStream::~CallbackStream()
+ {
+ }
- // -----------------------------------------------------------------------------------
-
- double CallbackStream::cpuLoad() const
- {
- return Pa_GetStreamCpuLoad(stream_);
- }
+ // -----------------------------------------------------------------------------------
+
+ double CallbackStream::cpuLoad() const
+ {
+ return Pa_GetStreamCpuLoad(stream_);
+ }
} // namespace portaudio
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx
index fe0b4ab0cd5..19a76ee6ee6 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx
@@ -5,77 +5,77 @@
namespace portaudio
{
- namespace impl
- {
- //////
- /// Adapts any a C++ callback to a C-callable function (ie this function). A
- /// pointer to a struct with the C++ function pointer and the actual user data should be
- /// passed as the ``userData'' parameter when setting up the callback.
- //////
- int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
- const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
- {
- FunCallbackStream::CppToCCallbackData *data = static_cast<FunCallbackStream::CppToCCallbackData *>(userData);
- return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData);
- }
- }
+ namespace impl
+ {
+ //////
+ /// Adapts any a C++ callback to a C-callable function (ie this function). A
+ /// pointer to a struct with the C++ function pointer and the actual user data should be
+ /// passed as the ``userData'' parameter when setting up the callback.
+ //////
+ int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+ {
+ FunCallbackStream::CppToCCallbackData *data = static_cast<FunCallbackStream::CppToCCallbackData *>(userData);
+ return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData);
+ }
+ }
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
- FunCallbackStream::CppToCCallbackData::CppToCCallbackData()
- {
- }
+ FunCallbackStream::CppToCCallbackData::CppToCCallbackData()
+ {
+ }
- FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData)
- {
- }
+ FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData)
+ {
+ }
- void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData)
- {
- this->funPtr = funPtr;
- this->userData = userData;
- }
+ void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData)
+ {
+ this->funPtr = funPtr;
+ this->userData = userData;
+ }
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
- FunCallbackStream::FunCallbackStream()
- {
- }
+ FunCallbackStream::FunCallbackStream()
+ {
+ }
- FunCallbackStream::FunCallbackStream(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
- {
- open(parameters);
- }
+ FunCallbackStream::FunCallbackStream(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
+ {
+ open(parameters);
+ }
- FunCallbackStream::~FunCallbackStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
+ FunCallbackStream::~FunCallbackStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
- void FunCallbackStream::open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData)
- {
- adapterData_.init(funPtr, userData);
- open(parameters);
- }
+ void FunCallbackStream::open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData)
+ {
+ adapterData_.init(funPtr, userData);
+ open(parameters);
+ }
- void FunCallbackStream::open(const StreamParameters &parameters)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter,
- static_cast<void *>(&adapterData_));
+ void FunCallbackStream::open(const StreamParameters &parameters)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter,
+ static_cast<void *>(&adapterData_));
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
}
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Device.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Device.cxx
index 7b21b03ca52..727b7214480 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Device.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Device.cxx
@@ -9,160 +9,158 @@
namespace portaudio
{
- // -------------------------------------------------------------------------------
-
- Device::Device(PaDeviceIndex index) : index_(index)
- {
- if (index == paNoDevice)
- info_ = NULL;
- else
- info_ = Pa_GetDeviceInfo(index);
- }
-
- Device::~Device()
- {
- }
-
- PaDeviceIndex Device::index() const
- {
- return index_;
- }
-
- const char *Device::name() const
- {
- if (info_ == NULL)
- return "";
-
- return info_->name;
- }
-
- int Device::maxInputChannels() const
- {
- if (info_ == NULL)
- return 0;
-
- return info_->maxInputChannels;
- }
-
- int Device::maxOutputChannels() const
- {
- if (info_ == NULL)
- return 0;
-
- return info_->maxOutputChannels;
- }
-
- PaTime Device::defaultLowInputLatency() const
- {
- if (info_ == NULL)
- return static_cast<PaTime>(0.0);
-
- return info_->defaultLowInputLatency;
- }
-
- PaTime Device::defaultHighInputLatency() const
- {
- if (info_ == NULL)
- return static_cast<PaTime>(0.0);
-
- return info_->defaultHighInputLatency;
- }
-
- PaTime Device::defaultLowOutputLatency() const
- {
- if (info_ == NULL)
- return static_cast<PaTime>(0.0);
-
- return info_->defaultLowOutputLatency;
- }
-
- PaTime Device::defaultHighOutputLatency() const
- {
- if (info_ == NULL)
- return static_cast<PaTime>(0.0);
-
- return info_->defaultHighOutputLatency;
- }
-
- double Device::defaultSampleRate() const
- {
- if (info_ == NULL)
- return 0.0;
-
- return info_->defaultSampleRate;
- }
-
- // -------------------------------------------------------------------------------
-
- bool Device::isInputOnlyDevice() const
- {
- return (maxOutputChannels() == 0);
- }
-
- bool Device::isOutputOnlyDevice() const
- {
- return (maxInputChannels() == 0);
- }
-
- bool Device::isFullDuplexDevice() const
- {
- return (maxInputChannels() > 0 && maxOutputChannels() > 0);
- }
-
- bool Device::isSystemDefaultInputDevice() const
- {
- return (System::instance().defaultInputDevice() == *this);
- }
-
- bool Device::isSystemDefaultOutputDevice() const
- {
- return (System::instance().defaultOutputDevice() == *this);
- }
+ // -------------------------------------------------------------------------------
+
+ Device::Device(PaDeviceIndex index) : index_(index)
+ {
+ if (index == paNoDevice)
+ info_ = NULL;
+ else
+ info_ = Pa_GetDeviceInfo(index);
+ }
+
+ Device::~Device()
+ {
+ }
+
+ PaDeviceIndex Device::index() const
+ {
+ return index_;
+ }
+
+ const char *Device::name() const
+ {
+ if (info_ == NULL)
+ return "";
+
+ return info_->name;
+ }
+
+ int Device::maxInputChannels() const
+ {
+ if (info_ == NULL)
+ return 0;
+
+ return info_->maxInputChannels;
+ }
+
+ int Device::maxOutputChannels() const
+ {
+ if (info_ == NULL)
+ return 0;
+
+ return info_->maxOutputChannels;
+ }
+
+ PaTime Device::defaultLowInputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast<PaTime>(0.0);
+
+ return info_->defaultLowInputLatency;
+ }
+
+ PaTime Device::defaultHighInputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast<PaTime>(0.0);
+
+ return info_->defaultHighInputLatency;
+ }
+
+ PaTime Device::defaultLowOutputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast<PaTime>(0.0);
+
+ return info_->defaultLowOutputLatency;
+ }
+
+ PaTime Device::defaultHighOutputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast<PaTime>(0.0);
+
+ return info_->defaultHighOutputLatency;
+ }
+
+ double Device::defaultSampleRate() const
+ {
+ if (info_ == NULL)
+ return 0.0;
+
+ return info_->defaultSampleRate;
+ }
+
+ // -------------------------------------------------------------------------------
+
+ bool Device::isInputOnlyDevice() const
+ {
+ return (maxOutputChannels() == 0);
+ }
+
+ bool Device::isOutputOnlyDevice() const
+ {
+ return (maxInputChannels() == 0);
+ }
+
+ bool Device::isFullDuplexDevice() const
+ {
+ return (maxInputChannels() > 0 && maxOutputChannels() > 0);
+ }
+
+ bool Device::isSystemDefaultInputDevice() const
+ {
+ return (System::instance().defaultInputDevice() == *this);
+ }
+
+ bool Device::isSystemDefaultOutputDevice() const
+ {
+ return (System::instance().defaultOutputDevice() == *this);
+ }
- bool Device::isHostApiDefaultInputDevice() const
- {
- return (hostApi().defaultInputDevice() == *this);
- }
-
- bool Device::isHostApiDefaultOutputDevice() const
- {
- return (hostApi().defaultOutputDevice() == *this);
- }
+ bool Device::isHostApiDefaultInputDevice() const
+ {
+ return (hostApi().defaultInputDevice() == *this);
+ }
+
+ bool Device::isHostApiDefaultOutputDevice() const
+ {
+ return (hostApi().defaultOutputDevice() == *this);
+ }
- // -------------------------------------------------------------------------------
+ // -------------------------------------------------------------------------------
- bool Device::operator==(const Device &rhs) const
- {
- return (index_ == rhs.index_);
- }
+ bool Device::operator==(const Device &rhs) const
+ {
+ return (index_ == rhs.index_);
+ }
- bool Device::operator!=(const Device &rhs) const
- {
- return !(*this == rhs);
- }
+ bool Device::operator!=(const Device &rhs) const
+ {
+ return !(*this == rhs);
+ }
- // -------------------------------------------------------------------------------
+ // -------------------------------------------------------------------------------
- HostApi &Device::hostApi()
- {
- // NOTE: will cause an exception when called for the null device
- if (info_ == NULL)
- throw PaException(paInternalError);
+ HostApi &Device::hostApi()
+ {
+ // NOTE: will cause an exception when called for the null device
+ if (info_ == NULL)
+ throw PaException(paInternalError);
- return System::instance().hostApiByIndex(info_->hostApi);
- }
+ return System::instance().hostApiByIndex(info_->hostApi);
+ }
- const HostApi &Device::hostApi() const
- {
- // NOTE; will cause an exception when called for the null device
- if (info_ == NULL)
- throw PaException(paInternalError);
+ const HostApi &Device::hostApi() const
+ {
+ // NOTE; will cause an exception when called for the null device
+ if (info_ == NULL)
+ throw PaException(paInternalError);
- return System::instance().hostApiByIndex(info_->hostApi);
- }
+ return System::instance().hostApiByIndex(info_->hostApi);
+ }
- // -------------------------------------------------------------------------------
+ // -------------------------------------------------------------------------------
} // namespace portaudio
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx
index 68453d02121..558f2e2bb92 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx
@@ -5,159 +5,159 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- //////
- /// Returns a `nil' DirectionSpecificStreamParameters object. This can be used to
- /// specify that one direction of a Stream is not required (i.e. when creating
- /// a half-duplex Stream). All fields of the null DirectionSpecificStreamParameters
- /// object are invalid except for the device and the number of channel, which are set
- /// to paNoDevice and 0 respectively.
- //////
- DirectionSpecificStreamParameters DirectionSpecificStreamParameters::null()
- {
- DirectionSpecificStreamParameters tmp;
- tmp.paStreamParameters_.device = paNoDevice;
- tmp.paStreamParameters_.channelCount = 0;
- return tmp;
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Default constructor -- all parameters will be uninitialized.
- //////
- DirectionSpecificStreamParameters::DirectionSpecificStreamParameters()
- {
- }
-
- //////
- /// Constructor which sets all required fields.
- //////
- DirectionSpecificStreamParameters::DirectionSpecificStreamParameters(const Device &device, int numChannels,
- SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo)
- {
- setDevice(device);
- setNumChannels(numChannels);
- setSampleFormat(format, interleaved);
- setSuggestedLatency(suggestedLatency);
- setHostApiSpecificStreamInfo(hostApiSpecificStreamInfo);
- }
-
- // -----------------------------------------------------------------------------------
-
- void DirectionSpecificStreamParameters::setDevice(const Device &device)
- {
- paStreamParameters_.device = device.index();
- }
-
- void DirectionSpecificStreamParameters::setNumChannels(int numChannels)
- {
- paStreamParameters_.channelCount = numChannels;
- }
-
- void DirectionSpecificStreamParameters::setSampleFormat(SampleDataFormat format, bool interleaved)
- {
- paStreamParameters_.sampleFormat = static_cast<PaSampleFormat>(format);
-
- if (!interleaved)
- paStreamParameters_.sampleFormat |= paNonInterleaved;
- }
-
- void DirectionSpecificStreamParameters::setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved)
- {
- paStreamParameters_.sampleFormat = format;
-
- paStreamParameters_.sampleFormat |= paCustomFormat;
-
- if (!interleaved)
- paStreamParameters_.sampleFormat |= paNonInterleaved;
- }
-
- void DirectionSpecificStreamParameters::setSuggestedLatency(PaTime latency)
- {
- paStreamParameters_.suggestedLatency = latency;
- }
-
- void DirectionSpecificStreamParameters::setHostApiSpecificStreamInfo(void *streamInfo)
- {
- paStreamParameters_.hostApiSpecificStreamInfo = streamInfo;
- }
-
- // -----------------------------------------------------------------------------------
-
- PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters()
- {
- if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
- return &paStreamParameters_;
- else
- return NULL;
- }
-
- const PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() const
- {
- if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
- return &paStreamParameters_;
- else
- return NULL;
- }
-
- Device &DirectionSpecificStreamParameters::device() const
- {
- return System::instance().deviceByIndex(paStreamParameters_.device);
- }
-
- int DirectionSpecificStreamParameters::numChannels() const
- {
- return paStreamParameters_.channelCount;
- }
-
- //////
- /// Returns the (non host api-specific) sample format, without including
- /// the paNonInterleaved flag. If the sample format is host api-spefific,
- /// INVALID_FORMAT (0) will be returned.
- //////
- SampleDataFormat DirectionSpecificStreamParameters::sampleFormat() const
- {
- if (isSampleFormatHostApiSpecific())
- return INVALID_FORMAT;
- else
- return static_cast<SampleDataFormat>(paStreamParameters_.sampleFormat & ~paNonInterleaved);
- }
-
- bool DirectionSpecificStreamParameters::isSampleFormatInterleaved() const
- {
- return ((paStreamParameters_.sampleFormat & paNonInterleaved) == 0);
- }
-
- bool DirectionSpecificStreamParameters::isSampleFormatHostApiSpecific() const
- {
- return ((paStreamParameters_.sampleFormat & paCustomFormat) == 0);
- }
-
- //////
- /// Returns the host api-specific sample format, without including any
- /// paCustomFormat or paNonInterleaved flags. Will return 0 if the sample format is
- /// not host api-specific.
- //////
- PaSampleFormat DirectionSpecificStreamParameters::hostApiSpecificSampleFormat() const
- {
- if (isSampleFormatHostApiSpecific())
- return paStreamParameters_.sampleFormat & ~paCustomFormat & ~paNonInterleaved;
- else
- return 0;
- }
-
- PaTime DirectionSpecificStreamParameters::suggestedLatency() const
- {
- return paStreamParameters_.suggestedLatency;
- }
-
- void *DirectionSpecificStreamParameters::hostApiSpecificStreamInfo() const
- {
- return paStreamParameters_.hostApiSpecificStreamInfo;
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Returns a `nil' DirectionSpecificStreamParameters object. This can be used to
+ /// specify that one direction of a Stream is not required (i.e. when creating
+ /// a half-duplex Stream). All fields of the null DirectionSpecificStreamParameters
+ /// object are invalid except for the device and the number of channel, which are set
+ /// to paNoDevice and 0 respectively.
+ //////
+ DirectionSpecificStreamParameters DirectionSpecificStreamParameters::null()
+ {
+ DirectionSpecificStreamParameters tmp;
+ tmp.paStreamParameters_.device = paNoDevice;
+ tmp.paStreamParameters_.channelCount = 0;
+ return tmp;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Default constructor -- all parameters will be uninitialized.
+ //////
+ DirectionSpecificStreamParameters::DirectionSpecificStreamParameters()
+ {
+ }
+
+ //////
+ /// Constructor which sets all required fields.
+ //////
+ DirectionSpecificStreamParameters::DirectionSpecificStreamParameters(const Device &device, int numChannels,
+ SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo)
+ {
+ setDevice(device);
+ setNumChannels(numChannels);
+ setSampleFormat(format, interleaved);
+ setSuggestedLatency(suggestedLatency);
+ setHostApiSpecificStreamInfo(hostApiSpecificStreamInfo);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void DirectionSpecificStreamParameters::setDevice(const Device &device)
+ {
+ paStreamParameters_.device = device.index();
+ }
+
+ void DirectionSpecificStreamParameters::setNumChannels(int numChannels)
+ {
+ paStreamParameters_.channelCount = numChannels;
+ }
+
+ void DirectionSpecificStreamParameters::setSampleFormat(SampleDataFormat format, bool interleaved)
+ {
+ paStreamParameters_.sampleFormat = static_cast<PaSampleFormat>(format);
+
+ if (!interleaved)
+ paStreamParameters_.sampleFormat |= paNonInterleaved;
+ }
+
+ void DirectionSpecificStreamParameters::setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved)
+ {
+ paStreamParameters_.sampleFormat = format;
+
+ paStreamParameters_.sampleFormat |= paCustomFormat;
+
+ if (!interleaved)
+ paStreamParameters_.sampleFormat |= paNonInterleaved;
+ }
+
+ void DirectionSpecificStreamParameters::setSuggestedLatency(PaTime latency)
+ {
+ paStreamParameters_.suggestedLatency = latency;
+ }
+
+ void DirectionSpecificStreamParameters::setHostApiSpecificStreamInfo(void *streamInfo)
+ {
+ paStreamParameters_.hostApiSpecificStreamInfo = streamInfo;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters()
+ {
+ if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
+ return &paStreamParameters_;
+ else
+ return NULL;
+ }
+
+ const PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() const
+ {
+ if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
+ return &paStreamParameters_;
+ else
+ return NULL;
+ }
+
+ Device &DirectionSpecificStreamParameters::device() const
+ {
+ return System::instance().deviceByIndex(paStreamParameters_.device);
+ }
+
+ int DirectionSpecificStreamParameters::numChannels() const
+ {
+ return paStreamParameters_.channelCount;
+ }
+
+ //////
+ /// Returns the (non host api-specific) sample format, without including
+ /// the paNonInterleaved flag. If the sample format is host api-spefific,
+ /// INVALID_FORMAT (0) will be returned.
+ //////
+ SampleDataFormat DirectionSpecificStreamParameters::sampleFormat() const
+ {
+ if (isSampleFormatHostApiSpecific())
+ return INVALID_FORMAT;
+ else
+ return static_cast<SampleDataFormat>(paStreamParameters_.sampleFormat & ~paNonInterleaved);
+ }
+
+ bool DirectionSpecificStreamParameters::isSampleFormatInterleaved() const
+ {
+ return ((paStreamParameters_.sampleFormat & paNonInterleaved) == 0);
+ }
+
+ bool DirectionSpecificStreamParameters::isSampleFormatHostApiSpecific() const
+ {
+ return ((paStreamParameters_.sampleFormat & paCustomFormat) == 0);
+ }
+
+ //////
+ /// Returns the host api-specific sample format, without including any
+ /// paCustomFormat or paNonInterleaved flags. Will return 0 if the sample format is
+ /// not host api-specific.
+ //////
+ PaSampleFormat DirectionSpecificStreamParameters::hostApiSpecificSampleFormat() const
+ {
+ if (isSampleFormatHostApiSpecific())
+ return paStreamParameters_.sampleFormat & ~paCustomFormat & ~paNonInterleaved;
+ else
+ return 0;
+ }
+
+ PaTime DirectionSpecificStreamParameters::suggestedLatency() const
+ {
+ return paStreamParameters_.suggestedLatency;
+ }
+
+ void *DirectionSpecificStreamParameters::hostApiSpecificStreamInfo() const
+ {
+ return paStreamParameters_.hostApiSpecificStreamInfo;
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx
index 98945c81724..de8724d6745 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx
@@ -2,122 +2,120 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
- // PaException:
- // -----------------------------------------------------------------------------------
-
- //////
- /// Wraps a PortAudio error into a PortAudioCpp PaException.
- //////
- PaException::PaException(PaError error) : error_(error)
- {
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Alias for paErrorText(), to have std::exception compliance.
- //////
- const char *PaException::what() const throw()
- {
- return paErrorText();
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Returns the PortAudio error code (PaError).
- //////
- PaError PaException::paError() const
- {
- return error_;
- }
-
- //////
- /// Returns the error as a (zero-terminated) text string.
- //////
- const char *PaException::paErrorText() const
- {
- return Pa_GetErrorText(error_);
- }
-
- //////
- /// Returns true is the error is a HostApi error.
- //////
- bool PaException::isHostApiError() const
- {
- return (error_ == paUnanticipatedHostError);
- }
-
- //////
- /// Returns the last HostApi error (which is the current one if
- /// isHostApiError() returns true) as an error code.
- //////
- long PaException::lastHostApiError() const
- {
- return Pa_GetLastHostErrorInfo()->errorCode;
- }
-
- //////
- /// Returns the last HostApi error (which is the current one if
- /// isHostApiError() returns true) as a (zero-terminated) text
- /// string, if it's available.
- //////
- const char *PaException::lastHostApiErrorText() const
- {
- return Pa_GetLastHostErrorInfo()->errorText;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool PaException::operator==(const PaException &rhs) const
- {
- return (error_ == rhs.error_);
- }
-
- bool PaException::operator!=(const PaException &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
- // PaCppException:
- // -----------------------------------------------------------------------------------
-
- PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier)
- {
- }
-
- const char *PaCppException::what() const throw()
- {
- switch (specifier_)
- {
- case UNABLE_TO_ADAPT_DEVICE:
- {
- return "Unable to adapt the given device to the specified host api specific device extension";
- }
- }
-
- return "Unknown exception";
- }
-
- PaCppException::ExceptionSpecifier PaCppException::specifier() const
- {
- return specifier_;
- }
-
- bool PaCppException::operator==(const PaCppException &rhs) const
- {
- return (specifier_ == rhs.specifier_);
- }
-
- bool PaCppException::operator!=(const PaCppException &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+ // PaException:
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Wraps a PortAudio error into a PortAudioCpp PaException.
+ //////
+ PaException::PaException(PaError error) : error_(error)
+ {
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Alias for paErrorText(), to have std::exception compliance.
+ //////
+ const char *PaException::what() const throw()
+ {
+ return paErrorText();
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Returns the PortAudio error code (PaError).
+ //////
+ PaError PaException::paError() const
+ {
+ return error_;
+ }
+
+ //////
+ /// Returns the error as a (zero-terminated) text string.
+ //////
+ const char *PaException::paErrorText() const
+ {
+ return Pa_GetErrorText(error_);
+ }
+
+ //////
+ /// Returns true is the error is a HostApi error.
+ //////
+ bool PaException::isHostApiError() const
+ {
+ return (error_ == paUnanticipatedHostError);
+ }
+
+ //////
+ /// Returns the last HostApi error (which is the current one if
+ /// isHostApiError() returns true) as an error code.
+ //////
+ long PaException::lastHostApiError() const
+ {
+ return Pa_GetLastHostErrorInfo()->errorCode;
+ }
+
+ //////
+ /// Returns the last HostApi error (which is the current one if
+ /// isHostApiError() returns true) as a (zero-terminated) text
+ /// string, if it's available.
+ //////
+ const char *PaException::lastHostApiErrorText() const
+ {
+ return Pa_GetLastHostErrorInfo()->errorText;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool PaException::operator==(const PaException &rhs) const
+ {
+ return (error_ == rhs.error_);
+ }
+
+ bool PaException::operator!=(const PaException &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
+ // PaCppException:
+ // -----------------------------------------------------------------------------------
+
+ PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier)
+ {
+ }
+
+ const char *PaCppException::what() const throw()
+ {
+ switch (specifier_)
+ {
+ case UNABLE_TO_ADAPT_DEVICE:
+ {
+ return "Unable to adapt the given device to the specified host api specific device extension";
+ }
+ }
+
+ return "Unknown exception";
+ }
+
+ PaCppException::ExceptionSpecifier PaCppException::specifier() const
+ {
+ return specifier_;
+ }
+
+ bool PaCppException::operator==(const PaCppException &rhs) const
+ {
+ return (specifier_ == rhs.specifier_);
+ }
+
+ bool PaCppException::operator!=(const PaCppException &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx
index 6a09670c002..ecc235376c8 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx
@@ -8,114 +8,114 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- HostApi::HostApi(PaHostApiIndex index) : devices_(NULL)
- {
- try
- {
- info_ = Pa_GetHostApiInfo(index);
-
- // Create and populate devices array:
- int numDevices = deviceCount();
-
- devices_ = new Device*[numDevices];
-
- for (int i = 0; i < numDevices; ++i)
- {
- PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i);
-
- if (deviceIndex < 0)
- {
- throw PaException(deviceIndex);
- }
-
- devices_[i] = &System::instance().deviceByIndex(deviceIndex);
- }
- }
- catch (const std::exception &e)
- {
- // Delete any (partially) constructed objects (deconstructor isn't called):
- delete[] devices_; // devices_ is either NULL or valid
-
- // Re-throw exception:
- throw e;
- }
- }
-
- HostApi::~HostApi()
- {
- // Destroy devices array:
- delete[] devices_;
- }
-
- // -----------------------------------------------------------------------------------
-
- PaHostApiTypeId HostApi::typeId() const
- {
- return info_->type;
- }
-
- PaHostApiIndex HostApi::index() const
- {
- PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId());
-
- if (index < 0)
- throw PaException(index);
-
- return index;
- }
-
- const char *HostApi::name() const
- {
- return info_->name;
- }
-
- int HostApi::deviceCount() const
- {
- return info_->deviceCount;
- }
-
- // -----------------------------------------------------------------------------------
-
- HostApi::DeviceIterator HostApi::devicesBegin()
- {
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[0]; // begin (first element)
- return tmp;
- }
-
- HostApi::DeviceIterator HostApi::devicesEnd()
- {
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element)
- return tmp;
- }
-
- // -----------------------------------------------------------------------------------
-
- Device &HostApi::defaultInputDevice() const
- {
- return System::instance().deviceByIndex(info_->defaultInputDevice);
- }
-
- Device &HostApi::defaultOutputDevice() const
- {
- return System::instance().deviceByIndex(info_->defaultOutputDevice);
- }
-
- // -----------------------------------------------------------------------------------
-
- bool HostApi::operator==(const HostApi &rhs) const
- {
- return (typeId() == rhs.typeId());
- }
-
- bool HostApi::operator!=(const HostApi &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+
+ HostApi::HostApi(PaHostApiIndex index) : devices_(NULL)
+ {
+ try
+ {
+ info_ = Pa_GetHostApiInfo(index);
+
+ // Create and populate devices array:
+ int numDevices = deviceCount();
+
+ devices_ = new Device*[numDevices];
+
+ for (int i = 0; i < numDevices; ++i)
+ {
+ PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i);
+
+ if (deviceIndex < 0)
+ {
+ throw PaException(deviceIndex);
+ }
+
+ devices_[i] = &System::instance().deviceByIndex(deviceIndex);
+ }
+ }
+ catch (const std::exception &e)
+ {
+ // Delete any (partially) constructed objects (deconstructor isn't called):
+ delete[] devices_; // devices_ is either NULL or valid
+
+ // Re-throw exception:
+ throw e;
+ }
+ }
+
+ HostApi::~HostApi()
+ {
+ // Destroy devices array:
+ delete[] devices_;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ PaHostApiTypeId HostApi::typeId() const
+ {
+ return info_->type;
+ }
+
+ PaHostApiIndex HostApi::index() const
+ {
+ PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId());
+
+ if (index < 0)
+ throw PaException(index);
+
+ return index;
+ }
+
+ const char *HostApi::name() const
+ {
+ return info_->name;
+ }
+
+ int HostApi::deviceCount() const
+ {
+ return info_->deviceCount;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ HostApi::DeviceIterator HostApi::devicesBegin()
+ {
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[0]; // begin (first element)
+ return tmp;
+ }
+
+ HostApi::DeviceIterator HostApi::devicesEnd()
+ {
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element)
+ return tmp;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ Device &HostApi::defaultInputDevice() const
+ {
+ return System::instance().deviceByIndex(info_->defaultInputDevice);
+ }
+
+ Device &HostApi::defaultOutputDevice() const
+ {
+ return System::instance().deviceByIndex(info_->defaultOutputDevice);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool HostApi::operator==(const HostApi &rhs) const
+ {
+ return (typeId() == rhs.typeId());
+ }
+
+ bool HostApi::operator!=(const HostApi &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx
index 5433fa37321..fa761aa4d21 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx
@@ -7,39 +7,39 @@
namespace portaudio
{
- // ---------------------------------------------------------------------------------==
-
- InterfaceCallbackStream::InterfaceCallbackStream()
- {
- }
-
- InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters &parameters, CallbackInterface &instance)
- {
- open(parameters, instance);
- }
-
- InterfaceCallbackStream::~InterfaceCallbackStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
-
- // ---------------------------------------------------------------------------------==
-
- void InterfaceCallbackStream::open(const StreamParameters &parameters, CallbackInterface &instance)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast<void *>(&instance));
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
+ // ---------------------------------------------------------------------------------==
+
+ InterfaceCallbackStream::InterfaceCallbackStream()
+ {
+ }
+
+ InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters &parameters, CallbackInterface &instance)
+ {
+ open(parameters, instance);
+ }
+
+ InterfaceCallbackStream::~InterfaceCallbackStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
+
+ // ---------------------------------------------------------------------------------==
+
+ void InterfaceCallbackStream::open(const StreamParameters &parameters, CallbackInterface &instance)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast<void *>(&instance));
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
}
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx
index 5141de2aba0..4f955641eed 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx
@@ -1,4 +1,3 @@
#include "portaudiocpp/MemFunCallbackStream.hxx"
// (... template class ...)
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Stream.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Stream.cxx
index ba16e0335f9..c16a13c6f40 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Stream.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/Stream.cxx
@@ -8,188 +8,188 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- Stream::Stream() : stream_(NULL)
- {
- }
-
- Stream::~Stream()
- {
- // (can't call close here,
- // the derived class should atleast call
- // close() in it's deconstructor)
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Closes the Stream if it's open, else does nothing.
- //////
- void Stream::close()
- {
- if (isOpen() && System::exists())
- {
- PaError err = Pa_CloseStream(stream_);
- stream_ = NULL;
-
- if (err != paNoError)
- throw PaException(err);
- }
- }
-
- //////
- /// Returns true if the Stream is open.
- //////
- bool Stream::isOpen() const
- {
- return (stream_ != NULL);
- }
-
- // -----------------------------------------------------------------------------------
-
- void Stream::setStreamFinishedCallback(PaStreamFinishedCallback *callback)
- {
- PaError err = Pa_SetStreamFinishedCallback(stream_, callback);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- // -----------------------------------------------------------------------------------
-
- void Stream::start()
- {
- PaError err = Pa_StartStream(stream_);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- void Stream::stop()
- {
- PaError err = Pa_StopStream(stream_);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- void Stream::abort()
- {
- PaError err = Pa_AbortStream(stream_);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- bool Stream::isStopped() const
- {
- PaError ret = Pa_IsStreamStopped(stream_);
-
- if (ret < 0)
- throw PaException(ret);
-
- return (ret == 1);
- }
-
- bool Stream::isActive() const
- {
- PaError ret = Pa_IsStreamActive(stream_);
-
- if (ret < 0)
- throw PaException(ret);
-
- return (ret == 1);
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Returns the best known input latency for the Stream. This value may differ from the
- /// suggested input latency set in the StreamParameters. Includes all sources of
- /// latency known to PortAudio such as internal buffering, and Host API reported latency.
- /// Doesn't include any estimates of unknown latency.
- //////
- PaTime Stream::inputLatency() const
- {
- const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
- if (info == NULL)
- {
- throw PaException(paInternalError);
- return PaTime(0.0);
- }
-
- return info->inputLatency;
- }
-
- //////
- /// Returns the best known output latency for the Stream. This value may differ from the
- /// suggested output latency set in the StreamParameters. Includes all sources of
- /// latency known to PortAudio such as internal buffering, and Host API reported latency.
- /// Doesn't include any estimates of unknown latency.
- //////
- PaTime Stream::outputLatency() const
- {
- const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
- if (info == NULL)
- {
- throw PaException(paInternalError);
- return PaTime(0.0);
- }
-
- return info->outputLatency;
- }
-
- //////
- /// Returns the sample rate of the Stream. Usually this will be the
- /// best known estimate of the used sample rate. For instance when opening a
- /// Stream setting 44100.0 Hz in the StreamParameters, the actual sample
- /// rate might be something like 44103.2 Hz (due to imperfections in the
- /// sound card hardware).
- //////
- double Stream::sampleRate() const
- {
- const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
- if (info == NULL)
- {
- throw PaException(paInternalError);
- return 0.0;
- }
-
- return info->sampleRate;
- }
-
- // -----------------------------------------------------------------------------------
-
- PaTime Stream::time() const
- {
- return Pa_GetStreamTime(stream_);
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Accessor (const) for PortAudio PaStream pointer, useful for interfacing with
- /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
- /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
- /// functionality.
- //////
- const PaStream *Stream::paStream() const
- {
- return stream_;
- }
-
- //////
- /// Accessor (non-const) for PortAudio PaStream pointer, useful for interfacing with
- /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
- /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
- /// functionality.
- //////
- PaStream *Stream::paStream()
- {
- return stream_;
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+
+ Stream::Stream() : stream_(NULL)
+ {
+ }
+
+ Stream::~Stream()
+ {
+ // (can't call close here,
+ // the derived class should atleast call
+ // close() in it's deconstructor)
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Closes the Stream if it's open, else does nothing.
+ //////
+ void Stream::close()
+ {
+ if (isOpen() && System::exists())
+ {
+ PaError err = Pa_CloseStream(stream_);
+ stream_ = NULL;
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+ }
+
+ //////
+ /// Returns true if the Stream is open.
+ //////
+ bool Stream::isOpen() const
+ {
+ return (stream_ != NULL);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void Stream::setStreamFinishedCallback(PaStreamFinishedCallback *callback)
+ {
+ PaError err = Pa_SetStreamFinishedCallback(stream_, callback);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void Stream::start()
+ {
+ PaError err = Pa_StartStream(stream_);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ void Stream::stop()
+ {
+ PaError err = Pa_StopStream(stream_);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ void Stream::abort()
+ {
+ PaError err = Pa_AbortStream(stream_);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ bool Stream::isStopped() const
+ {
+ PaError ret = Pa_IsStreamStopped(stream_);
+
+ if (ret < 0)
+ throw PaException(ret);
+
+ return (ret == 1);
+ }
+
+ bool Stream::isActive() const
+ {
+ PaError ret = Pa_IsStreamActive(stream_);
+
+ if (ret < 0)
+ throw PaException(ret);
+
+ return (ret == 1);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Returns the best known input latency for the Stream. This value may differ from the
+ /// suggested input latency set in the StreamParameters. Includes all sources of
+ /// latency known to PortAudio such as internal buffering, and Host API reported latency.
+ /// Doesn't include any estimates of unknown latency.
+ //////
+ PaTime Stream::inputLatency() const
+ {
+ const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
+ if (info == NULL)
+ {
+ throw PaException(paInternalError);
+ return PaTime(0.0);
+ }
+
+ return info->inputLatency;
+ }
+
+ //////
+ /// Returns the best known output latency for the Stream. This value may differ from the
+ /// suggested output latency set in the StreamParameters. Includes all sources of
+ /// latency known to PortAudio such as internal buffering, and Host API reported latency.
+ /// Doesn't include any estimates of unknown latency.
+ //////
+ PaTime Stream::outputLatency() const
+ {
+ const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
+ if (info == NULL)
+ {
+ throw PaException(paInternalError);
+ return PaTime(0.0);
+ }
+
+ return info->outputLatency;
+ }
+
+ //////
+ /// Returns the sample rate of the Stream. Usually this will be the
+ /// best known estimate of the used sample rate. For instance when opening a
+ /// Stream setting 44100.0 Hz in the StreamParameters, the actual sample
+ /// rate might be something like 44103.2 Hz (due to imperfections in the
+ /// sound card hardware).
+ //////
+ double Stream::sampleRate() const
+ {
+ const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
+ if (info == NULL)
+ {
+ throw PaException(paInternalError);
+ return 0.0;
+ }
+
+ return info->sampleRate;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ PaTime Stream::time() const
+ {
+ return Pa_GetStreamTime(stream_);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Accessor (const) for PortAudio PaStream pointer, useful for interfacing with
+ /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
+ /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
+ /// functionality.
+ //////
+ const PaStream *Stream::paStream() const
+ {
+ return stream_;
+ }
+
+ //////
+ /// Accessor (non-const) for PortAudio PaStream pointer, useful for interfacing with
+ /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
+ /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
+ /// functionality.
+ //////
+ PaStream *Stream::paStream()
+ {
+ return stream_;
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/StreamParameters.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/StreamParameters.cxx
index 5b9e89716a2..11de3094d52 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/StreamParameters.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/StreamParameters.cxx
@@ -6,160 +6,155 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- //////
- /// Default constructor; does nothing.
- //////
- StreamParameters::StreamParameters()
- {
- }
-
- //////
- /// Sets up the all parameters needed to open either a half-duplex or full-duplex Stream.
- ///
- /// @param inputParameters The parameters for the input direction of the to-be opened
- /// Stream or DirectionSpecificStreamParameters::null() for an output-only Stream.
- /// @param outputParameters The parameters for the output direction of the to-be opened
- /// Stream or DirectionSpecificStreamParameters::null() for an input-only Stream.
- /// @param sampleRate The to-be opened Stream's sample rate in Hz.
- /// @param framesPerBuffer The number of frames per buffer for a CallbackStream, or
- /// the preferred buffer granularity for a BlockingStream.
- /// @param flags The flags for the to-be opened Stream; default paNoFlag.
- //////
- StreamParameters::StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
- const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer,
- PaStreamFlags flags) : inputParameters_(inputParameters), outputParameters_(outputParameters),
- sampleRate_(sampleRate), framesPerBuffer_(framesPerBuffer), flags_(flags)
- {
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Sets the requested sample rate. If this sample rate isn't supported by the hardware, the
- /// Stream will fail to open. The real-life sample rate used might differ slightly due to
- /// imperfections in the sound card hardware; use Stream::sampleRate() to retreive the
- /// best known estimate for this value.
- //////
- void StreamParameters::setSampleRate(double sampleRate)
- {
- sampleRate_ = sampleRate;
- }
-
- //////
- /// Either the number of frames per buffer for a CallbackStream, or
- /// the preferred buffer granularity for a BlockingStream. See PortAudio
- /// documentation.
- //////
- void StreamParameters::setFramesPerBuffer(unsigned long framesPerBuffer)
- {
- framesPerBuffer_ = framesPerBuffer;
- }
-
- //////
- /// Sets the specified flag or does nothing when the flag is already set. Doesn't
- /// `unset' any previously existing flags (use clearFlags() for that).
- //////
- void StreamParameters::setFlag(PaStreamFlags flag)
- {
- flags_ |= flag;
- }
-
- //////
- /// Unsets the specified flag or does nothing if the flag isn't set. Doesn't affect
- /// any other flags.
- //////
- void StreamParameters::unsetFlag(PaStreamFlags flag)
- {
- flags_ &= ~flag;
- }
-
- //////
- /// Clears or `unsets' all set flags.
- //////
- void StreamParameters::clearFlags()
- {
- flags_ = paNoFlag;
- }
-
- // -----------------------------------------------------------------------------------
-
- void StreamParameters::setInputParameters(const DirectionSpecificStreamParameters &parameters)
- {
- inputParameters_ = parameters;
- }
-
- void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters &parameters)
- {
- outputParameters_ = parameters;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool StreamParameters::isSupported() const
- {
- return (Pa_IsFormatSupported(inputParameters_.paStreamParameters(),
- outputParameters_.paStreamParameters(), sampleRate_) == paFormatIsSupported);
- }
-
- // -----------------------------------------------------------------------------------
-
- double StreamParameters::sampleRate() const
- {
- return sampleRate_;
- }
-
- unsigned long StreamParameters::framesPerBuffer() const
- {
- return framesPerBuffer_;
- }
-
- //////
- /// Returns all currently set flags as a binary combined
- /// integer value (PaStreamFlags). Use isFlagSet() to
- /// avoid dealing with the bitmasks.
- //////
- PaStreamFlags StreamParameters::flags() const
- {
- return flags_;
- }
-
- //////
- /// Returns true if the specified flag is currently set
- /// or false if it isn't.
- //////
- bool StreamParameters::isFlagSet(PaStreamFlags flag) const
- {
- return ((flags_ & flag) != 0);
- }
-
- // -----------------------------------------------------------------------------------
-
- DirectionSpecificStreamParameters &StreamParameters::inputParameters()
- {
- return inputParameters_;
- }
-
- const DirectionSpecificStreamParameters &StreamParameters::inputParameters() const
- {
- return inputParameters_;
- }
-
- DirectionSpecificStreamParameters &StreamParameters::outputParameters()
- {
- return outputParameters_;
- }
-
- const DirectionSpecificStreamParameters &StreamParameters::outputParameters() const
- {
- return outputParameters_;
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Default constructor; does nothing.
+ //////
+ StreamParameters::StreamParameters()
+ {
+ }
+
+ //////
+ /// Sets up the all parameters needed to open either a half-duplex or full-duplex Stream.
+ ///
+ /// @param inputParameters The parameters for the input direction of the to-be opened
+ /// Stream or DirectionSpecificStreamParameters::null() for an output-only Stream.
+ /// @param outputParameters The parameters for the output direction of the to-be opened
+ /// Stream or DirectionSpecificStreamParameters::null() for an input-only Stream.
+ /// @param sampleRate The to-be opened Stream's sample rate in Hz.
+ /// @param framesPerBuffer The number of frames per buffer for a CallbackStream, or
+ /// the preferred buffer granularity for a BlockingStream.
+ /// @param flags The flags for the to-be opened Stream; default paNoFlag.
+ //////
+ StreamParameters::StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
+ const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer,
+ PaStreamFlags flags) : inputParameters_(inputParameters), outputParameters_(outputParameters),
+ sampleRate_(sampleRate), framesPerBuffer_(framesPerBuffer), flags_(flags)
+ {
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Sets the requested sample rate. If this sample rate isn't supported by the hardware, the
+ /// Stream will fail to open. The real-life sample rate used might differ slightly due to
+ /// imperfections in the sound card hardware; use Stream::sampleRate() to retrieve the
+ /// best known estimate for this value.
+ //////
+ void StreamParameters::setSampleRate(double sampleRate)
+ {
+ sampleRate_ = sampleRate;
+ }
+
+ //////
+ /// Either the number of frames per buffer for a CallbackStream, or
+ /// the preferred buffer granularity for a BlockingStream. See PortAudio
+ /// documentation.
+ //////
+ void StreamParameters::setFramesPerBuffer(unsigned long framesPerBuffer)
+ {
+ framesPerBuffer_ = framesPerBuffer;
+ }
+
+ //////
+ /// Sets the specified flag or does nothing when the flag is already set. Doesn't
+ /// `unset' any previously existing flags (use clearFlags() for that).
+ //////
+ void StreamParameters::setFlag(PaStreamFlags flag)
+ {
+ flags_ |= flag;
+ }
+
+ //////
+ /// Unsets the specified flag or does nothing if the flag isn't set. Doesn't affect
+ /// any other flags.
+ //////
+ void StreamParameters::unsetFlag(PaStreamFlags flag)
+ {
+ flags_ &= ~flag;
+ }
+
+ //////
+ /// Clears or `unsets' all set flags.
+ //////
+ void StreamParameters::clearFlags()
+ {
+ flags_ = paNoFlag;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void StreamParameters::setInputParameters(const DirectionSpecificStreamParameters &parameters)
+ {
+ inputParameters_ = parameters;
+ }
+
+ void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters &parameters)
+ {
+ outputParameters_ = parameters;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool StreamParameters::isSupported() const
+ {
+ return (Pa_IsFormatSupported(inputParameters_.paStreamParameters(),
+ outputParameters_.paStreamParameters(), sampleRate_) == paFormatIsSupported);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ double StreamParameters::sampleRate() const
+ {
+ return sampleRate_;
+ }
+
+ unsigned long StreamParameters::framesPerBuffer() const
+ {
+ return framesPerBuffer_;
+ }
+
+ //////
+ /// Returns all currently set flags as a binary combined
+ /// integer value (PaStreamFlags). Use isFlagSet() to
+ /// avoid dealing with the bitmasks.
+ //////
+ PaStreamFlags StreamParameters::flags() const
+ {
+ return flags_;
+ }
+
+ //////
+ /// Returns true if the specified flag is currently set
+ /// or false if it isn't.
+ //////
+ bool StreamParameters::isFlagSet(PaStreamFlags flag) const
+ {
+ return ((flags_ & flag) != 0);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ DirectionSpecificStreamParameters &StreamParameters::inputParameters()
+ {
+ return inputParameters_;
+ }
+
+ const DirectionSpecificStreamParameters &StreamParameters::inputParameters() const
+ {
+ return inputParameters_;
+ }
+
+ DirectionSpecificStreamParameters &StreamParameters::outputParameters()
+ {
+ return outputParameters_;
+ }
+
+ const DirectionSpecificStreamParameters &StreamParameters::outputParameters() const
+ {
+ return outputParameters_;
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
-
-
-
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/System.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/System.cxx
index acb419d4aa8..1e03dc884a7 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/System.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/System.cxx
@@ -12,297 +12,296 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- // Static members:
- System *System::instance_ = NULL;
- int System::initCount_ = 0;
- HostApi **System::hostApis_ = NULL;
- Device **System::devices_ = NULL;
- Device *System::nullDevice_ = NULL;
-
- // -----------------------------------------------------------------------------------
-
- int System::version()
- {
- return Pa_GetVersion();
- }
-
- const char *System::versionText()
- {
- return Pa_GetVersionText();
- }
-
- void System::initialize()
- {
- ++initCount_;
-
- if (initCount_ == 1)
- {
- // Create singleton:
- assert(instance_ == NULL);
- instance_ = new System();
-
- // Initialize the PortAudio system:
- {
- PaError err = Pa_Initialize();
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- // Create and populate device array:
- {
- int numDevices = instance().deviceCount();
-
- devices_ = new Device*[numDevices];
-
- for (int i = 0; i < numDevices; ++i)
- devices_[i] = new Device(i);
- }
-
- // Create and populate host api array:
- {
- int numHostApis = instance().hostApiCount();
-
- hostApis_ = new HostApi*[numHostApis];
-
- for (int i = 0; i < numHostApis; ++i)
- hostApis_[i] = new HostApi(i);
- }
-
- // Create null device:
- nullDevice_ = new Device(paNoDevice);
- }
- }
-
- void System::terminate()
- {
- PaError err = paNoError;
-
- if (initCount_ == 1)
- {
- // Destroy null device:
- delete nullDevice_;
-
- // Destroy host api array:
- {
- if (hostApis_ != NULL)
- {
- int numHostApis = instance().hostApiCount();
-
- for (int i = 0; i < numHostApis; ++i)
- delete hostApis_[i];
-
- delete[] hostApis_;
- hostApis_ = NULL;
- }
- }
+ // -----------------------------------------------------------------------------------
+
+ // Static members:
+ System *System::instance_ = NULL;
+ int System::initCount_ = 0;
+ HostApi **System::hostApis_ = NULL;
+ Device **System::devices_ = NULL;
+ Device *System::nullDevice_ = NULL;
+
+ // -----------------------------------------------------------------------------------
+
+ int System::version()
+ {
+ return Pa_GetVersion();
+ }
+
+ const char *System::versionText()
+ {
+ return Pa_GetVersionText();
+ }
+
+ void System::initialize()
+ {
+ ++initCount_;
- // Destroy device array:
- {
- if (devices_ != NULL)
- {
- int numDevices = instance().deviceCount();
+ if (initCount_ == 1)
+ {
+ // Create singleton:
+ assert(instance_ == NULL);
+ instance_ = new System();
- for (int i = 0; i < numDevices; ++i)
- delete devices_[i];
+ // Initialize the PortAudio system:
+ {
+ PaError err = Pa_Initialize();
- delete[] devices_;
- devices_ = NULL;
- }
- }
+ if (err != paNoError)
+ throw PaException(err);
+ }
- // Terminate the PortAudio system:
- assert(instance_ != NULL);
- err = Pa_Terminate();
+ // Create and populate device array:
+ {
+ int numDevices = instance().deviceCount();
- // Destroy singleton:
- delete instance_;
- instance_ = NULL;
- }
+ devices_ = new Device*[numDevices];
+
+ for (int i = 0; i < numDevices; ++i)
+ devices_[i] = new Device(i);
+ }
+
+ // Create and populate host api array:
+ {
+ int numHostApis = instance().hostApiCount();
+
+ hostApis_ = new HostApi*[numHostApis];
- if (initCount_ > 0)
- --initCount_;
-
- if (err != paNoError)
- throw PaException(err);
- }
-
-
- System &System::instance()
- {
- assert(exists());
-
- return *instance_;
- }
-
- bool System::exists()
- {
- return (instance_ != NULL);
- }
-
- // -----------------------------------------------------------------------------------
-
- System::HostApiIterator System::hostApisBegin()
- {
- System::HostApiIterator tmp;
- tmp.ptr_ = &hostApis_[0]; // begin (first element)
- return tmp;
- }
-
- System::HostApiIterator System::hostApisEnd()
- {
- int count = hostApiCount();
-
- System::HostApiIterator tmp;
- tmp.ptr_ = &hostApis_[count]; // end (one past last element)
- return tmp;
- }
-
- HostApi &System::defaultHostApi()
- {
- PaHostApiIndex defaultHostApi = Pa_GetDefaultHostApi();
-
- if (defaultHostApi < 0)
- throw PaException(defaultHostApi);
-
- return *hostApis_[defaultHostApi];
- }
-
- HostApi &System::hostApiByTypeId(PaHostApiTypeId type)
- {
- PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(type);
-
- if (index < 0)
- throw PaException(index);
-
- return *hostApis_[index];
- }
-
- HostApi &System::hostApiByIndex(PaHostApiIndex index)
- {
- if (index < 0 || index >= hostApiCount())
- throw PaException(paInternalError);
-
- return *hostApis_[index];
- }
-
- int System::hostApiCount()
- {
- PaHostApiIndex count = Pa_GetHostApiCount();
-
- if (count < 0)
- throw PaException(count);
-
- return count;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::DeviceIterator System::devicesBegin()
- {
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[0];
-
- return tmp;
- }
-
- System::DeviceIterator System::devicesEnd()
- {
- int count = deviceCount();
-
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[count];
-
- return tmp;
- }
-
- //////
- /// Returns the System's default input Device, or the null Device if none
- /// was available.
- //////
- Device &System::defaultInputDevice()
- {
- PaDeviceIndex index = Pa_GetDefaultInputDevice();
- return deviceByIndex(index);
- }
-
- //////
- /// Returns the System's default output Device, or the null Device if none
- /// was available.
- //////
- Device &System::defaultOutputDevice()
- {
- PaDeviceIndex index = Pa_GetDefaultOutputDevice();
- return deviceByIndex(index);
- }
-
- //////
- /// Returns the Device for the given index.
- /// Will throw a paInternalError equivalent PaException if the given index
- /// is out of range.
- //////
- Device &System::deviceByIndex(PaDeviceIndex index)
- {
- if (index < -1 || index >= deviceCount())
- {
- throw PaException(paInternalError);
- }
-
- if (index == -1)
- return System::instance().nullDevice();
-
- return *devices_[index];
- }
-
- int System::deviceCount()
- {
- PaDeviceIndex count = Pa_GetDeviceCount();
-
- if (count < 0)
- throw PaException(count);
-
- return count;
- }
-
- Device &System::nullDevice()
- {
- return *nullDevice_;
- }
-
- // -----------------------------------------------------------------------------------
-
- void System::sleep(long msec)
- {
- Pa_Sleep(msec);
- }
-
- int System::sizeOfSample(PaSampleFormat format)
- {
- PaError err = Pa_GetSampleSize(format);
- if (err < 0)
- {
- throw PaException(err);
- return 0;
- }
-
- return err;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::System()
- {
- // (left blank intentionally)
- }
-
- System::~System()
- {
- // (left blank intentionally)
- }
-
- // -----------------------------------------------------------------------------------
+ for (int i = 0; i < numHostApis; ++i)
+ hostApis_[i] = new HostApi(i);
+ }
-} // namespace portaudio
+ // Create null device:
+ nullDevice_ = new Device(paNoDevice);
+ }
+ }
+
+ void System::terminate()
+ {
+ PaError err = paNoError;
+
+ if (initCount_ == 1)
+ {
+ // Destroy null device:
+ delete nullDevice_;
+
+ // Destroy host api array:
+ {
+ if (hostApis_ != NULL)
+ {
+ int numHostApis = instance().hostApiCount();
+
+ for (int i = 0; i < numHostApis; ++i)
+ delete hostApis_[i];
+
+ delete[] hostApis_;
+ hostApis_ = NULL;
+ }
+ }
+
+ // Destroy device array:
+ {
+ if (devices_ != NULL)
+ {
+ int numDevices = instance().deviceCount();
+
+ for (int i = 0; i < numDevices; ++i)
+ delete devices_[i];
+
+ delete[] devices_;
+ devices_ = NULL;
+ }
+ }
+ // Terminate the PortAudio system:
+ assert(instance_ != NULL);
+ err = Pa_Terminate();
+
+ // Destroy singleton:
+ delete instance_;
+ instance_ = NULL;
+ }
+
+ if (initCount_ > 0)
+ --initCount_;
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+
+ System &System::instance()
+ {
+ assert(exists());
+
+ return *instance_;
+ }
+
+ bool System::exists()
+ {
+ return (instance_ != NULL);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::HostApiIterator System::hostApisBegin()
+ {
+ System::HostApiIterator tmp;
+ tmp.ptr_ = &hostApis_[0]; // begin (first element)
+ return tmp;
+ }
+
+ System::HostApiIterator System::hostApisEnd()
+ {
+ int count = hostApiCount();
+
+ System::HostApiIterator tmp;
+ tmp.ptr_ = &hostApis_[count]; // end (one past last element)
+ return tmp;
+ }
+
+ HostApi &System::defaultHostApi()
+ {
+ PaHostApiIndex defaultHostApi = Pa_GetDefaultHostApi();
+
+ if (defaultHostApi < 0)
+ throw PaException(defaultHostApi);
+
+ return *hostApis_[defaultHostApi];
+ }
+
+ HostApi &System::hostApiByTypeId(PaHostApiTypeId type)
+ {
+ PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(type);
+
+ if (index < 0)
+ throw PaException(index);
+
+ return *hostApis_[index];
+ }
+
+ HostApi &System::hostApiByIndex(PaHostApiIndex index)
+ {
+ if (index < 0 || index >= hostApiCount())
+ throw PaException(paInternalError);
+
+ return *hostApis_[index];
+ }
+
+ int System::hostApiCount()
+ {
+ PaHostApiIndex count = Pa_GetHostApiCount();
+
+ if (count < 0)
+ throw PaException(count);
+
+ return count;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::DeviceIterator System::devicesBegin()
+ {
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[0];
+
+ return tmp;
+ }
+
+ System::DeviceIterator System::devicesEnd()
+ {
+ int count = deviceCount();
+
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[count];
+
+ return tmp;
+ }
+
+ //////
+ /// Returns the System's default input Device, or the null Device if none
+ /// was available.
+ //////
+ Device &System::defaultInputDevice()
+ {
+ PaDeviceIndex index = Pa_GetDefaultInputDevice();
+ return deviceByIndex(index);
+ }
+
+ //////
+ /// Returns the System's default output Device, or the null Device if none
+ /// was available.
+ //////
+ Device &System::defaultOutputDevice()
+ {
+ PaDeviceIndex index = Pa_GetDefaultOutputDevice();
+ return deviceByIndex(index);
+ }
+
+ //////
+ /// Returns the Device for the given index.
+ /// Will throw a paInternalError equivalent PaException if the given index
+ /// is out of range.
+ //////
+ Device &System::deviceByIndex(PaDeviceIndex index)
+ {
+ if (index < -1 || index >= deviceCount())
+ {
+ throw PaException(paInternalError);
+ }
+
+ if (index == -1)
+ return System::instance().nullDevice();
+
+ return *devices_[index];
+ }
+
+ int System::deviceCount()
+ {
+ PaDeviceIndex count = Pa_GetDeviceCount();
+
+ if (count < 0)
+ throw PaException(count);
+
+ return count;
+ }
+
+ Device &System::nullDevice()
+ {
+ return *nullDevice_;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void System::sleep(long msec)
+ {
+ Pa_Sleep(msec);
+ }
+
+ int System::sizeOfSample(PaSampleFormat format)
+ {
+ PaError err = Pa_GetSampleSize(format);
+ if (err < 0)
+ {
+ throw PaException(err);
+ return 0;
+ }
+
+ return err;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::System()
+ {
+ // (left blank intentionally)
+ }
+
+ System::~System()
+ {
+ // (left blank intentionally)
+ }
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx
index f94cf10aab2..72dddbc32e2 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx
@@ -2,59 +2,57 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- Device &System::DeviceIterator::operator*() const
- {
- return **ptr_;
- }
-
- Device *System::DeviceIterator::operator->() const
- {
- return &**this;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::DeviceIterator &System::DeviceIterator::operator++()
- {
- ++ptr_;
- return *this;
- }
-
- System::DeviceIterator System::DeviceIterator::operator++(int)
- {
- System::DeviceIterator prev = *this;
- ++*this;
- return prev;
- }
-
- System::DeviceIterator &System::DeviceIterator::operator--()
- {
- --ptr_;
- return *this;
- }
-
- System::DeviceIterator System::DeviceIterator::operator--(int)
- {
- System::DeviceIterator prev = *this;
- --*this;
- return prev;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const
- {
- return (ptr_ == rhs.ptr_);
- }
-
- bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+
+ Device &System::DeviceIterator::operator*() const
+ {
+ return **ptr_;
+ }
+
+ Device *System::DeviceIterator::operator->() const
+ {
+ return &**this;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::DeviceIterator &System::DeviceIterator::operator++()
+ {
+ ++ptr_;
+ return *this;
+ }
+
+ System::DeviceIterator System::DeviceIterator::operator++(int)
+ {
+ System::DeviceIterator prev = *this;
+ ++*this;
+ return prev;
+ }
+
+ System::DeviceIterator &System::DeviceIterator::operator--()
+ {
+ --ptr_;
+ return *this;
+ }
+
+ System::DeviceIterator System::DeviceIterator::operator--(int)
+ {
+ System::DeviceIterator prev = *this;
+ --*this;
+ return prev;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const
+ {
+ return (ptr_ == rhs.ptr_);
+ }
+
+ bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
-
-
diff --git a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx
index 03f2d6e47bd..bca25fc1d49 100644
--- a/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx
+++ b/3rdparty/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx
@@ -2,58 +2,57 @@
namespace portaudio
{
- // -----------------------------------------------------------------------------------
-
- HostApi &System::HostApiIterator::operator*() const
- {
- return **ptr_;
- }
-
- HostApi *System::HostApiIterator::operator->() const
- {
- return &**this;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::HostApiIterator &System::HostApiIterator::operator++()
- {
- ++ptr_;
- return *this;
- }
-
- System::HostApiIterator System::HostApiIterator::operator++(int)
- {
- System::HostApiIterator prev = *this;
- ++*this;
- return prev;
- }
-
- System::HostApiIterator &System::HostApiIterator::operator--()
- {
- --ptr_;
- return *this;
- }
-
- System::HostApiIterator System::HostApiIterator::operator--(int)
- {
- System::HostApiIterator prev = *this;
- --*this;
- return prev;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const
- {
- return (ptr_ == rhs.ptr_);
- }
-
- bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------------
+
+ HostApi &System::HostApiIterator::operator*() const
+ {
+ return **ptr_;
+ }
+
+ HostApi *System::HostApiIterator::operator->() const
+ {
+ return &**this;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::HostApiIterator &System::HostApiIterator::operator++()
+ {
+ ++ptr_;
+ return *this;
+ }
+
+ System::HostApiIterator System::HostApiIterator::operator++(int)
+ {
+ System::HostApiIterator prev = *this;
+ ++*this;
+ return prev;
+ }
+
+ System::HostApiIterator &System::HostApiIterator::operator--()
+ {
+ --ptr_;
+ return *this;
+ }
+
+ System::HostApiIterator System::HostApiIterator::operator--(int)
+ {
+ System::HostApiIterator prev = *this;
+ --*this;
+ return prev;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const
+ {
+ return (ptr_ == rhs.ptr_);
+ }
+
+ bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
} // namespace portaudio
-