Team Fortress 2 Source Code as on 22/4/2020
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.

160 lines
4.1 KiB

  1. #ifndef __SYSTEMSOUND__
  2. #define __SYSTEMSOUND__
  3. #ifndef __MACTYPES__
  4. #include <MacTypes.h>
  5. #endif
  6. #ifndef __FILES__
  7. #include <Files.h>
  8. #endif
  9. #if PRAGMA_ONCE
  10. #pragma once
  11. #endif
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #if PRAGMA_IMPORT
  16. #pragma import on
  17. #endif
  18. /* ================================================================================ */
  19. /* Errors */
  20. /* ================================================================================ */
  21. enum {
  22. kSystemSoundNoError = 0,
  23. kSystemSoundUnspecifiedError = -1500
  24. };
  25. /* ================================================================================ */
  26. /* Types */
  27. /* ================================================================================ */
  28. typedef UInt32 SystemSoundActionID;
  29. /* ================================================================================ */
  30. /* Public APIs */
  31. /* ================================================================================ */
  32. /*
  33. * AlertSoundPlay()
  34. *
  35. * Summary:
  36. * Play an Alert Sound
  37. *
  38. * Discussion:
  39. * Play the user's current alert sound, interrupting any previously
  40. * playing alert sound.
  41. *
  42. * Availability:
  43. * Non-Carbon CFM: not available
  44. * CarbonLib: not available in CarbonLib 1.x
  45. * Mac OS X: in version 10.2 and later
  46. */
  47. EXTERN_API_C( void )
  48. AlertSoundPlay(void);
  49. /*
  50. * SystemSoundPlay()
  51. *
  52. * Summary:
  53. * Play a System Sound
  54. *
  55. * Discussion:
  56. * Immediately play the sound designated by actionID. Use for one
  57. * time actions that do not require a duration or modification
  58. * during playback. Sustain loops in the sound will be ignored.
  59. *
  60. * Parameters:
  61. *
  62. * inAction:
  63. * A SystemSoundActionID indicating the desired System Sound to be
  64. * played.
  65. *
  66. * Availability:
  67. * Non-Carbon CFM: not available
  68. * CarbonLib: not available in CarbonLib 1.x
  69. * Mac OS X: in version 10.2 and later
  70. */
  71. EXTERN_API_C( void )
  72. SystemSoundPlay(SystemSoundActionID inAction);
  73. /*
  74. * SystemSoundGetActionID()
  75. *
  76. * Summary:
  77. * Create a 'custom' System Sound by providing an audio file.
  78. *
  79. * Discussion:
  80. * If the user wants to add a sound that can be played via
  81. * SystemSoundPlay(), an FSRef for an audio file can be passed and a
  82. * SystemSoundActionID, which can be passed to SystemSoundPlay(),
  83. * will be returned .
  84. *
  85. * Parameters:
  86. *
  87. * userFile:
  88. * An const FSRef * for the audio file to be used as a System
  89. * Sound. Any audio file supported by the AudioFile APIs in the
  90. * AudioToolbox framework may be used.
  91. *
  92. * outAction:
  93. * If successful, a SystemSoundActionID will be returned, which in
  94. * turn can be passed to SystemSoundPlay().
  95. *
  96. * Availability:
  97. * Non-Carbon CFM: not available
  98. * CarbonLib: not available in CarbonLib 1.x
  99. * Mac OS X: in version 10.2 and later
  100. */
  101. EXTERN_API_C( OSStatus )
  102. SystemSoundGetActionID(
  103. const FSRef * userFile,
  104. SystemSoundActionID * outAction);
  105. /*
  106. * SystemSoundRemoveActionID()
  107. *
  108. * Summary:
  109. * Remove a 'custom' System Sound.
  110. *
  111. * Discussion:
  112. * If the user no longer needs to use the custom system sound that
  113. * was created via SystemSoundGetActionID, this function should be
  114. * called so the SystemSoundServer can release resources that are no
  115. * longer needed.
  116. *
  117. * Parameters:
  118. *
  119. * inAction:
  120. * A SystemSoundActionID indicating the desired System Sound to be
  121. * removed.
  122. *
  123. * Availability:
  124. * Non-Carbon CFM: not available
  125. * CarbonLib: not available in CarbonLib 1.x
  126. * Mac OS X: in version 10.2 and later
  127. */
  128. EXTERN_API_C( OSStatus )
  129. SystemSoundRemoveActionID(SystemSoundActionID inAction);
  130. #ifdef PRAGMA_IMPORT_OFF
  131. #pragma import off
  132. #elif PRAGMA_IMPORT
  133. #pragma import reset
  134. #endif
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* __SYSTEMSOUND__ */