AudioServer.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AudioServer" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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">$DOCS_URL/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_list">
  33. <return type="Array" />
  34. <description>
  35. Returns the names of all audio input devices detected on the system.
  36. [b]Note:[/b] [member ProjectSettings.audio/enable_audio_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
  37. </description>
  38. </method>
  39. <method name="generate_bus_layout" qualifiers="const">
  40. <return type="AudioBusLayout" />
  41. <description>
  42. Generates an [AudioBusLayout] using the available buses and effects.
  43. </description>
  44. </method>
  45. <method name="get_bus_channels" qualifiers="const">
  46. <return type="int" />
  47. <argument index="0" name="bus_idx" type="int" />
  48. <description>
  49. Returns the amount of channels of the bus at index [code]bus_idx[/code].
  50. </description>
  51. </method>
  52. <method name="get_bus_effect">
  53. <return type="AudioEffect" />
  54. <argument index="0" name="bus_idx" type="int" />
  55. <argument index="1" name="effect_idx" type="int" />
  56. <description>
  57. Returns the [AudioEffect] at position [code]effect_idx[/code] in bus [code]bus_idx[/code].
  58. </description>
  59. </method>
  60. <method name="get_bus_effect_count">
  61. <return type="int" />
  62. <argument index="0" name="bus_idx" type="int" />
  63. <description>
  64. Returns the number of effects on the bus at [code]bus_idx[/code].
  65. </description>
  66. </method>
  67. <method name="get_bus_effect_instance">
  68. <return type="AudioEffectInstance" />
  69. <argument index="0" name="bus_idx" type="int" />
  70. <argument index="1" name="effect_idx" type="int" />
  71. <argument index="2" name="channel" type="int" default="0" />
  72. <description>
  73. Returns the [AudioEffectInstance] assigned to the given bus and effect indices (and optionally channel).
  74. </description>
  75. </method>
  76. <method name="get_bus_index" qualifiers="const">
  77. <return type="int" />
  78. <argument index="0" name="bus_name" type="String" />
  79. <description>
  80. Returns the index of the bus with the name [code]bus_name[/code].
  81. </description>
  82. </method>
  83. <method name="get_bus_name" qualifiers="const">
  84. <return type="String" />
  85. <argument index="0" name="bus_idx" type="int" />
  86. <description>
  87. Returns the name of the bus with the index [code]bus_idx[/code].
  88. </description>
  89. </method>
  90. <method name="get_bus_peak_volume_left_db" qualifiers="const">
  91. <return type="float" />
  92. <argument index="0" name="bus_idx" type="int" />
  93. <argument index="1" name="channel" type="int" />
  94. <description>
  95. Returns the peak volume of the left speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
  96. </description>
  97. </method>
  98. <method name="get_bus_peak_volume_right_db" qualifiers="const">
  99. <return type="float" />
  100. <argument index="0" name="bus_idx" type="int" />
  101. <argument index="1" name="channel" type="int" />
  102. <description>
  103. Returns the peak volume of the right speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
  104. </description>
  105. </method>
  106. <method name="get_bus_send" qualifiers="const">
  107. <return type="String" />
  108. <argument index="0" name="bus_idx" type="int" />
  109. <description>
  110. Returns the name of the bus that the bus at index [code]bus_idx[/code] sends to.
  111. </description>
  112. </method>
  113. <method name="get_bus_volume_db" qualifiers="const">
  114. <return type="float" />
  115. <argument index="0" name="bus_idx" type="int" />
  116. <description>
  117. Returns the volume of the bus at index [code]bus_idx[/code] in dB.
  118. </description>
  119. </method>
  120. <method name="get_device_list">
  121. <return type="Array" />
  122. <description>
  123. Returns the names of all audio devices detected on the system.
  124. </description>
  125. </method>
  126. <method name="get_mix_rate" qualifiers="const">
  127. <return type="float" />
  128. <description>
  129. Returns the sample rate at the output of the [AudioServer].
  130. </description>
  131. </method>
  132. <method name="get_output_latency" qualifiers="const">
  133. <return type="float" />
  134. <description>
  135. Returns the audio driver's output latency. This can be expensive, it is not recommended to call this every frame.
  136. </description>
  137. </method>
  138. <method name="get_speaker_mode" qualifiers="const">
  139. <return type="int" enum="AudioServer.SpeakerMode" />
  140. <description>
  141. Returns the speaker configuration.
  142. </description>
  143. </method>
  144. <method name="get_time_since_last_mix" qualifiers="const">
  145. <return type="float" />
  146. <description>
  147. Returns the relative time since the last mix occurred.
  148. </description>
  149. </method>
  150. <method name="get_time_to_next_mix" qualifiers="const">
  151. <return type="float" />
  152. <description>
  153. Returns the relative time until the next mix occurs.
  154. </description>
  155. </method>
  156. <method name="is_bus_bypassing_effects" qualifiers="const">
  157. <return type="bool" />
  158. <argument index="0" name="bus_idx" type="int" />
  159. <description>
  160. If [code]true[/code], the bus at index [code]bus_idx[/code] is bypassing effects.
  161. </description>
  162. </method>
  163. <method name="is_bus_effect_enabled" qualifiers="const">
  164. <return type="bool" />
  165. <argument index="0" name="bus_idx" type="int" />
  166. <argument index="1" name="effect_idx" type="int" />
  167. <description>
  168. If [code]true[/code], the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
  169. </description>
  170. </method>
  171. <method name="is_bus_mute" qualifiers="const">
  172. <return type="bool" />
  173. <argument index="0" name="bus_idx" type="int" />
  174. <description>
  175. If [code]true[/code], the bus at index [code]bus_idx[/code] is muted.
  176. </description>
  177. </method>
  178. <method name="is_bus_solo" qualifiers="const">
  179. <return type="bool" />
  180. <argument index="0" name="bus_idx" type="int" />
  181. <description>
  182. If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
  183. </description>
  184. </method>
  185. <method name="lock">
  186. <return type="void" />
  187. <description>
  188. Locks the audio driver's main loop.
  189. [b]Note:[/b] Remember to unlock it afterwards.
  190. </description>
  191. </method>
  192. <method name="move_bus">
  193. <return type="void" />
  194. <argument index="0" name="index" type="int" />
  195. <argument index="1" name="to_index" type="int" />
  196. <description>
  197. Moves the bus from index [code]index[/code] to index [code]to_index[/code].
  198. </description>
  199. </method>
  200. <method name="remove_bus">
  201. <return type="void" />
  202. <argument index="0" name="index" type="int" />
  203. <description>
  204. Removes the bus at index [code]index[/code].
  205. </description>
  206. </method>
  207. <method name="remove_bus_effect">
  208. <return type="void" />
  209. <argument index="0" name="bus_idx" type="int" />
  210. <argument index="1" name="effect_idx" type="int" />
  211. <description>
  212. Removes the effect at index [code]effect_idx[/code] from the bus at index [code]bus_idx[/code].
  213. </description>
  214. </method>
  215. <method name="set_bus_bypass_effects">
  216. <return type="void" />
  217. <argument index="0" name="bus_idx" type="int" />
  218. <argument index="1" name="enable" type="bool" />
  219. <description>
  220. If [code]true[/code], the bus at index [code]bus_idx[/code] is bypassing effects.
  221. </description>
  222. </method>
  223. <method name="set_bus_effect_enabled">
  224. <return type="void" />
  225. <argument index="0" name="bus_idx" type="int" />
  226. <argument index="1" name="effect_idx" type="int" />
  227. <argument index="2" name="enabled" type="bool" />
  228. <description>
  229. If [code]true[/code], the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
  230. </description>
  231. </method>
  232. <method name="set_bus_layout">
  233. <return type="void" />
  234. <argument index="0" name="bus_layout" type="AudioBusLayout" />
  235. <description>
  236. Overwrites the currently used [AudioBusLayout].
  237. </description>
  238. </method>
  239. <method name="set_bus_mute">
  240. <return type="void" />
  241. <argument index="0" name="bus_idx" type="int" />
  242. <argument index="1" name="enable" type="bool" />
  243. <description>
  244. If [code]true[/code], the bus at index [code]bus_idx[/code] is muted.
  245. </description>
  246. </method>
  247. <method name="set_bus_name">
  248. <return type="void" />
  249. <argument index="0" name="bus_idx" type="int" />
  250. <argument index="1" name="name" type="String" />
  251. <description>
  252. Sets the name of the bus at index [code]bus_idx[/code] to [code]name[/code].
  253. </description>
  254. </method>
  255. <method name="set_bus_send">
  256. <return type="void" />
  257. <argument index="0" name="bus_idx" type="int" />
  258. <argument index="1" name="send" type="String" />
  259. <description>
  260. Connects the output of the bus at [code]bus_idx[/code] to the bus named [code]send[/code].
  261. </description>
  262. </method>
  263. <method name="set_bus_solo">
  264. <return type="void" />
  265. <argument index="0" name="bus_idx" type="int" />
  266. <argument index="1" name="enable" type="bool" />
  267. <description>
  268. If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
  269. </description>
  270. </method>
  271. <method name="set_bus_volume_db">
  272. <return type="void" />
  273. <argument index="0" name="bus_idx" type="int" />
  274. <argument index="1" name="volume_db" type="float" />
  275. <description>
  276. Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code].
  277. </description>
  278. </method>
  279. <method name="swap_bus_effects">
  280. <return type="void" />
  281. <argument index="0" name="bus_idx" type="int" />
  282. <argument index="1" name="effect_idx" type="int" />
  283. <argument index="2" name="by_effect_idx" type="int" />
  284. <description>
  285. Swaps the position of two effects in bus [code]bus_idx[/code].
  286. </description>
  287. </method>
  288. <method name="unlock">
  289. <return type="void" />
  290. <description>
  291. Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)
  292. </description>
  293. </method>
  294. </methods>
  295. <members>
  296. <member name="bus_count" type="int" setter="set_bus_count" getter="get_bus_count" default="1">
  297. Number of available audio buses.
  298. </member>
  299. <member name="capture_device" type="String" setter="capture_set_device" getter="capture_get_device" default="&quot;Default&quot;">
  300. Name of the current device for audio input (see [method capture_get_device_list]). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value [code]"Default"[/code] will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code].
  301. [b]Note:[/b] [member ProjectSettings.audio/enable_audio_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
  302. </member>
  303. <member name="device" type="String" setter="set_device" getter="get_device" default="&quot;Default&quot;">
  304. Name of the current device for audio output (see [method get_device_list]). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value [code]"Default"[/code] will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code].
  305. </member>
  306. <member name="global_rate_scale" type="float" setter="set_global_rate_scale" getter="get_global_rate_scale" default="1.0">
  307. Scales the rate at which audio is played (i.e. setting it to [code]0.5[/code] will make the audio be played twice as fast).
  308. </member>
  309. </members>
  310. <signals>
  311. <signal name="bus_layout_changed">
  312. <description>
  313. Emitted when the [AudioBusLayout] changes.
  314. </description>
  315. </signal>
  316. </signals>
  317. <constants>
  318. <constant name="SPEAKER_MODE_STEREO" value="0" enum="SpeakerMode">
  319. Two or fewer speakers were detected.
  320. </constant>
  321. <constant name="SPEAKER_SURROUND_31" value="1" enum="SpeakerMode">
  322. A 3.1 channel surround setup was detected.
  323. </constant>
  324. <constant name="SPEAKER_SURROUND_51" value="2" enum="SpeakerMode">
  325. A 5.1 channel surround setup was detected.
  326. </constant>
  327. <constant name="SPEAKER_SURROUND_71" value="3" enum="SpeakerMode">
  328. A 7.1 channel surround setup was detected.
  329. </constant>
  330. </constants>
  331. </class>