AudioServer.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AudioServer" inherits="Object" version="4.0">
  3. <brief_description>
  4. Server interface for low-level audio access.
  5. </brief_description>
  6. <description>
  7. [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.
  8. </description>
  9. <tutorials>
  10. <link title="Audio buses">https://docs.godotengine.org/en/latest/tutorials/audio/audio_buses.html</link>
  11. <link title="Audio Device Changer Demo">https://godotengine.org/asset-library/asset/525</link>
  12. <link title="Audio Mic Record Demo">https://godotengine.org/asset-library/asset/527</link>
  13. <link title="Audio Spectrum Demo">https://godotengine.org/asset-library/asset/528</link>
  14. </tutorials>
  15. <methods>
  16. <method name="add_bus">
  17. <return type="void" />
  18. <argument index="0" name="at_position" type="int" default="-1" />
  19. <description>
  20. Adds a bus at [code]at_position[/code].
  21. </description>
  22. </method>
  23. <method name="add_bus_effect">
  24. <return type="void" />
  25. <argument index="0" name="bus_idx" type="int" />
  26. <argument index="1" name="effect" type="AudioEffect" />
  27. <argument index="2" name="at_position" type="int" default="-1" />
  28. <description>
  29. Adds an [AudioEffect] effect to the bus [code]bus_idx[/code] at [code]at_position[/code].
  30. </description>
  31. </method>
  32. <method name="capture_get_device">
  33. <return type="String" />
  34. <description>
  35. Name of the current device for audio input (see [method capture_get_device_list]).
  36. </description>
  37. </method>
  38. <method name="capture_get_device_list">
  39. <return type="Array" />
  40. <description>
  41. Returns the names of all audio input devices detected on the system.
  42. </description>
  43. </method>
  44. <method name="capture_set_device">
  45. <return type="void" />
  46. <argument index="0" name="name" type="String" />
  47. <description>
  48. Sets which audio input device is used for audio capture.
  49. </description>
  50. </method>
  51. <method name="generate_bus_layout" qualifiers="const">
  52. <return type="AudioBusLayout" />
  53. <description>
  54. Generates an [AudioBusLayout] using the available buses and effects.
  55. </description>
  56. </method>
  57. <method name="get_bus_channels" qualifiers="const">
  58. <return type="int" />
  59. <argument index="0" name="bus_idx" type="int" />
  60. <description>
  61. Returns the amount of channels of the bus at index [code]bus_idx[/code].
  62. </description>
  63. </method>
  64. <method name="get_bus_effect">
  65. <return type="AudioEffect" />
  66. <argument index="0" name="bus_idx" type="int" />
  67. <argument index="1" name="effect_idx" type="int" />
  68. <description>
  69. Returns the [AudioEffect] at position [code]effect_idx[/code] in bus [code]bus_idx[/code].
  70. </description>
  71. </method>
  72. <method name="get_bus_effect_count">
  73. <return type="int" />
  74. <argument index="0" name="bus_idx" type="int" />
  75. <description>
  76. Returns the number of effects on the bus at [code]bus_idx[/code].
  77. </description>
  78. </method>
  79. <method name="get_bus_effect_instance">
  80. <return type="AudioEffectInstance" />
  81. <argument index="0" name="bus_idx" type="int" />
  82. <argument index="1" name="effect_idx" type="int" />
  83. <argument index="2" name="channel" type="int" default="0" />
  84. <description>
  85. Returns the [AudioEffectInstance] assigned to the given bus and effect indices (and optionally channel).
  86. </description>
  87. </method>
  88. <method name="get_bus_index" qualifiers="const">
  89. <return type="int" />
  90. <argument index="0" name="bus_name" type="StringName" />
  91. <description>
  92. Returns the index of the bus with the name [code]bus_name[/code].
  93. </description>
  94. </method>
  95. <method name="get_bus_name" qualifiers="const">
  96. <return type="String" />
  97. <argument index="0" name="bus_idx" type="int" />
  98. <description>
  99. Returns the name of the bus with the index [code]bus_idx[/code].
  100. </description>
  101. </method>
  102. <method name="get_bus_peak_volume_left_db" qualifiers="const">
  103. <return type="float" />
  104. <argument index="0" name="bus_idx" type="int" />
  105. <argument index="1" name="channel" type="int" />
  106. <description>
  107. Returns the peak volume of the left speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
  108. </description>
  109. </method>
  110. <method name="get_bus_peak_volume_right_db" qualifiers="const">
  111. <return type="float" />
  112. <argument index="0" name="bus_idx" type="int" />
  113. <argument index="1" name="channel" type="int" />
  114. <description>
  115. Returns the peak volume of the right speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
  116. </description>
  117. </method>
  118. <method name="get_bus_send" qualifiers="const">
  119. <return type="StringName" />
  120. <argument index="0" name="bus_idx" type="int" />
  121. <description>
  122. Returns the name of the bus that the bus at index [code]bus_idx[/code] sends to.
  123. </description>
  124. </method>
  125. <method name="get_bus_volume_db" qualifiers="const">
  126. <return type="float" />
  127. <argument index="0" name="bus_idx" type="int" />
  128. <description>
  129. Returns the volume of the bus at index [code]bus_idx[/code] in dB.
  130. </description>
  131. </method>
  132. <method name="get_device_list">
  133. <return type="Array" />
  134. <description>
  135. Returns the names of all audio devices detected on the system.
  136. </description>
  137. </method>
  138. <method name="get_mix_rate" qualifiers="const">
  139. <return type="float" />
  140. <description>
  141. Returns the sample rate at the output of the [AudioServer].
  142. </description>
  143. </method>
  144. <method name="get_output_latency" qualifiers="const">
  145. <return type="float" />
  146. <description>
  147. Returns the audio driver's output latency.
  148. </description>
  149. </method>
  150. <method name="get_speaker_mode" qualifiers="const">
  151. <return type="int" enum="AudioServer.SpeakerMode" />
  152. <description>
  153. Returns the speaker configuration.
  154. </description>
  155. </method>
  156. <method name="get_time_since_last_mix" qualifiers="const">
  157. <return type="float" />
  158. <description>
  159. Returns the relative time since the last mix occurred.
  160. </description>
  161. </method>
  162. <method name="get_time_to_next_mix" qualifiers="const">
  163. <return type="float" />
  164. <description>
  165. Returns the relative time until the next mix occurs.
  166. </description>
  167. </method>
  168. <method name="is_bus_bypassing_effects" qualifiers="const">
  169. <return type="bool" />
  170. <argument index="0" name="bus_idx" type="int" />
  171. <description>
  172. If [code]true[/code], the bus at index [code]bus_idx[/code] is bypassing effects.
  173. </description>
  174. </method>
  175. <method name="is_bus_effect_enabled" qualifiers="const">
  176. <return type="bool" />
  177. <argument index="0" name="bus_idx" type="int" />
  178. <argument index="1" name="effect_idx" type="int" />
  179. <description>
  180. If [code]true[/code], the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
  181. </description>
  182. </method>
  183. <method name="is_bus_mute" qualifiers="const">
  184. <return type="bool" />
  185. <argument index="0" name="bus_idx" type="int" />
  186. <description>
  187. If [code]true[/code], the bus at index [code]bus_idx[/code] is muted.
  188. </description>
  189. </method>
  190. <method name="is_bus_solo" qualifiers="const">
  191. <return type="bool" />
  192. <argument index="0" name="bus_idx" type="int" />
  193. <description>
  194. If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
  195. </description>
  196. </method>
  197. <method name="lock">
  198. <return type="void" />
  199. <description>
  200. Locks the audio driver's main loop.
  201. [b]Note:[/b] Remember to unlock it afterwards.
  202. </description>
  203. </method>
  204. <method name="move_bus">
  205. <return type="void" />
  206. <argument index="0" name="index" type="int" />
  207. <argument index="1" name="to_index" type="int" />
  208. <description>
  209. Moves the bus from index [code]index[/code] to index [code]to_index[/code].
  210. </description>
  211. </method>
  212. <method name="remove_bus">
  213. <return type="void" />
  214. <argument index="0" name="index" type="int" />
  215. <description>
  216. Removes the bus at index [code]index[/code].
  217. </description>
  218. </method>
  219. <method name="remove_bus_effect">
  220. <return type="void" />
  221. <argument index="0" name="bus_idx" type="int" />
  222. <argument index="1" name="effect_idx" type="int" />
  223. <description>
  224. Removes the effect at index [code]effect_idx[/code] from the bus at index [code]bus_idx[/code].
  225. </description>
  226. </method>
  227. <method name="set_bus_bypass_effects">
  228. <return type="void" />
  229. <argument index="0" name="bus_idx" type="int" />
  230. <argument index="1" name="enable" type="bool" />
  231. <description>
  232. If [code]true[/code], the bus at index [code]bus_idx[/code] is bypassing effects.
  233. </description>
  234. </method>
  235. <method name="set_bus_effect_enabled">
  236. <return type="void" />
  237. <argument index="0" name="bus_idx" type="int" />
  238. <argument index="1" name="effect_idx" type="int" />
  239. <argument index="2" name="enabled" type="bool" />
  240. <description>
  241. If [code]true[/code], the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
  242. </description>
  243. </method>
  244. <method name="set_bus_layout">
  245. <return type="void" />
  246. <argument index="0" name="bus_layout" type="AudioBusLayout" />
  247. <description>
  248. Overwrites the currently used [AudioBusLayout].
  249. </description>
  250. </method>
  251. <method name="set_bus_mute">
  252. <return type="void" />
  253. <argument index="0" name="bus_idx" type="int" />
  254. <argument index="1" name="enable" type="bool" />
  255. <description>
  256. If [code]true[/code], the bus at index [code]bus_idx[/code] is muted.
  257. </description>
  258. </method>
  259. <method name="set_bus_name">
  260. <return type="void" />
  261. <argument index="0" name="bus_idx" type="int" />
  262. <argument index="1" name="name" type="String" />
  263. <description>
  264. Sets the name of the bus at index [code]bus_idx[/code] to [code]name[/code].
  265. </description>
  266. </method>
  267. <method name="set_bus_send">
  268. <return type="void" />
  269. <argument index="0" name="bus_idx" type="int" />
  270. <argument index="1" name="send" type="StringName" />
  271. <description>
  272. Connects the output of the bus at [code]bus_idx[/code] to the bus named [code]send[/code].
  273. </description>
  274. </method>
  275. <method name="set_bus_solo">
  276. <return type="void" />
  277. <argument index="0" name="bus_idx" type="int" />
  278. <argument index="1" name="enable" type="bool" />
  279. <description>
  280. If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
  281. </description>
  282. </method>
  283. <method name="set_bus_volume_db">
  284. <return type="void" />
  285. <argument index="0" name="bus_idx" type="int" />
  286. <argument index="1" name="volume_db" type="float" />
  287. <description>
  288. Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code].
  289. </description>
  290. </method>
  291. <method name="swap_bus_effects">
  292. <return type="void" />
  293. <argument index="0" name="bus_idx" type="int" />
  294. <argument index="1" name="effect_idx" type="int" />
  295. <argument index="2" name="by_effect_idx" type="int" />
  296. <description>
  297. Swaps the position of two effects in bus [code]bus_idx[/code].
  298. </description>
  299. </method>
  300. <method name="unlock">
  301. <return type="void" />
  302. <description>
  303. Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)
  304. </description>
  305. </method>
  306. </methods>
  307. <members>
  308. <member name="bus_count" type="int" setter="set_bus_count" getter="get_bus_count" default="1">
  309. Number of available audio buses.
  310. </member>
  311. <member name="device" type="String" setter="set_device" getter="get_device" default="&quot;Default&quot;">
  312. Name of the current device for audio output (see [method get_device_list]).
  313. </member>
  314. <member name="playback_speed_scale" type="float" setter="set_playback_speed_scale" getter="get_playback_speed_scale" default="1.0">
  315. Scales the rate at which audio is played (i.e. setting it to [code]0.5[/code] will make the audio be played at half its speed).
  316. </member>
  317. </members>
  318. <signals>
  319. <signal name="bus_layout_changed">
  320. <description>
  321. Emitted when the [AudioBusLayout] changes.
  322. </description>
  323. </signal>
  324. </signals>
  325. <constants>
  326. <constant name="SPEAKER_MODE_STEREO" value="0" enum="SpeakerMode">
  327. Two or fewer speakers were detected.
  328. </constant>
  329. <constant name="SPEAKER_SURROUND_31" value="1" enum="SpeakerMode">
  330. A 3.1 channel surround setup was detected.
  331. </constant>
  332. <constant name="SPEAKER_SURROUND_51" value="2" enum="SpeakerMode">
  333. A 5.1 channel surround setup was detected.
  334. </constant>
  335. <constant name="SPEAKER_SURROUND_71" value="3" enum="SpeakerMode">
  336. A 7.1 channel surround setup was detected.
  337. </constant>
  338. </constants>
  339. </class>