summaryrefslogtreecommitdiff
path: root/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-25 14:54:53 -0500
committersanine <sanine.not@pm.me>2022-08-25 14:54:53 -0500
commit37c97e345d12f95dde44e1d1a4c2f2aadd4615bc (patch)
treee1bb25bc855883062bdd7847ff2c04290f71c840 /portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
parent5634c7b04da619669f2f29f6798c03982be05180 (diff)
add initial structure
Diffstat (limited to 'portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx')
-rw-r--r--portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx b/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
new file mode 100644
index 0000000..0137261
--- /dev/null
+++ b/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
@@ -0,0 +1,25 @@
+#include "portaudiocpp/CallbackInterface.hxx"
+
+namespace portaudio
+{
+
+ 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);
+ }
+
+
+ } // namespace impl
+
+} // namespace portaudio
+
+