]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wave.h | |
3 | // Purpose: wxWave class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 25/10/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_WAVE_H_ | |
13 | #define _WX_WAVE_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "wave.h" | |
17 | #endif | |
18 | ||
19 | #ifndef byte | |
20 | #define byte unsigned char | |
21 | #endif | |
22 | ||
23 | #include "wx/object.h" | |
24 | ||
25 | #ifndef AUDIODEV | |
26 | #define AUDIODEV "/dev/dsp" // Default path for audio device | |
27 | #endif | |
28 | ||
29 | class wxWave : public wxObject | |
30 | { | |
31 | public: | |
32 | wxWave(); | |
33 | wxWave(const wxString& fileName, bool isResource = FALSE); | |
34 | wxWave(int size, const byte* data); | |
35 | ~wxWave(); | |
36 | ||
37 | public: | |
38 | // Create from resource or file | |
39 | bool Create(const wxString& fileName, bool isResource = FALSE); | |
40 | // Create from data | |
41 | bool Create(int size, const byte* data); | |
42 | ||
43 | bool IsOk() const { return (m_waveData ? TRUE : FALSE); }; | |
44 | bool Play(bool async = TRUE, bool looped = FALSE); | |
45 | ||
46 | protected: | |
47 | bool Free(); | |
48 | ||
49 | private: | |
50 | byte* m_waveData; | |
51 | int m_waveLength; | |
52 | bool m_isResource; | |
53 | ||
54 | ||
55 | int OpenDSP(void); | |
56 | bool InitDSP(int dev, int iDataBits, int iChannel,unsigned long ulSamplingRate); | |
57 | int m_DSPblkSize; // Size of the DSP buffer | |
58 | char *m_data; | |
59 | int m_sizeData; | |
60 | }; | |
61 | ||
62 | #endif | |
63 |