00001 00002 // Flash Plugin and Player 00003 // Copyright (C) 1998 Olivier Debon 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00020 #ifndef _SOUND_H_ 00021 #define _SOUND_H_ 00022 00023 #define GET_SOUND_RATE_CODE(f) (((f)&0x0c)>>2) 00024 00025 class Sound : public Character { 00026 long soundRate; // In hz 00027 long stereo; // True if stereo sound 00028 long sampleSize; // 1 or 2 bytes 00029 00030 char *samples; // Array of samples 00031 long nbSamples; 00032 00033 public: 00034 Sound(long id); 00035 ~Sound(); 00036 void setSoundFlags(long f); 00037 char *setNbSamples(long n); 00038 00039 long getRate(); 00040 long getChannel(); 00041 long getNbSamples(); 00042 long getSampleSize(); 00043 char *getSamples(); 00044 }; 00045 00046 struct SoundList { 00047 long rate; 00048 long stereo; 00049 long sampleSize; 00050 long nbSamples; 00051 long remaining; 00052 char *current; 00053 00054 SoundList *next; 00055 }; 00056 00057 class SoundMixer { 00058 00059 SoundList *list; 00060 00061 // Class variables 00062 static long dsp; // Descriptor for /dev/dsp 00063 static char * buffer; // DMA buffer 00064 static long blockSize; 00065 static long nbInst; // Number of instances 00066 00067 // Sound Device Capabilities 00068 static long soundRate; // In hz 00069 static long stereo; // True if stereo sound 00070 static long sampleSize; // 1 or 2 bytes 00071 00072 public: 00073 SoundMixer(char*); 00074 ~SoundMixer(); 00075 00076 void startSound(Sound *sound); // Register a sound to be played 00077 void stopSounds(); // Stop every current sounds in the instance 00078 00079 long playSounds(); // Actually play sounds of all instances 00080 long fillSoundBuffer(SoundList *, char *buffer, long bufferSize); // Fill sound buffer 00081 }; 00082 00083 #endif /* _SOUND_H_ */
1.4.2