gamesound.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //---------------------------------------------------------------------------
  2. // GameSound.h - This file is the sound system header for the GAME
  3. //
  4. // MechCommander 2
  5. //
  6. //---------------------------------------------------------------------------//
  7. // Copyright (C) Microsoft Corporation. All rights reserved. //
  8. //===========================================================================//
  9. #ifndef GAMESOUND_H
  10. #define GAMESOUND_H
  11. //---------------------------------------------------------------------------
  12. // Include files
  13. #ifndef MCLIB_H
  14. #include "mclib.h"
  15. #endif
  16. #ifndef DWARRIOR_H
  17. #include "dwarrior.h"
  18. #endif
  19. #ifndef RADIO_H
  20. #include "radio.h"
  21. #endif
  22. //---------------------------------------------------------------------------
  23. // Macro Defintiions
  24. //---------------------------------------------------------------------------
  25. class GameSoundSystem : public SoundSystem
  26. {
  27. //Data Members
  28. //-------------
  29. protected:
  30. RadioData *currentMessage; //Radio message playing.
  31. unsigned long messagesInQueue; //Radio messages waiting to play.
  32. RadioData *queue[MAX_QUEUED_MESSAGES]; //Radio message queue.
  33. unsigned long currentFragment; //Which piece are we playing.
  34. unsigned long playingNoise; //are we playing noise right now?
  35. bool wholeMsgDone; //Are all fragments played?
  36. HGOSAUDIO radioHandle;
  37. float generalAlarmTimer; //How long do we play the alarm buzzer?
  38. //Member Functions
  39. //----------------
  40. public:
  41. GameSoundSystem (void)
  42. {
  43. init();
  44. }
  45. ~GameSoundSystem (void)
  46. {
  47. destroy();
  48. }
  49. void init (void)
  50. {
  51. SoundSystem::init();
  52. wholeMsgDone = true;
  53. currentMessage = NULL;
  54. messagesInQueue = 0;
  55. currentFragment = 0;
  56. playingNoise = false;
  57. radioHandle = NULL;
  58. //------------------------------------------------------------
  59. // Startup the Radio Message Queue.
  60. messagesInQueue = 0;
  61. wholeMsgDone = true;
  62. for (long i=0;i<MAX_QUEUED_MESSAGES;i++)
  63. queue[i] = NULL;
  64. generalAlarmTimer = 0.0f;
  65. }
  66. virtual void update (void);
  67. void purgeSoundSystem (void); //This will shutdown all active sound.
  68. void removeQueuedMessage (long msgNumber);
  69. bool checkMessage (MechWarriorPtr pilot, byte priority, unsigned long messageType);
  70. long queueRadioMessage (RadioData *msgData);
  71. void moveFromQueueToPlaying (void);
  72. void removeCurrentMessage (void);
  73. };
  74. //---------------------------------------------------------------------------
  75. extern GameSoundSystem *soundSystem;
  76. extern bool useSound;
  77. extern bool useMusic;
  78. //---------------------------------------------------------------------------
  79. #endif