Go to the documentation of this file.00001 #ifndef FCAM_BEEPER_H
00002 #define FCAM_BEEPER_H
00003
00006 #include <string>
00007
00008 #include <FCam/FCam.h>
00009 #include <FCam/Action.h>
00010 #include <FCam/Device.h>
00011
00012
00013 #ifdef HAVE_CONFIG_H
00014 #include <config.h>
00015 #endif
00016 #include <stdio.h>
00017 #include <unistd.h>
00018 #include <string.h>
00019 #include <errno.h>
00020 #include <fcntl.h>
00021 #include <pulse/simple.h>
00022 #include <pulse/error.h>
00023 #include <pulse/gccmacro.h>
00024
00025 #define BUFSIZE 1024
00026
00027
00028
00029
00030
00031
00032 class SoundPlayer : public FCam::Device {
00033
00034 public:
00035
00036 SoundPlayer();
00037 ~SoundPlayer();
00038
00039
00040
00041
00042 class SoundAction : public FCam::CopyableAction<SoundAction> {
00043 public:
00044
00045
00046 ~SoundAction();
00047 SoundAction(SoundPlayer * b);
00048 SoundAction(SoundPlayer * b, int time);
00049 SoundAction(const SoundAction &);
00050
00051
00052 void doAction();
00053
00054
00055 void setWavFile(const char * filename);
00056
00057
00058 SoundPlayer * getPlayer() const { return player; }
00059
00060 protected:
00061
00062 SoundPlayer * player;
00063 unsigned int *refCount;
00064 std::string filename;
00065 unsigned char * buffer;
00066 int size;
00067 };
00068
00069
00070
00071
00072
00073 void tagFrame(FCam::Frame) {}
00074
00075
00076 void playBuffer(unsigned char * buffer, size_t size);
00077
00078
00079 int getLatency();
00080
00081 protected:
00082 pa_simple * connection;
00083
00084 };
00085
00086 #endif