audio_server.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /**************************************************************************/
  2. /* audio_server.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef AUDIO_SERVER_H
  31. #define AUDIO_SERVER_H
  32. #include "core/math/audio_frame.h"
  33. #include "core/object/class_db.h"
  34. #include "core/os/os.h"
  35. #include "core/templates/safe_list.h"
  36. #include "core/variant/variant.h"
  37. #include "servers/audio/audio_effect.h"
  38. #include "servers/audio/audio_filter_sw.h"
  39. #include <atomic>
  40. class AudioDriverDummy;
  41. class AudioSample;
  42. class AudioStream;
  43. class AudioStreamWAV;
  44. class AudioStreamPlayback;
  45. class AudioSamplePlayback;
  46. class AudioDriver {
  47. static AudioDriver *singleton;
  48. uint64_t _last_mix_time = 0;
  49. uint64_t _last_mix_frames = 0;
  50. #ifdef DEBUG_ENABLED
  51. SafeNumeric<uint64_t> prof_ticks;
  52. SafeNumeric<uint64_t> prof_time;
  53. #endif
  54. protected:
  55. Vector<int32_t> input_buffer;
  56. unsigned int input_position = 0;
  57. unsigned int input_size = 0;
  58. void audio_server_process(int p_frames, int32_t *p_buffer, bool p_update_mix_time = true);
  59. void update_mix_time(int p_frames);
  60. void input_buffer_init(int driver_buffer_frames);
  61. void input_buffer_write(int32_t sample);
  62. int _get_configured_mix_rate();
  63. #ifdef DEBUG_ENABLED
  64. _FORCE_INLINE_ void start_counting_ticks() { prof_ticks.set(OS::get_singleton()->get_ticks_usec()); }
  65. _FORCE_INLINE_ void stop_counting_ticks() { prof_time.add(OS::get_singleton()->get_ticks_usec() - prof_ticks.get()); }
  66. #else
  67. _FORCE_INLINE_ void start_counting_ticks() {}
  68. _FORCE_INLINE_ void stop_counting_ticks() {}
  69. #endif
  70. public:
  71. double get_time_since_last_mix(); //useful for video -> audio sync
  72. double get_time_to_next_mix();
  73. enum SpeakerMode {
  74. SPEAKER_MODE_STEREO,
  75. SPEAKER_SURROUND_31,
  76. SPEAKER_SURROUND_51,
  77. SPEAKER_SURROUND_71,
  78. };
  79. static AudioDriver *get_singleton();
  80. void set_singleton();
  81. // Virtual API to implement.
  82. virtual const char *get_name() const = 0;
  83. virtual Error init() = 0;
  84. virtual void start() = 0;
  85. virtual int get_mix_rate() const = 0;
  86. virtual int get_input_mix_rate() const { return get_mix_rate(); }
  87. virtual SpeakerMode get_speaker_mode() const = 0;
  88. virtual float get_latency() { return 0; }
  89. virtual void lock() = 0;
  90. virtual void unlock() = 0;
  91. virtual void finish() = 0;
  92. virtual PackedStringArray get_output_device_list();
  93. virtual String get_output_device();
  94. virtual void set_output_device(const String &p_name) {}
  95. virtual Error input_start() { return FAILED; }
  96. virtual Error input_stop() { return FAILED; }
  97. virtual PackedStringArray get_input_device_list();
  98. virtual String get_input_device() { return "Default"; }
  99. virtual void set_input_device(const String &p_name) {}
  100. //
  101. SpeakerMode get_speaker_mode_by_total_channels(int p_channels) const;
  102. int get_total_channels_by_speaker_mode(SpeakerMode) const;
  103. Vector<int32_t> get_input_buffer() { return input_buffer; }
  104. unsigned int get_input_position() { return input_position; }
  105. unsigned int get_input_size() { return input_size; }
  106. #ifdef DEBUG_ENABLED
  107. uint64_t get_profiling_time() const { return prof_time.get(); }
  108. void reset_profiling_time() { prof_time.set(0); }
  109. #endif
  110. // Samples handling.
  111. virtual bool is_stream_registered_as_sample(const Ref<AudioStream> &p_stream) const {
  112. return false;
  113. }
  114. virtual void register_sample(const Ref<AudioSample> &p_sample) {}
  115. virtual void unregister_sample(const Ref<AudioSample> &p_sample) {}
  116. virtual void start_sample_playback(const Ref<AudioSamplePlayback> &p_playback);
  117. virtual void stop_sample_playback(const Ref<AudioSamplePlayback> &p_playback) {}
  118. virtual void set_sample_playback_pause(const Ref<AudioSamplePlayback> &p_playback, bool p_paused) {}
  119. virtual bool is_sample_playback_active(const Ref<AudioSamplePlayback> &p_playback) { return false; }
  120. virtual double get_sample_playback_position(const Ref<AudioSamplePlayback> &p_playback) { return false; }
  121. virtual void update_sample_playback_pitch_scale(const Ref<AudioSamplePlayback> &p_playback, float p_pitch_scale = 0.0f) {}
  122. virtual void set_sample_playback_bus_volumes_linear(const Ref<AudioSamplePlayback> &p_playback, const HashMap<StringName, Vector<AudioFrame>> &p_bus_volumes) {}
  123. virtual void set_sample_bus_count(int p_count) {}
  124. virtual void remove_sample_bus(int p_bus) {}
  125. virtual void add_sample_bus(int p_at_pos = -1) {}
  126. virtual void move_sample_bus(int p_bus, int p_to_pos) {}
  127. virtual void set_sample_bus_send(int p_bus, const StringName &p_send) {}
  128. virtual void set_sample_bus_volume_db(int p_bus, float p_volume_db) {}
  129. virtual void set_sample_bus_solo(int p_bus, bool p_enable) {}
  130. virtual void set_sample_bus_mute(int p_bus, bool p_enable) {}
  131. AudioDriver() {}
  132. virtual ~AudioDriver() {}
  133. };
  134. class AudioDriverManager {
  135. enum {
  136. MAX_DRIVERS = 10
  137. };
  138. static AudioDriver *drivers[MAX_DRIVERS];
  139. static int driver_count;
  140. static AudioDriverDummy dummy_driver;
  141. public:
  142. static const int DEFAULT_MIX_RATE = 44100;
  143. static void add_driver(AudioDriver *p_driver);
  144. static void initialize(int p_driver);
  145. static int get_driver_count();
  146. static AudioDriver *get_driver(int p_driver);
  147. };
  148. class AudioBusLayout;
  149. class AudioServer : public Object {
  150. GDCLASS(AudioServer, Object);
  151. public:
  152. //re-expose this here, as AudioDriver is not exposed to script
  153. enum SpeakerMode {
  154. SPEAKER_MODE_STEREO,
  155. SPEAKER_SURROUND_31,
  156. SPEAKER_SURROUND_51,
  157. SPEAKER_SURROUND_71,
  158. };
  159. enum PlaybackType {
  160. PLAYBACK_TYPE_DEFAULT,
  161. PLAYBACK_TYPE_STREAM,
  162. PLAYBACK_TYPE_SAMPLE,
  163. PLAYBACK_TYPE_MAX
  164. };
  165. enum {
  166. AUDIO_DATA_INVALID_ID = -1,
  167. MAX_CHANNELS_PER_BUS = 4,
  168. MAX_BUSES_PER_PLAYBACK = 6,
  169. LOOKAHEAD_BUFFER_SIZE = 64,
  170. };
  171. typedef void (*AudioCallback)(void *p_userdata);
  172. private:
  173. uint64_t mix_time = 0;
  174. int mix_size = 0;
  175. uint32_t buffer_size = 0;
  176. uint64_t mix_count = 0;
  177. uint64_t mix_frames = 0;
  178. #ifdef DEBUG_ENABLED
  179. SafeNumeric<uint64_t> prof_time;
  180. #endif
  181. float channel_disable_threshold_db = 0.0f;
  182. uint32_t channel_disable_frames = 0;
  183. int channel_count = 0;
  184. int to_mix = 0;
  185. float playback_speed_scale = 1.0f;
  186. bool tag_used_audio_streams = false;
  187. struct Bus {
  188. StringName name;
  189. bool solo = false;
  190. bool mute = false;
  191. bool bypass = false;
  192. bool soloed = false;
  193. // Each channel is a stereo pair.
  194. struct Channel {
  195. bool used = false;
  196. bool active = false;
  197. AudioFrame peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
  198. Vector<AudioFrame> buffer;
  199. Vector<Ref<AudioEffectInstance>> effect_instances;
  200. uint64_t last_mix_with_audio = 0;
  201. Channel() {}
  202. };
  203. Vector<Channel> channels;
  204. struct Effect {
  205. Ref<AudioEffect> effect;
  206. bool enabled = false;
  207. #ifdef DEBUG_ENABLED
  208. uint64_t prof_time = 0;
  209. #endif
  210. };
  211. Vector<Effect> effects;
  212. float volume_db = 0.0f;
  213. StringName send;
  214. int index_cache = 0;
  215. };
  216. struct AudioStreamPlaybackBusDetails {
  217. bool bus_active[MAX_BUSES_PER_PLAYBACK] = {};
  218. StringName bus[MAX_BUSES_PER_PLAYBACK];
  219. AudioFrame volume[MAX_BUSES_PER_PLAYBACK][MAX_CHANNELS_PER_BUS];
  220. };
  221. struct AudioStreamPlaybackListNode {
  222. // The state machine for audio stream playbacks is as follows:
  223. // 1. The playback is created and added to the playback list in the playing state.
  224. // 2. The playback is (maybe) paused, and the state is set to FADE_OUT_TO_PAUSE.
  225. // 2.1. The playback is mixed after being paused, and the audio server thread atomically sets the state to PAUSED after performing a brief fade-out.
  226. // 3. The playback is (maybe) deleted, and the state is set to FADE_OUT_TO_DELETION.
  227. // 3.1. The playback is mixed after being deleted, and the audio server thread atomically sets the state to AWAITING_DELETION after performing a brief fade-out.
  228. // NOTE: The playback is not deallocated at this time because allocation and deallocation are not realtime-safe.
  229. // 4. The playback is removed and deallocated on the main thread using the SafeList maybe_cleanup method.
  230. enum PlaybackState {
  231. PAUSED = 0, // Paused. Keep this stream playback around though so it can be restarted.
  232. PLAYING = 1, // Playing. Fading may still be necessary if volume changes!
  233. FADE_OUT_TO_PAUSE = 2, // About to pause.
  234. FADE_OUT_TO_DELETION = 3, // About to stop.
  235. AWAITING_DELETION = 4,
  236. };
  237. // If zero or positive, a place in the stream to seek to during the next mix.
  238. SafeNumeric<float> setseek;
  239. SafeNumeric<float> pitch_scale;
  240. SafeNumeric<float> highshelf_gain;
  241. SafeNumeric<float> attenuation_filter_cutoff_hz; // This isn't used unless highshelf_gain is nonzero.
  242. AudioFilterSW::Processor filter_process[8];
  243. // Updating this ref after the list node is created breaks consistency guarantees, don't do it!
  244. Ref<AudioStreamPlayback> stream_playback;
  245. // Playback state determines the fate of a particular AudioStreamListNode during the mix step. Must be atomically replaced.
  246. std::atomic<PlaybackState> state = AWAITING_DELETION;
  247. // This data should only ever be modified by an atomic replacement of the pointer.
  248. std::atomic<AudioStreamPlaybackBusDetails *> bus_details = nullptr;
  249. // Previous bus details should only be accessed on the audio thread.
  250. AudioStreamPlaybackBusDetails *prev_bus_details = nullptr;
  251. // The next few samples are stored here so we have some time to fade audio out if it ends abruptly at the beginning of the next mix.
  252. AudioFrame lookahead[LOOKAHEAD_BUFFER_SIZE];
  253. };
  254. SafeList<AudioStreamPlaybackListNode *> playback_list;
  255. SafeList<AudioStreamPlaybackBusDetails *> bus_details_graveyard;
  256. void _delete_stream_playback(Ref<AudioStreamPlayback> p_playback);
  257. void _delete_stream_playback_list_node(AudioStreamPlaybackListNode *p_node);
  258. // TODO document if this is necessary.
  259. SafeList<AudioStreamPlaybackBusDetails *> bus_details_graveyard_frame_old;
  260. Vector<Vector<AudioFrame>> temp_buffer; //temp_buffer for each level
  261. Vector<AudioFrame> mix_buffer;
  262. Vector<Bus *> buses;
  263. HashMap<StringName, Bus *> bus_map;
  264. void _update_bus_effects(int p_bus);
  265. static AudioServer *singleton;
  266. void init_channels_and_buffers();
  267. void _mix_step();
  268. void _mix_step_for_channel(AudioFrame *p_out_buf, AudioFrame *p_source_buf, AudioFrame p_vol_start, AudioFrame p_vol_final, float p_attenuation_filter_cutoff_hz, float p_highshelf_gain, AudioFilterSW::Processor *p_processor_l, AudioFilterSW::Processor *p_processor_r);
  269. // Should only be called on the main thread.
  270. AudioStreamPlaybackListNode *_find_playback_list_node(Ref<AudioStreamPlayback> p_playback);
  271. struct CallbackItem {
  272. AudioCallback callback;
  273. void *userdata = nullptr;
  274. };
  275. SafeList<CallbackItem *> update_callback_list;
  276. SafeList<CallbackItem *> mix_callback_list;
  277. SafeList<CallbackItem *> listener_changed_callback_list;
  278. friend class AudioDriver;
  279. void _driver_process(int p_frames, int32_t *p_buffer);
  280. LocalVector<Ref<AudioSamplePlayback>> sample_playback_list;
  281. protected:
  282. static void _bind_methods();
  283. public:
  284. _FORCE_INLINE_ int get_channel_count() const {
  285. switch (get_speaker_mode()) {
  286. case SPEAKER_MODE_STEREO:
  287. return 1;
  288. case SPEAKER_SURROUND_31:
  289. return 2;
  290. case SPEAKER_SURROUND_51:
  291. return 3;
  292. case SPEAKER_SURROUND_71:
  293. return 4;
  294. }
  295. ERR_FAIL_V(1);
  296. }
  297. // Do not use from outside audio thread.
  298. bool thread_has_channel_mix_buffer(int p_bus, int p_buffer) const;
  299. AudioFrame *thread_get_channel_mix_buffer(int p_bus, int p_buffer);
  300. int thread_get_mix_buffer_size() const;
  301. int thread_find_bus_index(const StringName &p_name);
  302. void set_bus_count(int p_count);
  303. int get_bus_count() const;
  304. void remove_bus(int p_index);
  305. void add_bus(int p_at_pos = -1);
  306. void move_bus(int p_bus, int p_to_pos);
  307. void set_bus_name(int p_bus, const String &p_name);
  308. String get_bus_name(int p_bus) const;
  309. int get_bus_index(const StringName &p_bus_name) const;
  310. int get_bus_channels(int p_bus) const;
  311. void set_bus_volume_db(int p_bus, float p_volume_db);
  312. float get_bus_volume_db(int p_bus) const;
  313. void set_bus_send(int p_bus, const StringName &p_send);
  314. StringName get_bus_send(int p_bus) const;
  315. void set_bus_solo(int p_bus, bool p_enable);
  316. bool is_bus_solo(int p_bus) const;
  317. void set_bus_mute(int p_bus, bool p_enable);
  318. bool is_bus_mute(int p_bus) const;
  319. void set_bus_bypass_effects(int p_bus, bool p_enable);
  320. bool is_bus_bypassing_effects(int p_bus) const;
  321. void add_bus_effect(int p_bus, const Ref<AudioEffect> &p_effect, int p_at_pos = -1);
  322. void remove_bus_effect(int p_bus, int p_effect);
  323. int get_bus_effect_count(int p_bus);
  324. Ref<AudioEffect> get_bus_effect(int p_bus, int p_effect);
  325. Ref<AudioEffectInstance> get_bus_effect_instance(int p_bus, int p_effect, int p_channel = 0);
  326. void swap_bus_effects(int p_bus, int p_effect, int p_by_effect);
  327. void set_bus_effect_enabled(int p_bus, int p_effect, bool p_enabled);
  328. bool is_bus_effect_enabled(int p_bus, int p_effect) const;
  329. float get_bus_peak_volume_left_db(int p_bus, int p_channel) const;
  330. float get_bus_peak_volume_right_db(int p_bus, int p_channel) const;
  331. bool is_bus_channel_active(int p_bus, int p_channel) const;
  332. void set_playback_speed_scale(float p_scale);
  333. float get_playback_speed_scale() const;
  334. // Convenience method.
  335. void start_playback_stream(Ref<AudioStreamPlayback> p_playback, const StringName &p_bus, Vector<AudioFrame> p_volume_db_vector, float p_start_time = 0, float p_pitch_scale = 1);
  336. // Expose all parameters.
  337. void start_playback_stream(Ref<AudioStreamPlayback> p_playback, const HashMap<StringName, Vector<AudioFrame>> &p_bus_volumes, float p_start_time = 0, float p_pitch_scale = 1, float p_highshelf_gain = 0, float p_attenuation_cutoff_hz = 0);
  338. void stop_playback_stream(Ref<AudioStreamPlayback> p_playback);
  339. void set_playback_bus_exclusive(Ref<AudioStreamPlayback> p_playback, const StringName &p_bus, Vector<AudioFrame> p_volumes);
  340. void set_playback_bus_volumes_linear(Ref<AudioStreamPlayback> p_playback, const HashMap<StringName, Vector<AudioFrame>> &p_bus_volumes);
  341. void set_playback_all_bus_volumes_linear(Ref<AudioStreamPlayback> p_playback, Vector<AudioFrame> p_volumes);
  342. void set_playback_pitch_scale(Ref<AudioStreamPlayback> p_playback, float p_pitch_scale);
  343. void set_playback_paused(Ref<AudioStreamPlayback> p_playback, bool p_paused);
  344. void set_playback_highshelf_params(Ref<AudioStreamPlayback> p_playback, float p_gain, float p_attenuation_cutoff_hz);
  345. bool is_playback_active(Ref<AudioStreamPlayback> p_playback);
  346. float get_playback_position(Ref<AudioStreamPlayback> p_playback);
  347. bool is_playback_paused(Ref<AudioStreamPlayback> p_playback);
  348. uint64_t get_mix_count() const;
  349. uint64_t get_mixed_frames() const;
  350. String get_driver_name() const;
  351. void notify_listener_changed();
  352. virtual void init();
  353. virtual void finish();
  354. virtual void update();
  355. virtual void load_default_bus_layout();
  356. /* MISC config */
  357. virtual void lock();
  358. virtual void unlock();
  359. virtual SpeakerMode get_speaker_mode() const;
  360. virtual float get_mix_rate() const;
  361. virtual float get_input_mix_rate() const;
  362. virtual float read_output_peak_db() const;
  363. static AudioServer *get_singleton();
  364. virtual double get_output_latency() const;
  365. virtual double get_time_to_next_mix() const;
  366. virtual double get_time_since_last_mix() const;
  367. void add_listener_changed_callback(AudioCallback p_callback, void *p_userdata);
  368. void remove_listener_changed_callback(AudioCallback p_callback, void *p_userdata);
  369. void add_update_callback(AudioCallback p_callback, void *p_userdata);
  370. void remove_update_callback(AudioCallback p_callback, void *p_userdata);
  371. void add_mix_callback(AudioCallback p_callback, void *p_userdata);
  372. void remove_mix_callback(AudioCallback p_callback, void *p_userdata);
  373. void set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout);
  374. Ref<AudioBusLayout> generate_bus_layout() const;
  375. PackedStringArray get_output_device_list();
  376. String get_output_device();
  377. void set_output_device(const String &p_name);
  378. PackedStringArray get_input_device_list();
  379. String get_input_device();
  380. void set_input_device(const String &p_name);
  381. void set_enable_tagging_used_audio_streams(bool p_enable);
  382. #ifdef TOOLS_ENABLED
  383. virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
  384. #endif
  385. PlaybackType get_default_playback_type() const;
  386. bool is_stream_registered_as_sample(const Ref<AudioStream> &p_stream);
  387. void register_stream_as_sample(const Ref<AudioStream> &p_stream);
  388. void unregister_stream_as_sample(const Ref<AudioStream> &p_stream);
  389. void register_sample(const Ref<AudioSample> &p_sample);
  390. void unregister_sample(const Ref<AudioSample> &p_sample);
  391. void start_sample_playback(const Ref<AudioSamplePlayback> &p_playback);
  392. void stop_sample_playback(const Ref<AudioSamplePlayback> &p_playback);
  393. void set_sample_playback_pause(const Ref<AudioSamplePlayback> &p_playback, bool p_paused);
  394. bool is_sample_playback_active(const Ref<AudioSamplePlayback> &p_playback);
  395. double get_sample_playback_position(const Ref<AudioSamplePlayback> &p_playback);
  396. void update_sample_playback_pitch_scale(const Ref<AudioSamplePlayback> &p_playback, float p_pitch_scale = 0.0f);
  397. AudioServer();
  398. virtual ~AudioServer();
  399. };
  400. VARIANT_ENUM_CAST(AudioServer::SpeakerMode)
  401. VARIANT_ENUM_CAST(AudioServer::PlaybackType)
  402. class AudioBusLayout : public Resource {
  403. GDCLASS(AudioBusLayout, Resource);
  404. friend class AudioServer;
  405. struct Bus {
  406. StringName name;
  407. bool solo = false;
  408. bool mute = false;
  409. bool bypass = false;
  410. struct Effect {
  411. Ref<AudioEffect> effect;
  412. bool enabled = false;
  413. };
  414. Vector<Effect> effects;
  415. float volume_db = 0.0f;
  416. StringName send;
  417. Bus() {}
  418. };
  419. Vector<Bus> buses;
  420. protected:
  421. bool _set(const StringName &p_name, const Variant &p_value);
  422. bool _get(const StringName &p_name, Variant &r_ret) const;
  423. void _get_property_list(List<PropertyInfo> *p_list) const;
  424. public:
  425. AudioBusLayout();
  426. };
  427. typedef AudioServer AS;
  428. #endif // AUDIO_SERVER_H