Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.3 KiB

  1. /***********/
  2. /* sound.c */
  3. /***********/
  4. #define _WINDOWS
  5. #include <windows.h>
  6. #include <port1632.h>
  7. #include <mmsystem.h>
  8. #include "main.h"
  9. #include "sound.h"
  10. #include "rtns.h"
  11. #include "pref.h"
  12. #include "res.h"
  13. extern HANDLE hInst;
  14. extern PREF Preferences;
  15. /****** F I N I T T U N E S ******/
  16. INT FInitTunes( VOID )
  17. {
  18. // Even if the user has chosen the sound option
  19. // but does not have sound playing capabilities,
  20. // put the sound off.
  21. if ( PlaySound(NULL, NULL, SND_PURGE) == FALSE)
  22. return fsoundOff;
  23. return fsoundOn;
  24. }
  25. /****** E N D T U N E S ******/
  26. VOID EndTunes(VOID)
  27. {
  28. // Just stop the tune ..
  29. if (FSoundOn())
  30. {
  31. PlaySound(NULL, NULL, SND_PURGE);
  32. }
  33. }
  34. /****** P L A Y T U N E ******/
  35. VOID PlayTune(INT tune)
  36. {
  37. if (!FSoundOn())
  38. return;
  39. // Play the appropriate .wav file.
  40. switch (tune)
  41. {
  42. case TUNE_TICK:
  43. PlaySound(MAKEINTRESOURCE(ID_TUNE_TICK), hInst, SND_RESOURCE | SND_ASYNC);
  44. break;
  45. case TUNE_WINGAME:
  46. PlaySound(MAKEINTRESOURCE(ID_TUNE_WON), hInst, SND_RESOURCE | SND_ASYNC);
  47. break;
  48. case TUNE_LOSEGAME:
  49. PlaySound(MAKEINTRESOURCE(ID_TUNE_LOST), hInst, SND_RESOURCE | SND_ASYNC);
  50. break;
  51. default:
  52. #ifdef DEBUG
  53. Oops(TEXT("Invalid Tune"));
  54. #endif
  55. break;
  56. }
  57. }