00001
00002
00003 struct SoundData;
00004
00005 class SoundCallback {
00006 public:
00007 virtual void SoundEvent(Sound *id);
00008 };
00009
00010
00011 #define SND_OUTPUT 0 //dir
00012 #define SND_INPUT 1 //dir
00013
00014
00015 #define SND_MASTER 0
00016 #define SND_MUSIC 3
00017 #define SND_WAVE 4
00018 #define SND_PC 5
00019 #define SND_LINE 6
00020 #define SND_MIC 7
00021 #define SND_CD 8
00022
00023 struct SoundStatus {
00024 int bufs;
00025 int bufsused;
00026 int bufsfree;
00027 int bufsiz;
00028
00029 };
00030
00031
00032 class Sound : virtual public SystemCode {
00033 _PROTECTED_:
00034
00035 Thread *This;
00036 SoundCallback *cb;
00037 SoundData *sd;
00038 public:
00039 #ifdef _DF_SOUND_SRC_
00040 #ifdef DF_WIN
00041 #include <df/win32/sound.hpp>
00042 #else
00043 #include <df/linux/sound.hpp>
00044 #endif
00045 #endif
00046 BOOL Valid;
00047
00048 Sound();
00049
00050 ~Sound();
00051
00052 void SetCallback(SoundCallback *cb);
00053 BOOL Capable(int bits, int freq, int chs);
00054 BOOL Create(uint _dir, int bits, int freq, int chs);
00055
00056
00057
00058
00059
00060
00061 uint32 GetBufferSize();
00062 BOOL Destroy();
00063
00064 BOOL Play(PTR *sams, int *buflen, BOOL playall = TRUE);
00065 BOOL Record(PTR *sams, int *buflen);
00066 BOOL Status(SoundStatus *ss);
00067 BOOL Stop();
00068
00069 static PTR LoadWAV(char *fn, int *bufsiz, int *bits, int *freq, int *chs);
00070 BOOL CreateMixer();
00071 BOOL MixerSet(int dev, uint32 lvl);
00072 BOOL MixerGet(int dev, uint32 *lvl);
00073 };
00074