sound.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 3; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #ifndef SOUND_H
  22. #define SOUND_H
  23. #include "common.h"
  24. #ifndef PAL_MAX_SAMPLERATE
  25. #define PAL_MAX_SAMPLERATE 48000
  26. #endif
  27. #ifdef __cplusplus
  28. extern "C"
  29. {
  30. #endif
  31. INT
  32. SOUND_OpenAudio(
  33. VOID
  34. );
  35. VOID
  36. SOUND_CloseAudio(
  37. VOID
  38. );
  39. VOID
  40. SOUND_PlayChannel(
  41. INT iSoundNum,
  42. INT iChannel
  43. );
  44. SDL_AudioSpec*
  45. SOUND_GetAudioSpec(
  46. VOID
  47. );
  48. VOID
  49. SOUND_AdjustVolume(
  50. INT iDirectory
  51. );
  52. VOID
  53. SOUND_PlayMUS(
  54. INT iNumRIX,
  55. BOOL fLoop,
  56. FLOAT flFadeTime
  57. );
  58. BOOL
  59. SOUND_PlayCDA(
  60. INT iNumTrack
  61. );
  62. #ifdef PSP
  63. VOID
  64. SOUND_Reload(
  65. VOID
  66. );
  67. #endif
  68. #ifdef PAL_CLASSIC
  69. extern int g_iCurrChannel;
  70. #define SOUND_Play(i) SOUND_PlayChannel((i), (g_iCurrChannel ^= 1))
  71. #else
  72. #define SOUND_Play(i) SOUND_PlayChannel((i), 0)
  73. #endif
  74. extern BOOL g_fNoSound;
  75. extern BOOL g_fNoMusic;
  76. #define SOUND_IsIntegerConversion(a) ((((a) % gConfig.iSampleRate) | (gConfig.iSampleRate % (a))) == 0)
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif