home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Archived / Updates / Flash / flashplayer / flashlib / h / sound < prev    next >
Encoding:
Text File  |  2000-06-04  |  2.3 KB  |  87 lines

  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.     long     total;
  53.     long     loops;
  54.     char    *source;
  55.     char    *current;
  56.  
  57.     SoundList *next;
  58. };
  59.  
  60. class SoundMixer {
  61.  
  62.     SoundList    *list;
  63.  
  64. // Class variables
  65. static  long         dsp;        // Descriptor for /dev/dsp
  66. static  char *         buffer;    // DMA buffer
  67. static    long         blockSize;
  68. static    long         nbInst;    // Number of instances
  69.  
  70.     // Sound Device Capabilities
  71. static    long         soundRate;    // In hz
  72. static    long         stereo;    // True if stereo sound
  73. static    long         sampleSize;    // 1 or 2 bytes
  74.  
  75. public:
  76.     SoundMixer(char*);
  77.     ~SoundMixer();
  78.  
  79.     void         startSound(Sound *sound, long loops, long flags);    // Register a sound to be played
  80.     void         stopSounds();        // Stop every current sounds in the instance
  81.  
  82.     long         playSounds();        // Actually play sounds of all instances
  83.     long         fillSoundBuffer(SoundList *, char *buffer, long bufferSize); // Fill sound buffer
  84. };
  85.  
  86. #endif /* _SOUND_H_ */
  87.