Subversion Repositories Kolibri OS

Rev

Rev 8645 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. //
  2. //      ID Engine
  3. //      ID_SD.c - Sound Manager for Wolfenstein 3D
  4. //      v1.2
  5. //      By Jason Blochowiak
  6. //
  7.  
  8. //
  9. //      This module handles dealing with generating sound on the appropriate
  10. //              hardware
  11. //
  12. //      Depends on: User Mgr (for parm checking)
  13. //
  14. //      Globals:
  15. //              For User Mgr:
  16. //                      SoundBlasterPresent - SoundBlaster card present?
  17. //                      AdLibPresent - AdLib card present?
  18. //                      SoundMode - What device is used for sound effects
  19. //                              (Use SM_SetSoundMode() to set)
  20. //                      MusicMode - What device is used for music
  21. //                              (Use SM_SetMusicMode() to set)
  22. //                      DigiMode - What device is used for digitized sound effects
  23. //                              (Use SM_SetDigiDevice() to set)
  24. //
  25. //              For Cache Mgr:
  26. //                      NeedsDigitized - load digitized sounds?
  27. //                      NeedsMusic - load music?
  28. //
  29.  
  30. /// ///////////// ///
  31. /// In Kolibrios - stub
  32.  
  33. #include "wl_def.h"
  34. //#include <SDL_mixer.h>
  35. #if defined(GP2X_940)
  36. #include "gp2x/fmopl.h"
  37. #else
  38. #ifdef USE_GPL
  39. #include "dosbox/dbopl.h"
  40. #else
  41. #include "mame/fmopl.h"
  42. #endif
  43. #endif
  44.  
  45. #define ORIGSAMPLERATE 7042
  46.  
  47. typedef struct
  48. {
  49.         char RIFF[4];
  50.         longword filelenminus8;
  51.         char WAVE[4];
  52.         char fmt_[4];
  53.         longword formatlen;
  54.         word val0x0001;
  55.         word channels;
  56.         longword samplerate;
  57.         longword bytespersec;
  58.         word bytespersample;
  59.         word bitspersample;
  60. } headchunk;
  61.  
  62. typedef struct
  63. {
  64.         char chunkid[4];
  65.         longword chunklength;
  66. } wavechunk;
  67.  
  68. typedef struct
  69. {
  70.     uint32_t startpage;
  71.     uint32_t length;
  72. } digiinfo;
  73.  
  74. //      Global variables
  75.         boolean         AdLibPresent,
  76.                         SoundBlasterPresent,SBProPresent,
  77.                         SoundPositioned;
  78.         SDMode          SoundMode;
  79.         SMMode          MusicMode;
  80.         SDSMode         DigiMode;
  81. static  byte          **SoundTable;
  82.         int             DigiMap[LASTSOUND];
  83.         int             DigiChannel[STARTMUSIC - STARTDIGISOUNDS];
  84.  
  85. //      Internal variables
  86. static  boolean                 SD_Started;
  87. static  boolean                 nextsoundpos;
  88. static  soundnames              SoundNumber;
  89. static  soundnames              DigiNumber;
  90. static  word                    SoundPriority;
  91. static  word                    DigiPriority;
  92. static  int                     LeftPosition;
  93. static  int                     RightPosition;
  94.  
  95.         word                    NumDigi;
  96. static  digiinfo               *DigiList;
  97. static  boolean                 DigiPlaying;
  98.  
  99. //      PC Sound variables
  100. static  volatile byte           pcLastSample;
  101. static  byte * volatile         pcSound;
  102. static  longword                pcLengthLeft;
  103.  
  104. //      AdLib variables
  105. static  byte * volatile         alSound;
  106. static  byte                    alBlock;
  107. static  longword                alLengthLeft;
  108. static  longword                alTimeCount;
  109. static  Instrument              alZeroInst;
  110.  
  111. //      Sequencer variables
  112. static  volatile boolean        sqActive;
  113. static  word                   *sqHack;
  114. static  word                   *sqHackPtr;
  115. static  int                     sqHackLen;
  116. static  int                     sqHackSeqLen;
  117. static  longword                sqHackTime;
  118.  
  119. // STUB
  120. void    SD_Startup(void){};
  121. void  SD_Shutdown(void){};
  122.  
  123. int     SD_GetChannelForDigi(int which){};
  124. void    SD_PositionSound(int leftvol,int rightvol){};
  125. boolean SD_PlaySound(soundnames sound){};
  126. void    SD_SetPosition(int channel, int leftvol,int rightvol){};
  127. void    SD_StopSound(void){};
  128.         void        SD_WaitSoundDone(void){};
  129.  
  130. void    SD_StartMusic(int chunk){};
  131. void    SD_ContinueMusic(int chunk, int startoffs){};
  132. void    SD_MusicOn(void){};
  133.  void               SD_FadeOutMusic(void){};
  134. int     SD_MusicOff(void){};
  135.  
  136. boolean SD_MusicPlaying(void){};
  137. boolean SD_SetSoundMode(SDMode mode){};
  138. boolean SD_SetMusicMode(SMMode mode){};
  139. word    SD_SoundPlaying(void){};
  140.  
  141. void    SD_SetDigiDevice(SDSMode){};
  142. void    SD_PrepareSound(int which){};
  143. int     SD_PlayDigitized(word which,int leftpos,int rightpos){};
  144. void    SD_StopDigitized(void){};
  145.