00001
00024 #ifndef STREAMUPDATER_H_INCLUDED_C419FA12
00025 #define STREAMUPDATER_H_INCLUDED_C419FA12
00026
00027
00028
00029 #include <vector>
00030
00031 #ifdef WIN32
00032
00033 #pragma warning(disable : 4251)
00034 #endif
00035
00036 extern "C" {
00037 #include <AL/al.h>
00038 }
00039
00040 #include "openalpp/export.h"
00041
00042
00043 #include "openalpp/audiobase.h"
00044 #include "openalpp/error.h"
00045 #include "openalpp/windowsstuff.h"
00046 #include "OpenThreads/Thread"
00047 #include "OpenThreads/Mutex"
00048 #include "openalpp/referenced.h"
00049
00050 namespace openalpp {
00051
00055 class OPENALPP_API StreamUpdater : public OpenThreads::Thread, public OpenThreads::Mutex, public openalpp::Referenced {
00060
00061 public:
00069 StreamUpdater(ALuint buffer1,ALuint buffer2,
00070 ALenum format,unsigned int frequency);
00071
00072
00077 void addSource(ALuint sourcename);
00078
00083 void removeSource(ALuint sourcename);
00084
00092 bool update(void *buffer,unsigned int length);
00093
00098 void cancelCleanup();
00099
00104
00105
00109
00110 protected:
00111
00115 virtual ~StreamUpdater();
00116
00117
00121 ALuint buffers_[2];
00122
00126 ALenum format_;
00127
00131 unsigned int frequency_;
00132
00137 std::vector<ALuint> sources_,newsources_,removesources_;
00141 bool stoprunning_;
00142
00146 OpenThreads::Mutex runmutex_;
00147
00148 };
00149
00150 }
00151
00152 #endif