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