class_audioserver.rst 38 KB

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