Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

CppFunCallbackStream.hxx

Go to the documentation of this file.
00001 #ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
00002 #define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
00003 
00004 // ---------------------------------------------------------------------------------------
00005 
00006 #include "pa_common/portaudio.h"
00007 
00008 #include "portaudiocpp/CallbackStream.hxx"
00009 
00010 // ---------------------------------------------------------------------------------------
00011 
00012 // Forward declaration(s):
00013 namespace portaudio
00014 {
00015     class StreamParameters;
00016 }
00017 
00018 // ---------------------------------------------------------------------------------------
00019 
00020 // Declaration(s):
00021 namespace portaudio
00022 {
00023 
00024 
00025     namespace impl
00026     {
00027         extern "C"
00028         {
00029             int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
00030                 const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
00031                 void *userData);
00032         } // extern "C"
00033     }
00034 
00035     // -----------------------------------------------------------------------------------
00036 
00041     class FunCallbackStream : public CallbackStream
00042     {
00043     public:
00044         typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
00045             const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
00046             void *userData);
00047 
00048         // -------------------------------------------------------------------------------
00049 
00054         struct CppToCCallbackData
00055         {
00056             CppToCCallbackData();
00057             CppToCCallbackData(CallbackFunPtr funPtr, void *userData);
00058             void init(CallbackFunPtr funPtr, void *userData);
00059 
00060             CallbackFunPtr funPtr;
00061             void *userData;
00062         };
00063 
00064         // -------------------------------------------------------------------------------
00065 
00066         FunCallbackStream();
00067         FunCallbackStream(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData);
00068         ~FunCallbackStream();
00069 
00070         void open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData);
00071 
00072     private:
00073         FunCallbackStream(const FunCallbackStream &); // non-copyable
00074         FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable
00075 
00076         CppToCCallbackData adapterData_;
00077 
00078         void open(const StreamParameters &parameters);
00079     };
00080 
00081 
00082 } // portaudio
00083 
00084 // ---------------------------------------------------------------------------------------
00085 
00086 #endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX

Generated on Fri Apr 2 20:22:15 2004 for PortAudioCpp by doxygen 1.3.6