class_audioserver.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the AudioServer.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_AudioServer:
  5. AudioServer
  6. ===========
  7. **Inherits:** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Server interface for low level audio access.
  12. Member Functions
  13. ----------------
  14. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_bus<class_AudioServer_add_bus>` **(** :ref:`int<class_int>` at_position=-1 **)** |
  16. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`add_bus_effect<class_AudioServer_add_bus_effect>` **(** :ref:`int<class_int>` bus_idx, :ref:`AudioEffect<class_audioeffect>` effect, :ref:`int<class_int>` at_position=-1 **)** |
  18. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`AudioBusLayout<class_audiobuslayout>` | :ref:`generate_bus_layout<class_AudioServer_generate_bus_layout>` **(** **)** const |
  20. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_bus_count<class_AudioServer_get_bus_count>` **(** **)** const |
  22. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`AudioEffect<class_audioeffect>` | :ref:`get_bus_effect<class_AudioServer_get_bus_effect>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx **)** |
  24. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`get_bus_effect_count<class_AudioServer_get_bus_effect_count>` **(** :ref:`int<class_int>` bus_idx **)** |
  26. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_bus_index<class_AudioServer_get_bus_index>` **(** :ref:`String<class_string>` bus_name **)** const |
  28. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_string>` | :ref:`get_bus_name<class_AudioServer_get_bus_name>` **(** :ref:`int<class_int>` bus_idx **)** const |
  30. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`float<class_float>` | :ref:`get_bus_peak_volume_left_db<class_AudioServer_get_bus_peak_volume_left_db>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` channel **)** const |
  32. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`float<class_float>` | :ref:`get_bus_peak_volume_right_db<class_AudioServer_get_bus_peak_volume_right_db>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` channel **)** const |
  34. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`String<class_string>` | :ref:`get_bus_send<class_AudioServer_get_bus_send>` **(** :ref:`int<class_int>` bus_idx **)** const |
  36. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`float<class_float>` | :ref:`get_bus_volume_db<class_AudioServer_get_bus_volume_db>` **(** :ref:`int<class_int>` bus_idx **)** const |
  38. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`String<class_string>` | :ref:`get_device<class_AudioServer_get_device>` **(** **)** |
  40. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Array<class_array>` | :ref:`get_device_list<class_AudioServer_get_device_list>` **(** **)** |
  42. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`float<class_float>` | :ref:`get_mix_rate<class_AudioServer_get_mix_rate>` **(** **)** const |
  44. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`get_speaker_mode<class_AudioServer_get_speaker_mode>` **(** **)** const |
  46. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`is_bus_bypassing_effects<class_AudioServer_is_bus_bypassing_effects>` **(** :ref:`int<class_int>` bus_idx **)** const |
  48. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | :ref:`is_bus_effect_enabled<class_AudioServer_is_bus_effect_enabled>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx **)** const |
  50. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`is_bus_mute<class_AudioServer_is_bus_mute>` **(** :ref:`int<class_int>` bus_idx **)** const |
  52. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`is_bus_solo<class_AudioServer_is_bus_solo>` **(** :ref:`int<class_int>` bus_idx **)** const |
  54. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`lock<class_AudioServer_lock>` **(** **)** |
  56. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`move_bus<class_AudioServer_move_bus>` **(** :ref:`int<class_int>` index, :ref:`int<class_int>` to_index **)** |
  58. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`remove_bus<class_AudioServer_remove_bus>` **(** :ref:`int<class_int>` index **)** |
  60. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`remove_bus_effect<class_AudioServer_remove_bus_effect>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx **)** |
  62. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_bus_bypass_effects<class_AudioServer_set_bus_bypass_effects>` **(** :ref:`int<class_int>` bus_idx, :ref:`bool<class_bool>` enable **)** |
  64. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`set_bus_count<class_AudioServer_set_bus_count>` **(** :ref:`int<class_int>` amount **)** |
  66. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`set_bus_effect_enabled<class_AudioServer_set_bus_effect_enabled>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx, :ref:`bool<class_bool>` enabled **)** |
  68. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`set_bus_layout<class_AudioServer_set_bus_layout>` **(** :ref:`AudioBusLayout<class_audiobuslayout>` bus_layout **)** |
  70. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`set_bus_mute<class_AudioServer_set_bus_mute>` **(** :ref:`int<class_int>` bus_idx, :ref:`bool<class_bool>` enable **)** |
  72. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`set_bus_name<class_AudioServer_set_bus_name>` **(** :ref:`int<class_int>` bus_idx, :ref:`String<class_string>` name **)** |
  74. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_bus_send<class_AudioServer_set_bus_send>` **(** :ref:`int<class_int>` bus_idx, :ref:`String<class_string>` send **)** |
  76. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_bus_solo<class_AudioServer_set_bus_solo>` **(** :ref:`int<class_int>` bus_idx, :ref:`bool<class_bool>` enable **)** |
  78. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`set_bus_volume_db<class_AudioServer_set_bus_volume_db>` **(** :ref:`int<class_int>` bus_idx, :ref:`float<class_float>` volume_db **)** |
  80. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`set_device<class_AudioServer_set_device>` **(** :ref:`String<class_string>` arg0 **)** |
  82. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`swap_bus_effects<class_AudioServer_swap_bus_effects>` **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx, :ref:`int<class_int>` by_effect_idx **)** |
  84. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`unlock<class_AudioServer_unlock>` **(** **)** |
  86. +----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. Signals
  88. -------
  89. .. _class_AudioServer_bus_layout_changed:
  90. - **bus_layout_changed** **(** **)**
  91. Emitted when the :ref:`AudioBusLayout<class_audiobuslayout>` changes.
  92. Enums
  93. -----
  94. .. _enum_AudioServer_SpeakerMode:
  95. enum **SpeakerMode**
  96. - **SPEAKER_MODE_STEREO** = **0** --- Two or fewer speakers are detected.
  97. - **SPEAKER_SURROUND_51** = **2** --- A 5.1 channel surround setup detected.
  98. - **SPEAKER_SURROUND_71** = **3** --- A 7.1 channel surround setup detected.
  99. Description
  100. -----------
  101. 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.
  102. Member Function Description
  103. ---------------------------
  104. .. _class_AudioServer_add_bus:
  105. - void **add_bus** **(** :ref:`int<class_int>` at_position=-1 **)**
  106. Adds a bus at ``at_position``.
  107. .. _class_AudioServer_add_bus_effect:
  108. - void **add_bus_effect** **(** :ref:`int<class_int>` bus_idx, :ref:`AudioEffect<class_audioeffect>` effect, :ref:`int<class_int>` at_position=-1 **)**
  109. Adds an :ref:`AudioEffect<class_audioeffect>` effect to the bus ``bus_idx`` at ``at_position``.
  110. .. _class_AudioServer_generate_bus_layout:
  111. - :ref:`AudioBusLayout<class_audiobuslayout>` **generate_bus_layout** **(** **)** const
  112. Generates an :ref:`AudioBusLayout<class_audiobuslayout>` using the available busses and effects.
  113. .. _class_AudioServer_get_bus_count:
  114. - :ref:`int<class_int>` **get_bus_count** **(** **)** const
  115. Returns the number of available busses.
  116. .. _class_AudioServer_get_bus_effect:
  117. - :ref:`AudioEffect<class_audioeffect>` **get_bus_effect** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx **)**
  118. Returns the :ref:`AudioEffect<class_audioeffect>` at position ``effect_idx`` in bus ``bus_idx``.
  119. .. _class_AudioServer_get_bus_effect_count:
  120. - :ref:`int<class_int>` **get_bus_effect_count** **(** :ref:`int<class_int>` bus_idx **)**
  121. Returns the number of effects on the bus at ``bus_idx``.
  122. .. _class_AudioServer_get_bus_index:
  123. - :ref:`int<class_int>` **get_bus_index** **(** :ref:`String<class_string>` bus_name **)** const
  124. Returns the index of the bus with the name ``bus_name``.
  125. .. _class_AudioServer_get_bus_name:
  126. - :ref:`String<class_string>` **get_bus_name** **(** :ref:`int<class_int>` bus_idx **)** const
  127. Returns the name of the bus with the index ``bus_idx``.
  128. .. _class_AudioServer_get_bus_peak_volume_left_db:
  129. - :ref:`float<class_float>` **get_bus_peak_volume_left_db** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` channel **)** const
  130. Returns the peak volume of the left speaker at bus index ``bus_idx`` and channel index ``channel``.
  131. .. _class_AudioServer_get_bus_peak_volume_right_db:
  132. - :ref:`float<class_float>` **get_bus_peak_volume_right_db** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` channel **)** const
  133. Returns the peak volume of the right speaker at bus index ``bus_idx`` and channel index ``channel``.
  134. .. _class_AudioServer_get_bus_send:
  135. - :ref:`String<class_string>` **get_bus_send** **(** :ref:`int<class_int>` bus_idx **)** const
  136. Returns the name of the bus that the bus at index ``bus_idx`` sends to.
  137. .. _class_AudioServer_get_bus_volume_db:
  138. - :ref:`float<class_float>` **get_bus_volume_db** **(** :ref:`int<class_int>` bus_idx **)** const
  139. Returns the volume of the bus at index ``bus_idx`` in dB.
  140. .. _class_AudioServer_get_device:
  141. - :ref:`String<class_string>` **get_device** **(** **)**
  142. .. _class_AudioServer_get_device_list:
  143. - :ref:`Array<class_array>` **get_device_list** **(** **)**
  144. .. _class_AudioServer_get_mix_rate:
  145. - :ref:`float<class_float>` **get_mix_rate** **(** **)** const
  146. Returns the sample rate at the output of the audioserver.
  147. .. _class_AudioServer_get_speaker_mode:
  148. - :ref:`int<class_int>` **get_speaker_mode** **(** **)** const
  149. Returns the speaker configuration.
  150. .. _class_AudioServer_is_bus_bypassing_effects:
  151. - :ref:`bool<class_bool>` **is_bus_bypassing_effects** **(** :ref:`int<class_int>` bus_idx **)** const
  152. If ``true`` the bus at index ``bus_idx`` is bypassing effects.
  153. .. _class_AudioServer_is_bus_effect_enabled:
  154. - :ref:`bool<class_bool>` **is_bus_effect_enabled** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx **)** const
  155. If ``true`` the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled.
  156. .. _class_AudioServer_is_bus_mute:
  157. - :ref:`bool<class_bool>` **is_bus_mute** **(** :ref:`int<class_int>` bus_idx **)** const
  158. If ``true`` the bus at index ``bus_idx`` is muted.
  159. .. _class_AudioServer_is_bus_solo:
  160. - :ref:`bool<class_bool>` **is_bus_solo** **(** :ref:`int<class_int>` bus_idx **)** const
  161. If ``true`` the bus at index ``bus_idx`` is in solo mode.
  162. .. _class_AudioServer_lock:
  163. - void **lock** **(** **)**
  164. Locks the audio drivers mainloop. Remember to unlock it afterwards.
  165. .. _class_AudioServer_move_bus:
  166. - void **move_bus** **(** :ref:`int<class_int>` index, :ref:`int<class_int>` to_index **)**
  167. Moves the bus from index ``index`` to index ``to_index``.
  168. .. _class_AudioServer_remove_bus:
  169. - void **remove_bus** **(** :ref:`int<class_int>` index **)**
  170. Removes the bus at index ``index``.
  171. .. _class_AudioServer_remove_bus_effect:
  172. - void **remove_bus_effect** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx **)**
  173. Removes the effect at index ``effect_idx`` from the bus at index ``bus_idx``.
  174. .. _class_AudioServer_set_bus_bypass_effects:
  175. - void **set_bus_bypass_effects** **(** :ref:`int<class_int>` bus_idx, :ref:`bool<class_bool>` enable **)**
  176. If ``true`` the bus at index ``bus_idx`` is bypassing effects.
  177. .. _class_AudioServer_set_bus_count:
  178. - void **set_bus_count** **(** :ref:`int<class_int>` amount **)**
  179. Adds and removes busses to make the number of busses match ``amount``.
  180. .. _class_AudioServer_set_bus_effect_enabled:
  181. - void **set_bus_effect_enabled** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx, :ref:`bool<class_bool>` enabled **)**
  182. If ``true`` the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled.
  183. .. _class_AudioServer_set_bus_layout:
  184. - void **set_bus_layout** **(** :ref:`AudioBusLayout<class_audiobuslayout>` bus_layout **)**
  185. Overwrites the currently used :ref:`AudioBusLayout<class_audiobuslayout>`.
  186. .. _class_AudioServer_set_bus_mute:
  187. - void **set_bus_mute** **(** :ref:`int<class_int>` bus_idx, :ref:`bool<class_bool>` enable **)**
  188. If ``true`` the bus at index ``bus_idx`` is muted.
  189. .. _class_AudioServer_set_bus_name:
  190. - void **set_bus_name** **(** :ref:`int<class_int>` bus_idx, :ref:`String<class_string>` name **)**
  191. Sets the name of the bus at index ``bus_idx`` to ``name``.
  192. .. _class_AudioServer_set_bus_send:
  193. - void **set_bus_send** **(** :ref:`int<class_int>` bus_idx, :ref:`String<class_string>` send **)**
  194. Connects the output of the bus at ``bus_idx`` to the bus named ``send``.
  195. .. _class_AudioServer_set_bus_solo:
  196. - void **set_bus_solo** **(** :ref:`int<class_int>` bus_idx, :ref:`bool<class_bool>` enable **)**
  197. If ``true`` the bus at index ``bus_idx`` is in solo mode.
  198. .. _class_AudioServer_set_bus_volume_db:
  199. - void **set_bus_volume_db** **(** :ref:`int<class_int>` bus_idx, :ref:`float<class_float>` volume_db **)**
  200. Sets the volume of the bus at index ``bus_idx`` to ``volume_db``.
  201. .. _class_AudioServer_set_device:
  202. - void **set_device** **(** :ref:`String<class_string>` arg0 **)**
  203. .. _class_AudioServer_swap_bus_effects:
  204. - void **swap_bus_effects** **(** :ref:`int<class_int>` bus_idx, :ref:`int<class_int>` effect_idx, :ref:`int<class_int>` by_effect_idx **)**
  205. Swaps the position of two effects in bus ``bus_idx``.
  206. .. _class_AudioServer_unlock:
  207. - void **unlock** **(** **)**
  208. Unlocks the audiodriver's main loop. After locking it always unlock it.