home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ABUSESRC.ZIP / AbuseSrc / imlib / port / unix / sound.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-24  |  1.2 KB  |  77 lines

  1. #include "sound.hpp"
  2.  
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <stdio.h>
  6.  
  7. sound_effect::sound_effect(char *filename)
  8. {
  9.   data=(void *)strcpy((char *)malloc(strlen(filename)+1),filename);      // insert code here  
  10. }
  11.  
  12.  
  13. sound_effect::~sound_effect()
  14. {
  15.   free(data); 
  16. }
  17.  
  18.  
  19. void sound_effect::play(int volume, int pitch, int panpot)
  20. {
  21. //  printf("Play sound effect %s\n",data);
  22. }
  23.  
  24. int sound_init(int argc, char **argv)
  25. {
  26.     return 0;  
  27. }
  28.  
  29. void sound_uninit()
  30. {
  31.   ;
  32.   
  33. }
  34.  
  35. void song::set_volume(int vol)  { ; }
  36.  
  37. song::song(char *filename)
  38. {
  39.   data=NULL;
  40.   Name=strcpy((char *)malloc(strlen(filename)+1),filename);
  41.   song_id=0;
  42. }
  43.  
  44. song::~song()
  45. {
  46.   if (playing())
  47.     stop();  
  48.   if (data) free(data);
  49.   free(Name);  
  50. }  
  51.  
  52. void song::play(unsigned char volume)
  53. {
  54.   printf("play song %s, volume %d\n",name(),volume);  
  55.   song_id=1;  
  56. }
  57.  
  58.  
  59. void song::stop(long fadeout_time)                                       // time in ms
  60. {
  61.   printf("stop song %s, fade timeout %d\n",name(),fadeout_time);
  62.   song_id=0;
  63.   
  64. }
  65.  
  66. int song::playing()
  67. {
  68.   return song_id;  
  69. }
  70.  
  71.  
  72.  
  73. void set_music_volume(int volume)                  // 0...127
  74. {
  75. ;  
  76. }
  77.