class_audioserver.rst 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_AudioServer:
  4. AudioServer
  5. ===========
  6. **Inherits:** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`AudioServerSW<class_audioserversw>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Server interface for low level audio access.
  12. Member Functions
  13. ----------------
  14. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`free_rid<class_AudioServer_free_rid>` **(** :ref:`RID<class_rid>` rid **)** |
  16. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`float<class_float>` | :ref:`get_event_voice_global_volume_scale<class_AudioServer_get_event_voice_global_volume_scale>` **(** **)** const |
  18. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`float<class_float>` | :ref:`get_fx_global_volume_scale<class_AudioServer_get_fx_global_volume_scale>` **(** **)** const |
  20. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_stream_global_volume_scale<class_AudioServer_get_stream_global_volume_scale>` **(** **)** const |
  22. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`RID<class_rid>` | :ref:`sample_create<class_AudioServer_sample_create>` **(** :ref:`int<class_int>` format, :ref:`bool<class_bool>` stereo, :ref:`int<class_int>` length **)** |
  24. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`RawArray<class_rawarray>` | :ref:`sample_get_data<class_AudioServer_sample_get_data>` **(** :ref:`RID<class_rid>` sample **)** const |
  26. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`String<class_string>` | :ref:`sample_get_description<class_AudioServer_sample_get_description>` **(** :ref:`RID<class_rid>` sample **)** const |
  28. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`sample_get_format<class_AudioServer_sample_get_format>` **(** :ref:`RID<class_rid>` sample **)** const |
  30. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`sample_get_length<class_AudioServer_sample_get_length>` **(** :ref:`RID<class_rid>` sample **)** const |
  32. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`sample_get_loop_begin<class_AudioServer_sample_get_loop_begin>` **(** :ref:`RID<class_rid>` sample **)** const |
  34. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`sample_get_loop_end<class_AudioServer_sample_get_loop_end>` **(** :ref:`RID<class_rid>` sample **)** const |
  36. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`sample_get_loop_format<class_AudioServer_sample_get_loop_format>` **(** :ref:`RID<class_rid>` sample **)** const |
  38. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`sample_get_mix_rate<class_AudioServer_sample_get_mix_rate>` **(** :ref:`RID<class_rid>` sample **)** const |
  40. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`sample_is_stereo<class_AudioServer_sample_is_stereo>` **(** :ref:`RID<class_rid>` sample **)** const |
  42. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`sample_set_data<class_AudioServer_sample_set_data>` **(** :ref:`RID<class_rid>` sample, :ref:`RawArray<class_rawarray>` data **)** |
  44. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`sample_set_description<class_AudioServer_sample_set_description>` **(** :ref:`RID<class_rid>` sample, :ref:`String<class_string>` description **)** |
  46. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`sample_set_loop_begin<class_AudioServer_sample_set_loop_begin>` **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` pos **)** |
  48. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`sample_set_loop_end<class_AudioServer_sample_set_loop_end>` **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` pos **)** |
  50. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`sample_set_loop_format<class_AudioServer_sample_set_loop_format>` **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` loop_format **)** |
  52. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`sample_set_mix_rate<class_AudioServer_sample_set_mix_rate>` **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` mix_rate **)** |
  54. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`sample_set_signed_data<class_AudioServer_sample_set_signed_data>` **(** :ref:`RID<class_rid>` sample, :ref:`RealArray<class_realarray>` data **)** |
  56. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`set_event_voice_global_volume_scale<class_AudioServer_set_event_voice_global_volume_scale>` **(** :ref:`float<class_float>` scale **)** |
  58. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`set_fx_global_volume_scale<class_AudioServer_set_fx_global_volume_scale>` **(** :ref:`float<class_float>` scale **)** |
  60. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`set_stream_global_volume_scale<class_AudioServer_set_stream_global_volume_scale>` **(** :ref:`float<class_float>` scale **)** |
  62. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`RID<class_rid>` | :ref:`voice_create<class_AudioServer_voice_create>` **(** **)** |
  64. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`float<class_float>` | :ref:`voice_get_chorus<class_AudioServer_voice_get_chorus>` **(** :ref:`RID<class_rid>` voice **)** const |
  66. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`float<class_float>` | :ref:`voice_get_filter_cutoff<class_AudioServer_voice_get_filter_cutoff>` **(** :ref:`RID<class_rid>` voice **)** const |
  68. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`float<class_float>` | :ref:`voice_get_filter_resonance<class_AudioServer_voice_get_filter_resonance>` **(** :ref:`RID<class_rid>` voice **)** const |
  70. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`int<class_int>` | :ref:`voice_get_filter_type<class_AudioServer_voice_get_filter_type>` **(** :ref:`RID<class_rid>` voice **)** const |
  72. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`int<class_int>` | :ref:`voice_get_mix_rate<class_AudioServer_voice_get_mix_rate>` **(** :ref:`RID<class_rid>` voice **)** const |
  74. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`float<class_float>` | :ref:`voice_get_pan<class_AudioServer_voice_get_pan>` **(** :ref:`RID<class_rid>` voice **)** const |
  76. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`float<class_float>` | :ref:`voice_get_pan_depth<class_AudioServer_voice_get_pan_depth>` **(** :ref:`RID<class_rid>` voice **)** const |
  78. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`float<class_float>` | :ref:`voice_get_pan_height<class_AudioServer_voice_get_pan_height>` **(** :ref:`RID<class_rid>` voice **)** const |
  80. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`float<class_float>` | :ref:`voice_get_reverb<class_AudioServer_voice_get_reverb>` **(** :ref:`RID<class_rid>` voice **)** const |
  82. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`int<class_int>` | :ref:`voice_get_reverb_type<class_AudioServer_voice_get_reverb_type>` **(** :ref:`RID<class_rid>` voice **)** const |
  84. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`float<class_float>` | :ref:`voice_get_volume<class_AudioServer_voice_get_volume>` **(** :ref:`RID<class_rid>` voice **)** const |
  86. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`bool<class_bool>` | :ref:`voice_is_positional<class_AudioServer_voice_is_positional>` **(** :ref:`RID<class_rid>` voice **)** const |
  88. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`voice_play<class_AudioServer_voice_play>` **(** :ref:`RID<class_rid>` voice, :ref:`RID<class_rid>` sample **)** |
  90. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | void | :ref:`voice_set_chorus<class_AudioServer_voice_set_chorus>` **(** :ref:`RID<class_rid>` voice, :ref:`float<class_float>` chorus **)** |
  92. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`voice_set_filter<class_AudioServer_voice_set_filter>` **(** :ref:`RID<class_rid>` voice, :ref:`int<class_int>` type, :ref:`float<class_float>` cutoff, :ref:`float<class_float>` resonance, :ref:`float<class_float>` gain=0 **)** |
  94. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | void | :ref:`voice_set_mix_rate<class_AudioServer_voice_set_mix_rate>` **(** :ref:`RID<class_rid>` voice, :ref:`int<class_int>` rate **)** |
  96. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`voice_set_pan<class_AudioServer_voice_set_pan>` **(** :ref:`RID<class_rid>` voice, :ref:`float<class_float>` pan, :ref:`float<class_float>` depth=0, :ref:`float<class_float>` height=0 **)** |
  98. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`voice_set_positional<class_AudioServer_voice_set_positional>` **(** :ref:`RID<class_rid>` voice, :ref:`bool<class_bool>` enabled **)** |
  100. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`voice_set_reverb<class_AudioServer_voice_set_reverb>` **(** :ref:`RID<class_rid>` voice, :ref:`int<class_int>` room, :ref:`float<class_float>` reverb **)** |
  102. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`voice_set_volume<class_AudioServer_voice_set_volume>` **(** :ref:`RID<class_rid>` voice, :ref:`float<class_float>` volume **)** |
  104. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`voice_stop<class_AudioServer_voice_stop>` **(** :ref:`RID<class_rid>` voice **)** |
  106. +----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. Numeric Constants
  108. -----------------
  109. - **SAMPLE_FORMAT_PCM8** = **0** --- Sample format is 8 bits, signed.
  110. - **SAMPLE_FORMAT_PCM16** = **1** --- Sample format is 16 bits, little-endian, signed.
  111. - **SAMPLE_FORMAT_IMA_ADPCM** = **2** --- Sample format is IMA-ADPCM compressed.
  112. - **SAMPLE_LOOP_NONE** = **0** --- Sample does not loop.
  113. - **SAMPLE_LOOP_FORWARD** = **1** --- Sample loops in forward mode.
  114. - **SAMPLE_LOOP_PING_PONG** = **2** --- Sample loops in a bidirectional way.
  115. - **FILTER_NONE** = **0** --- Filter is disabled.
  116. - **FILTER_LOWPASS** = **1** --- Filter is a resonant lowpass.
  117. - **FILTER_BANDPASS** = **2** --- Filter is a resonant bandpass.
  118. - **FILTER_HIPASS** = **3** --- Filter is a resonant highpass.
  119. - **FILTER_NOTCH** = **4** --- Filter is a notch (band reject).
  120. - **FILTER_BANDLIMIT** = **6** --- Filter is a bandlimit (resonance used as highpass).
  121. - **REVERB_SMALL** = **0** --- Small reverb room (closet, bathroom, etc).
  122. - **REVERB_MEDIUM** = **1** --- Medium reverb room (living room)
  123. - **REVERB_LARGE** = **2** --- Large reverb room (warehouse).
  124. - **REVERB_HALL** = **3** --- Large reverb room with long decay.
  125. Description
  126. -----------
  127. AudioServer is a low level server interface for audio access. It is in charge of creating sample data (playable audio) as well as its playback via a voice interface.
  128. Member Function Description
  129. ---------------------------
  130. .. _class_AudioServer_free_rid:
  131. - void **free_rid** **(** :ref:`RID<class_rid>` rid **)**
  132. Free a :ref:`RID<class_rid>` resource.
  133. .. _class_AudioServer_get_event_voice_global_volume_scale:
  134. - :ref:`float<class_float>` **get_event_voice_global_volume_scale** **(** **)** const
  135. Return the global scale for event-based stream playback.
  136. .. _class_AudioServer_get_fx_global_volume_scale:
  137. - :ref:`float<class_float>` **get_fx_global_volume_scale** **(** **)** const
  138. Return the global scale for all voices.
  139. .. _class_AudioServer_get_stream_global_volume_scale:
  140. - :ref:`float<class_float>` **get_stream_global_volume_scale** **(** **)** const
  141. Return the global scale for stream playback.
  142. .. _class_AudioServer_sample_create:
  143. - :ref:`RID<class_rid>` **sample_create** **(** :ref:`int<class_int>` format, :ref:`bool<class_bool>` stereo, :ref:`int<class_int>` length **)**
  144. Create an audio sample, return a :ref:`RID<class_rid>` referencing it. The sample will be created with a given format (from the SAMPLE_FORMAT\_\* enum), a total length (in samples, not bytes), in either stereo or mono.
  145. Even if a stereo sample consists of a left sample and a right sample, it still counts as one sample for length purposes.
  146. .. _class_AudioServer_sample_get_data:
  147. - :ref:`RawArray<class_rawarray>` **sample_get_data** **(** :ref:`RID<class_rid>` sample **)** const
  148. Return the sample data as an array of bytes. The length will be the expected length in bytes.
  149. .. _class_AudioServer_sample_get_description:
  150. - :ref:`String<class_string>` **sample_get_description** **(** :ref:`RID<class_rid>` sample **)** const
  151. Return the description of an audio sample. Mainly used for organization.
  152. .. _class_AudioServer_sample_get_format:
  153. - :ref:`int<class_int>` **sample_get_format** **(** :ref:`RID<class_rid>` sample **)** const
  154. Return the format of the audio sample, in the form of the SAMPLE_FORMAT\_\* enum.
  155. .. _class_AudioServer_sample_get_length:
  156. - :ref:`int<class_int>` **sample_get_length** **(** :ref:`RID<class_rid>` sample **)** const
  157. Return the length in samples (not bytes) of the audio sample. Even if a stereo sample consists of a left sample and a right sample, it still counts as one sample for length purposes.
  158. .. _class_AudioServer_sample_get_loop_begin:
  159. - :ref:`int<class_int>` **sample_get_loop_begin** **(** :ref:`RID<class_rid>` sample **)** const
  160. Return the initial loop point of a sample. Only has effect if sample loop is enabled. See :ref:`sample_set_loop_format<class_AudioServer_sample_set_loop_format>`.
  161. .. _class_AudioServer_sample_get_loop_end:
  162. - :ref:`int<class_int>` **sample_get_loop_end** **(** :ref:`RID<class_rid>` sample **)** const
  163. Return the final loop point of a sample. Only has effect if sample loop is enabled. See :ref:`sample_set_loop_format<class_AudioServer_sample_set_loop_format>`.
  164. .. _class_AudioServer_sample_get_loop_format:
  165. - :ref:`int<class_int>` **sample_get_loop_format** **(** :ref:`RID<class_rid>` sample **)** const
  166. Return the loop format for a sample, as a value from the SAMPLE_LOOP\_\* enum.
  167. .. _class_AudioServer_sample_get_mix_rate:
  168. - :ref:`int<class_int>` **sample_get_mix_rate** **(** :ref:`RID<class_rid>` sample **)** const
  169. Return the mix rate of the given sample.
  170. .. _class_AudioServer_sample_is_stereo:
  171. - :ref:`bool<class_bool>` **sample_is_stereo** **(** :ref:`RID<class_rid>` sample **)** const
  172. Return whether the sample is stereo (2 channels).
  173. .. _class_AudioServer_sample_set_data:
  174. - void **sample_set_data** **(** :ref:`RID<class_rid>` sample, :ref:`RawArray<class_rawarray>` data **)**
  175. Set the sample data for a given sample as an array of bytes. The length must be equal to the sample length expected in bytes or an error will be produced. The byte length can be calculated as follows:
  176. Get the sample length (:ref:`sample_get_length<class_AudioServer_sample_get_length>`).
  177. If the sample format is SAMPLE_FORMAT_PCM16, multiply it by 2.
  178. If the sample format is SAMPLE_FORMAT_IMA_ADPCM, divide it by 2 (rounding any fraction up), then add 4.
  179. If the sample is stereo (:ref:`sample_is_stereo<class_AudioServer_sample_is_stereo>`), multiply it by 2.
  180. .. _class_AudioServer_sample_set_description:
  181. - void **sample_set_description** **(** :ref:`RID<class_rid>` sample, :ref:`String<class_string>` description **)**
  182. Set the description of an audio sample. Mainly used for organization.
  183. .. _class_AudioServer_sample_set_loop_begin:
  184. - void **sample_set_loop_begin** **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` pos **)**
  185. Set the initial loop point of a sample. Only has effect if sample loop is enabled. See :ref:`sample_set_loop_format<class_AudioServer_sample_set_loop_format>`.
  186. .. _class_AudioServer_sample_set_loop_end:
  187. - void **sample_set_loop_end** **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` pos **)**
  188. Set the final loop point of a sample. Only has effect if sample loop is enabled. See :ref:`sample_set_loop_format<class_AudioServer_sample_set_loop_format>`.
  189. .. _class_AudioServer_sample_set_loop_format:
  190. - void **sample_set_loop_format** **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` loop_format **)**
  191. Set the loop format for a sample from the SAMPLE_LOOP\_\* enum. As a warning, Ping Pong loops may not be available on some hardware-mixing platforms.
  192. .. _class_AudioServer_sample_set_mix_rate:
  193. - void **sample_set_mix_rate** **(** :ref:`RID<class_rid>` sample, :ref:`int<class_int>` mix_rate **)**
  194. Change the default mix rate of a given sample.
  195. .. _class_AudioServer_sample_set_signed_data:
  196. - void **sample_set_signed_data** **(** :ref:`RID<class_rid>` sample, :ref:`RealArray<class_realarray>` data **)**
  197. Set the sample data for a given sample as an array of floats. The length must be equal to the sample length or an error will be produced.
  198. For this method, a stereo sample is made from two samples. Thus, in case of a stereo sample, the array length must be twice the length returned by :ref:`sample_get_length<class_AudioServer_sample_get_length>`.
  199. Trying to alter a SAMPLE_FORMAT_IMA_ADPCM sample is not supported. It will throw an error to the console, but will not alter the sample data.
  200. .. _class_AudioServer_set_event_voice_global_volume_scale:
  201. - void **set_event_voice_global_volume_scale** **(** :ref:`float<class_float>` scale **)**
  202. Set global scale for event-based stream (:ref:`EventStream<class_eventstream>`) playback. Default is 1.0.
  203. .. _class_AudioServer_set_fx_global_volume_scale:
  204. - void **set_fx_global_volume_scale** **(** :ref:`float<class_float>` scale **)**
  205. Set global scale for all voices (not including streams). Default is 1.0.
  206. .. _class_AudioServer_set_stream_global_volume_scale:
  207. - void **set_stream_global_volume_scale** **(** :ref:`float<class_float>` scale **)**
  208. Set global scale for stream playback. Default is 1.0.
  209. .. _class_AudioServer_voice_create:
  210. - :ref:`RID<class_rid>` **voice_create** **(** **)**
  211. Allocate a voice for playback. Voices are persistent. A voice can play a single sample at the same time. See :ref:`sample_create<class_AudioServer_sample_create>`.
  212. .. _class_AudioServer_voice_get_chorus:
  213. - :ref:`float<class_float>` **voice_get_chorus** **(** :ref:`RID<class_rid>` voice **)** const
  214. Return the current chorus send for a given voice (0 to 1).
  215. .. _class_AudioServer_voice_get_filter_cutoff:
  216. - :ref:`float<class_float>` **voice_get_filter_cutoff** **(** :ref:`RID<class_rid>` voice **)** const
  217. Return the current filter cutoff (in hz) for a given voice.
  218. .. _class_AudioServer_voice_get_filter_resonance:
  219. - :ref:`float<class_float>` **voice_get_filter_resonance** **(** :ref:`RID<class_rid>` voice **)** const
  220. Return the current filter resonance for a given voice.
  221. .. _class_AudioServer_voice_get_filter_type:
  222. - :ref:`int<class_int>` **voice_get_filter_type** **(** :ref:`RID<class_rid>` voice **)** const
  223. Return the current selected filter type for a given voice, from the FILTER\_\* enum.
  224. .. _class_AudioServer_voice_get_mix_rate:
  225. - :ref:`int<class_int>` **voice_get_mix_rate** **(** :ref:`RID<class_rid>` voice **)** const
  226. Return the current mix rate for a given voice.
  227. .. _class_AudioServer_voice_get_pan:
  228. - :ref:`float<class_float>` **voice_get_pan** **(** :ref:`RID<class_rid>` voice **)** const
  229. Return the current pan for a given voice (-1 to +1 range).
  230. .. _class_AudioServer_voice_get_pan_depth:
  231. - :ref:`float<class_float>` **voice_get_pan_depth** **(** :ref:`RID<class_rid>` voice **)** const
  232. Return the current pan depth for a given voice (-1 to +1 range).
  233. .. _class_AudioServer_voice_get_pan_height:
  234. - :ref:`float<class_float>` **voice_get_pan_height** **(** :ref:`RID<class_rid>` voice **)** const
  235. Return the current pan height for a given voice (-1 to +1 range).
  236. .. _class_AudioServer_voice_get_reverb:
  237. - :ref:`float<class_float>` **voice_get_reverb** **(** :ref:`RID<class_rid>` voice **)** const
  238. Return the current reverb send for a given voice (0 to 1).
  239. .. _class_AudioServer_voice_get_reverb_type:
  240. - :ref:`int<class_int>` **voice_get_reverb_type** **(** :ref:`RID<class_rid>` voice **)** const
  241. Return the current reverb type for a given voice from the REVERB\_\* enum.
  242. .. _class_AudioServer_voice_get_volume:
  243. - :ref:`float<class_float>` **voice_get_volume** **(** :ref:`RID<class_rid>` voice **)** const
  244. Return the current volume for a given voice.
  245. .. _class_AudioServer_voice_is_positional:
  246. - :ref:`bool<class_bool>` **voice_is_positional** **(** :ref:`RID<class_rid>` voice **)** const
  247. Return whether the current voice is positional. See :ref:`voice_set_positional<class_AudioServer_voice_set_positional>`.
  248. .. _class_AudioServer_voice_play:
  249. - void **voice_play** **(** :ref:`RID<class_rid>` voice, :ref:`RID<class_rid>` sample **)**
  250. Start playback of a given voice using a given sample. If the voice was already playing it will be restarted.
  251. .. _class_AudioServer_voice_set_chorus:
  252. - void **voice_set_chorus** **(** :ref:`RID<class_rid>` voice, :ref:`float<class_float>` chorus **)**
  253. Set chorus send post processing for the voice (from 0 to 1).
  254. .. _class_AudioServer_voice_set_filter:
  255. - void **voice_set_filter** **(** :ref:`RID<class_rid>` voice, :ref:`int<class_int>` type, :ref:`float<class_float>` cutoff, :ref:`float<class_float>` resonance, :ref:`float<class_float>` gain=0 **)**
  256. Set a resonant filter post processing for the voice. Filter type is a value from the FILTER\_\* enum.
  257. .. _class_AudioServer_voice_set_mix_rate:
  258. - void **voice_set_mix_rate** **(** :ref:`RID<class_rid>` voice, :ref:`int<class_int>` rate **)**
  259. Set a different playback mix rate for the given voice.
  260. .. _class_AudioServer_voice_set_pan:
  261. - void **voice_set_pan** **(** :ref:`RID<class_rid>` voice, :ref:`float<class_float>` pan, :ref:`float<class_float>` depth=0, :ref:`float<class_float>` height=0 **)**
  262. Change the pan of a currently playing voice and, optionally, the depth and height for a positional/3D sound. Panning values are expressed within the -1 to +1 range.
  263. .. _class_AudioServer_voice_set_positional:
  264. - void **voice_set_positional** **(** :ref:`RID<class_rid>` voice, :ref:`bool<class_bool>` enabled **)**
  265. Set whether a given voice is positional. This is only interpreted as a hint and used for backends that may support binaural encoding.
  266. .. _class_AudioServer_voice_set_reverb:
  267. - void **voice_set_reverb** **(** :ref:`RID<class_rid>` voice, :ref:`int<class_int>` room, :ref:`float<class_float>` reverb **)**
  268. Set the reverb send post processing for the voice (from 0 to 1) and the reverb type, from the REVERB\_\* enum.
  269. .. _class_AudioServer_voice_set_volume:
  270. - void **voice_set_volume** **(** :ref:`RID<class_rid>` voice, :ref:`float<class_float>` volume **)**
  271. Change the volume of a currently playing voice. Volume is expressed as linear gain where 0.0 is mute and 1.0 is default.
  272. .. _class_AudioServer_voice_stop:
  273. - void **voice_stop** **(** :ref:`RID<class_rid>` voice **)**
  274. Stop a given voice.