To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at https://github.com/sonic-visualiser/sv-dependency-builds .
This repository is a read-only copy which is updated automatically every hour.
root / src / portaudio_20161030_catalina_patch / bindings / cpp / include / portaudiocpp / CppFunCallbackStream.hxx @ 162:d43aab368df9
History | View | Annotate | Download (2.46 KB)
| 1 |
#ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX |
|---|---|
| 2 |
#define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX |
| 3 |
|
| 4 |
// --------------------------------------------------------------------------------------- |
| 5 |
|
| 6 |
#include "portaudio.h" |
| 7 |
|
| 8 |
#include "portaudiocpp/CallbackStream.hxx" |
| 9 |
|
| 10 |
// --------------------------------------------------------------------------------------- |
| 11 |
|
| 12 |
// Forward declaration(s): |
| 13 |
namespace portaudio |
| 14 |
{
|
| 15 |
class StreamParameters; |
| 16 |
} |
| 17 |
|
| 18 |
// --------------------------------------------------------------------------------------- |
| 19 |
|
| 20 |
// Declaration(s): |
| 21 |
namespace portaudio |
| 22 |
{
|
| 23 |
|
| 24 |
|
| 25 |
namespace impl |
| 26 |
{
|
| 27 |
extern "C" |
| 28 |
{
|
| 29 |
int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, |
| 30 |
const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, |
| 31 |
void *userData); |
| 32 |
} // extern "C" |
| 33 |
} |
| 34 |
|
| 35 |
// ----------------------------------------------------------------------------------- |
| 36 |
|
| 37 |
////// |
| 38 |
/// @brief Callback stream using a C++ function (either a free function or a static function) |
| 39 |
/// callback. |
| 40 |
////// |
| 41 |
class FunCallbackStream : public CallbackStream |
| 42 |
{
|
| 43 |
public: |
| 44 |
typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, |
| 45 |
const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, |
| 46 |
void *userData); |
| 47 |
|
| 48 |
// ------------------------------------------------------------------------------- |
| 49 |
|
| 50 |
////// |
| 51 |
/// @brief Simple structure containing a function pointer to the C++ callback function and a |
| 52 |
/// (void) pointer to the user supplied data. |
| 53 |
////// |
| 54 |
struct CppToCCallbackData |
| 55 |
{
|
| 56 |
CppToCCallbackData(); |
| 57 |
CppToCCallbackData(CallbackFunPtr funPtr, void *userData); |
| 58 |
void init(CallbackFunPtr funPtr, void *userData); |
| 59 |
|
| 60 |
CallbackFunPtr funPtr; |
| 61 |
void *userData; |
| 62 |
}; |
| 63 |
|
| 64 |
// ------------------------------------------------------------------------------- |
| 65 |
|
| 66 |
FunCallbackStream(); |
| 67 |
FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); |
| 68 |
~FunCallbackStream(); |
| 69 |
|
| 70 |
void open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); |
| 71 |
|
| 72 |
private: |
| 73 |
FunCallbackStream(const FunCallbackStream &); // non-copyable |
| 74 |
FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable |
| 75 |
|
| 76 |
CppToCCallbackData adapterData_; |
| 77 |
|
| 78 |
void open(const StreamParameters ¶meters); |
| 79 |
}; |
| 80 |
|
| 81 |
|
| 82 |
} // portaudio |
| 83 |
|
| 84 |
// --------------------------------------------------------------------------------------- |
| 85 |
|
| 86 |
#endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX |