Diffstat (limited to 'core/multimedia/opieplayer/libflash/sound.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libflash/sound.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/libflash/sound.h b/core/multimedia/opieplayer/libflash/sound.h new file mode 100644 index 0000000..c53773d --- a/dev/null +++ b/core/multimedia/opieplayer/libflash/sound.h | |||
@@ -0,0 +1,83 @@ | |||
1 | ///////////////////////////////////////////////////////////// | ||
2 | // Flash Plugin and Player | ||
3 | // Copyright (C) 1998 Olivier Debon | ||
4 | // | ||
5 | // This program is free software; you can redistribute it and/or | ||
6 | // modify it under the terms of the GNU General Public License | ||
7 | // as published by the Free Software Foundation; either version 2 | ||
8 | // of the License, or (at your option) any later version. | ||
9 | // | ||
10 | // This program is distributed in the hope that it will be useful, | ||
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | // GNU General Public License for more details. | ||
14 | // | ||
15 | // You should have received a copy of the GNU General Public License | ||
16 | // along with this program; if not, write to the Free Software | ||
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | // | ||
19 | /////////////////////////////////////////////////////////////// | ||
20 | #ifndef _SOUND_H_ | ||
21 | #define _SOUND_H_ | ||
22 | |||
23 | #define GET_SOUND_RATE_CODE(f) (((f)&0x0c)>>2) | ||
24 | |||
25 | class Sound : public Character { | ||
26 | long soundRate;// In hz | ||
27 | long stereo;// True if stereo sound | ||
28 | long sampleSize;// 1 or 2 bytes | ||
29 | |||
30 | char *samples; // Array of samples | ||
31 | long nbSamples; | ||
32 | |||
33 | public: | ||
34 | Sound(long id); | ||
35 | ~Sound(); | ||
36 | void setSoundFlags(long f); | ||
37 | char *setNbSamples(long n); | ||
38 | |||
39 | long getRate(); | ||
40 | long getChannel(); | ||
41 | long getNbSamples(); | ||
42 | long getSampleSize(); | ||
43 | char *getSamples(); | ||
44 | }; | ||
45 | |||
46 | struct SoundList { | ||
47 | long rate; | ||
48 | long stereo; | ||
49 | long sampleSize; | ||
50 | long nbSamples; | ||
51 | long remaining; | ||
52 | char*current; | ||
53 | |||
54 | SoundList *next; | ||
55 | }; | ||
56 | |||
57 | class SoundMixer { | ||
58 | |||
59 | SoundList*list; | ||
60 | |||
61 | // Class variables | ||
62 | static long dsp; // Descriptor for /dev/dsp | ||
63 | static char * buffer;// DMA buffer | ||
64 | static long blockSize; | ||
65 | static long nbInst;// Number of instances | ||
66 | |||
67 | // Sound Device Capabilities | ||
68 | static long soundRate;// In hz | ||
69 | static long stereo;// True if stereo sound | ||
70 | static long sampleSize;// 1 or 2 bytes | ||
71 | |||
72 | public: | ||
73 | SoundMixer(char*); | ||
74 | ~SoundMixer(); | ||
75 | |||
76 | void startSound(Sound *sound);// Register a sound to be played | ||
77 | void stopSounds(); // Stop every current sounds in the instance | ||
78 | |||
79 | long playSounds(); // Actually play sounds of all instances | ||
80 | long fillSoundBuffer(SoundList *, char *buffer, long bufferSize); // Fill sound buffer | ||
81 | }; | ||
82 | |||
83 | #endif /* _SOUND_H_ */ | ||