audio_stream_player_2d.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /**************************************************************************/
  2. /* audio_stream_player_2d.cpp */
  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. #include "audio_stream_player_2d.h"
  31. #include "core/engine.h"
  32. #include "core/project_settings.h"
  33. #include "scene/2d/area_2d.h"
  34. #include "scene/2d/listener_2d.h"
  35. #include "scene/main/viewport.h"
  36. void AudioStreamPlayer2D::_mix_audio() {
  37. if (!stream_playback.is_valid() || !active.is_set() ||
  38. (stream_paused && !stream_paused_fade_out)) {
  39. return;
  40. }
  41. if (setseek.get() >= 0.0) {
  42. stream_playback->start(setseek.get());
  43. setseek.set(-1.0); //reset seek
  44. }
  45. //get data
  46. AudioFrame *buffer = mix_buffer.ptrw();
  47. int buffer_size = mix_buffer.size();
  48. if (stream_paused_fade_out) {
  49. // Short fadeout ramp
  50. buffer_size = MIN(buffer_size, 128);
  51. }
  52. stream_playback->mix(buffer, pitch_scale, buffer_size);
  53. //write all outputs
  54. int oc = output_count.get();
  55. for (int i = 0; i < oc; i++) {
  56. Output current = outputs[i];
  57. //see if current output exists, to keep volume ramp
  58. bool found = false;
  59. for (int j = i; j < prev_output_count; j++) {
  60. if (prev_outputs[j].viewport == current.viewport) {
  61. if (j != i) {
  62. SWAP(prev_outputs[j], prev_outputs[i]);
  63. }
  64. found = true;
  65. break;
  66. }
  67. }
  68. if (!found) {
  69. //create new if was not used before
  70. if (prev_output_count < MAX_OUTPUTS) {
  71. prev_outputs[prev_output_count] = prev_outputs[i]; //may be owned by another viewport
  72. prev_output_count++;
  73. }
  74. prev_outputs[i] = current;
  75. }
  76. //mix!
  77. AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol;
  78. AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol;
  79. AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size);
  80. AudioFrame vol = vol_prev;
  81. int cc = AudioServer::get_singleton()->get_channel_count();
  82. if (cc == 1) {
  83. if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, 0)) {
  84. continue; //may have been removed
  85. }
  86. AudioFrame *target = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, 0);
  87. for (int j = 0; j < buffer_size; j++) {
  88. target[j] += buffer[j] * vol;
  89. vol += vol_inc;
  90. }
  91. } else {
  92. AudioFrame *targets[4];
  93. bool valid = true;
  94. for (int k = 0; k < cc; k++) {
  95. if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, k)) {
  96. valid = false; //may have been removed
  97. break;
  98. }
  99. targets[k] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, k);
  100. }
  101. if (!valid) {
  102. continue;
  103. }
  104. for (int j = 0; j < buffer_size; j++) {
  105. AudioFrame frame = buffer[j] * vol;
  106. for (int k = 0; k < cc; k++) {
  107. targets[k][j] += frame;
  108. }
  109. vol += vol_inc;
  110. }
  111. }
  112. prev_outputs[i] = current;
  113. }
  114. prev_output_count = oc;
  115. //stream is no longer active, disable this.
  116. if (!stream_playback->is_playing()) {
  117. active.clear();
  118. }
  119. output_ready.clear();
  120. stream_paused_fade_in = false;
  121. stream_paused_fade_out = false;
  122. }
  123. void AudioStreamPlayer2D::_notification(int p_what) {
  124. if (p_what == NOTIFICATION_ENTER_TREE) {
  125. AudioServer::get_singleton()->add_callback(_mix_audios, this);
  126. if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
  127. play();
  128. }
  129. }
  130. if (p_what == NOTIFICATION_EXIT_TREE) {
  131. AudioServer::get_singleton()->remove_callback(_mix_audios, this);
  132. }
  133. if (p_what == NOTIFICATION_PAUSED) {
  134. if (!can_process()) {
  135. // Node can't process so we start fading out to silence
  136. set_stream_paused(true);
  137. }
  138. }
  139. if (p_what == NOTIFICATION_UNPAUSED) {
  140. set_stream_paused(false);
  141. }
  142. if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
  143. //update anything related to position first, if possible of course
  144. if (!output_ready.is_set()) {
  145. List<Viewport *> viewports;
  146. Ref<World2D> world_2d = get_world_2d();
  147. ERR_FAIL_COND(world_2d.is_null());
  148. int new_output_count = 0;
  149. Vector2 global_pos = get_global_position();
  150. int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
  151. //check if any area is diverting sound into a bus
  152. Physics2DDirectSpaceState *space_state = Physics2DServer::get_singleton()->space_get_direct_state(world_2d->get_space());
  153. Physics2DDirectSpaceState::ShapeResult sr[MAX_INTERSECT_AREAS];
  154. int areas = space_state->intersect_point(global_pos, sr, MAX_INTERSECT_AREAS, Set<RID>(), area_mask, false, true);
  155. for (int i = 0; i < areas; i++) {
  156. Area2D *area2d = Object::cast_to<Area2D>(sr[i].collider);
  157. if (!area2d) {
  158. continue;
  159. }
  160. if (!area2d->is_overriding_audio_bus()) {
  161. continue;
  162. }
  163. StringName bus_name = area2d->get_audio_bus_name();
  164. bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus_name);
  165. break;
  166. }
  167. world_2d->get_viewport_list(&viewports);
  168. for (List<Viewport *>::Element *E = viewports.front(); E; E = E->next()) {
  169. Viewport *vp = E->get();
  170. if (vp->is_audio_listener_2d()) {
  171. //compute matrix to convert to screen
  172. Vector2 screen_size = vp->get_visible_rect().size;
  173. Vector2 listener_in_global;
  174. Vector2 relative_to_listener;
  175. Listener2D *listener = vp->get_listener_2d();
  176. if (listener) {
  177. listener_in_global = listener->get_global_position();
  178. relative_to_listener = global_pos - listener_in_global;
  179. } else {
  180. Transform2D to_listener = vp->get_global_canvas_transform() * vp->get_canvas_transform();
  181. listener_in_global = to_listener.affine_inverse().xform(screen_size * 0.5);
  182. relative_to_listener = to_listener.xform(global_pos) - screen_size * 0.5;
  183. }
  184. float dist = global_pos.distance_to(listener_in_global); // Distance to listener, or screen if none.
  185. if (dist > max_distance) {
  186. continue; //can't hear this sound in this viewport
  187. }
  188. float multiplier = Math::pow(1.0f - dist / max_distance, attenuation);
  189. multiplier *= Math::db2linear(volume_db); //also apply player volume!
  190. float pan = relative_to_listener.x / screen_size.x;
  191. // Don't let the panning effect extend (too far) beyond the screen.
  192. pan = CLAMP(pan, -1, 1);
  193. // Bake in a constant factor here to allow the project setting defaults for 2d and 3d to be normalized to 1.0.
  194. pan *= panning_strength * cached_global_panning_strength * 0.5f;
  195. pan = CLAMP(pan + 0.5, 0.0, 1.0);
  196. float l = 1.0 - pan;
  197. float r = pan;
  198. outputs[new_output_count].vol = AudioFrame(l, r) * multiplier;
  199. outputs[new_output_count].bus_index = bus_index;
  200. outputs[new_output_count].viewport = vp; //keep pointer only for reference
  201. new_output_count++;
  202. if (new_output_count == MAX_OUTPUTS) {
  203. break;
  204. }
  205. }
  206. }
  207. output_count.set(new_output_count);
  208. output_ready.set();
  209. }
  210. //start playing if requested
  211. if (setplay.get() >= 0.0) {
  212. setseek.set(setplay.get());
  213. active.set();
  214. setplay.set(-1);
  215. //do not update, this makes it easier to animate (will shut off otherwise)
  216. //_change_notify("playing"); //update property in editor
  217. }
  218. //stop playing if no longer active
  219. if (!active.is_set()) {
  220. set_physics_process_internal(false);
  221. //do not update, this makes it easier to animate (will shut off otherwise)
  222. //_change_notify("playing"); //update property in editor
  223. emit_signal("finished");
  224. }
  225. }
  226. }
  227. void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) {
  228. // Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
  229. Ref<AudioStreamPlayback> pre_instanced_playback;
  230. if (p_stream.is_valid()) {
  231. pre_instanced_playback = p_stream->instance_playback();
  232. }
  233. AudioServer::get_singleton()->lock();
  234. mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
  235. if (stream_playback.is_valid()) {
  236. stream_playback.unref();
  237. stream.unref();
  238. active.clear();
  239. setseek.set(-1);
  240. }
  241. if (p_stream.is_valid()) {
  242. stream = p_stream;
  243. stream_playback = pre_instanced_playback;
  244. }
  245. AudioServer::get_singleton()->unlock();
  246. if (p_stream.is_valid() && stream_playback.is_null()) {
  247. stream.unref();
  248. }
  249. }
  250. Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
  251. return stream;
  252. }
  253. void AudioStreamPlayer2D::set_volume_db(float p_volume) {
  254. volume_db = p_volume;
  255. }
  256. float AudioStreamPlayer2D::get_volume_db() const {
  257. return volume_db;
  258. }
  259. void AudioStreamPlayer2D::set_pitch_scale(float p_pitch_scale) {
  260. ERR_FAIL_COND(!(p_pitch_scale > 0.0));
  261. pitch_scale = p_pitch_scale;
  262. }
  263. float AudioStreamPlayer2D::get_pitch_scale() const {
  264. return pitch_scale;
  265. }
  266. void AudioStreamPlayer2D::play(float p_from_pos) {
  267. if (!is_playing()) {
  268. // Reset the prev_output_count if the stream is stopped
  269. prev_output_count = 0;
  270. }
  271. if (stream_playback.is_valid()) {
  272. setplay.set(p_from_pos);
  273. output_ready.clear();
  274. set_physics_process_internal(true);
  275. }
  276. }
  277. void AudioStreamPlayer2D::seek(float p_seconds) {
  278. if (stream_playback.is_valid()) {
  279. setseek.set(p_seconds);
  280. }
  281. }
  282. void AudioStreamPlayer2D::stop() {
  283. if (stream_playback.is_valid()) {
  284. active.clear();
  285. set_physics_process_internal(false);
  286. setplay.set(-1);
  287. }
  288. }
  289. bool AudioStreamPlayer2D::is_playing() const {
  290. if (stream_playback.is_valid()) {
  291. return active.is_set() || setplay.get() >= 0;
  292. }
  293. return false;
  294. }
  295. float AudioStreamPlayer2D::get_playback_position() {
  296. if (stream_playback.is_valid()) {
  297. float ss = setseek.get();
  298. if (ss >= 0.0) {
  299. return ss;
  300. }
  301. return stream_playback->get_playback_position();
  302. }
  303. return 0;
  304. }
  305. void AudioStreamPlayer2D::set_bus(const StringName &p_bus) {
  306. //if audio is active, must lock this
  307. AudioServer::get_singleton()->lock();
  308. bus = p_bus;
  309. AudioServer::get_singleton()->unlock();
  310. }
  311. StringName AudioStreamPlayer2D::get_bus() const {
  312. for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
  313. if (AudioServer::get_singleton()->get_bus_name(i) == bus) {
  314. return bus;
  315. }
  316. }
  317. return "Master";
  318. }
  319. void AudioStreamPlayer2D::set_autoplay(bool p_enable) {
  320. autoplay = p_enable;
  321. }
  322. bool AudioStreamPlayer2D::is_autoplay_enabled() {
  323. return autoplay;
  324. }
  325. void AudioStreamPlayer2D::_set_playing(bool p_enable) {
  326. if (p_enable) {
  327. play();
  328. } else {
  329. stop();
  330. }
  331. }
  332. bool AudioStreamPlayer2D::_is_active() const {
  333. return active.is_set();
  334. }
  335. void AudioStreamPlayer2D::_validate_property(PropertyInfo &property) const {
  336. if (property.name == "bus") {
  337. String options;
  338. for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
  339. if (i > 0) {
  340. options += ",";
  341. }
  342. String name = AudioServer::get_singleton()->get_bus_name(i);
  343. options += name;
  344. }
  345. property.hint_string = options;
  346. }
  347. }
  348. void AudioStreamPlayer2D::_bus_layout_changed() {
  349. _change_notify();
  350. }
  351. void AudioStreamPlayer2D::set_max_distance(float p_pixels) {
  352. ERR_FAIL_COND(p_pixels <= 0.0);
  353. max_distance = p_pixels;
  354. }
  355. float AudioStreamPlayer2D::get_max_distance() const {
  356. return max_distance;
  357. }
  358. void AudioStreamPlayer2D::set_attenuation(float p_curve) {
  359. attenuation = p_curve;
  360. }
  361. float AudioStreamPlayer2D::get_attenuation() const {
  362. return attenuation;
  363. }
  364. void AudioStreamPlayer2D::set_area_mask(uint32_t p_mask) {
  365. area_mask = p_mask;
  366. }
  367. uint32_t AudioStreamPlayer2D::get_area_mask() const {
  368. return area_mask;
  369. }
  370. void AudioStreamPlayer2D::set_stream_paused(bool p_pause) {
  371. if (p_pause != stream_paused) {
  372. stream_paused = p_pause;
  373. stream_paused_fade_in = !p_pause;
  374. stream_paused_fade_out = p_pause;
  375. }
  376. }
  377. bool AudioStreamPlayer2D::get_stream_paused() const {
  378. return stream_paused;
  379. }
  380. Ref<AudioStreamPlayback> AudioStreamPlayer2D::get_stream_playback() {
  381. return stream_playback;
  382. }
  383. void AudioStreamPlayer2D::set_panning_strength(float p_panning_strength) {
  384. ERR_FAIL_COND_MSG(p_panning_strength < 0, "Panning strength must be a positive number.");
  385. panning_strength = p_panning_strength;
  386. }
  387. float AudioStreamPlayer2D::get_panning_strength() const {
  388. return panning_strength;
  389. }
  390. void AudioStreamPlayer2D::_bind_methods() {
  391. ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer2D::set_stream);
  392. ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer2D::get_stream);
  393. ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer2D::set_volume_db);
  394. ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer2D::get_volume_db);
  395. ClassDB::bind_method(D_METHOD("set_pitch_scale", "pitch_scale"), &AudioStreamPlayer2D::set_pitch_scale);
  396. ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioStreamPlayer2D::get_pitch_scale);
  397. ClassDB::bind_method(D_METHOD("play", "from_position"), &AudioStreamPlayer2D::play, DEFVAL(0.0));
  398. ClassDB::bind_method(D_METHOD("seek", "to_position"), &AudioStreamPlayer2D::seek);
  399. ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer2D::stop);
  400. ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer2D::is_playing);
  401. ClassDB::bind_method(D_METHOD("get_playback_position"), &AudioStreamPlayer2D::get_playback_position);
  402. ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer2D::set_bus);
  403. ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer2D::get_bus);
  404. ClassDB::bind_method(D_METHOD("set_autoplay", "enable"), &AudioStreamPlayer2D::set_autoplay);
  405. ClassDB::bind_method(D_METHOD("is_autoplay_enabled"), &AudioStreamPlayer2D::is_autoplay_enabled);
  406. ClassDB::bind_method(D_METHOD("_set_playing", "enable"), &AudioStreamPlayer2D::_set_playing);
  407. ClassDB::bind_method(D_METHOD("_is_active"), &AudioStreamPlayer2D::_is_active);
  408. ClassDB::bind_method(D_METHOD("set_max_distance", "pixels"), &AudioStreamPlayer2D::set_max_distance);
  409. ClassDB::bind_method(D_METHOD("get_max_distance"), &AudioStreamPlayer2D::get_max_distance);
  410. ClassDB::bind_method(D_METHOD("set_attenuation", "curve"), &AudioStreamPlayer2D::set_attenuation);
  411. ClassDB::bind_method(D_METHOD("get_attenuation"), &AudioStreamPlayer2D::get_attenuation);
  412. ClassDB::bind_method(D_METHOD("set_area_mask", "mask"), &AudioStreamPlayer2D::set_area_mask);
  413. ClassDB::bind_method(D_METHOD("get_area_mask"), &AudioStreamPlayer2D::get_area_mask);
  414. ClassDB::bind_method(D_METHOD("set_stream_paused", "pause"), &AudioStreamPlayer2D::set_stream_paused);
  415. ClassDB::bind_method(D_METHOD("get_stream_paused"), &AudioStreamPlayer2D::get_stream_paused);
  416. ClassDB::bind_method(D_METHOD("set_panning_strength", "panning_strength"), &AudioStreamPlayer2D::set_panning_strength);
  417. ClassDB::bind_method(D_METHOD("get_panning_strength"), &AudioStreamPlayer2D::get_panning_strength);
  418. ClassDB::bind_method(D_METHOD("get_stream_playback"), &AudioStreamPlayer2D::get_stream_playback);
  419. ClassDB::bind_method(D_METHOD("_bus_layout_changed"), &AudioStreamPlayer2D::_bus_layout_changed);
  420. ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
  421. ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
  422. ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,4,0.01,or_greater"), "set_pitch_scale", "get_pitch_scale");
  423. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
  424. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
  425. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stream_paused", PROPERTY_HINT_NONE, ""), "set_stream_paused", "get_stream_paused");
  426. ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_EXP_RANGE, "1,4096,1,or_greater"), "set_max_distance", "get_max_distance");
  427. ADD_PROPERTY(PropertyInfo(Variant::REAL, "attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), "set_attenuation", "get_attenuation");
  428. ADD_PROPERTY(PropertyInfo(Variant::REAL, "panning_strength", PROPERTY_HINT_RANGE, "0,3,0.01,or_greater"), "set_panning_strength", "get_panning_strength");
  429. ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
  430. ADD_PROPERTY(PropertyInfo(Variant::INT, "area_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_area_mask", "get_area_mask");
  431. ADD_SIGNAL(MethodInfo("finished"));
  432. }
  433. AudioStreamPlayer2D::AudioStreamPlayer2D() {
  434. volume_db = 0;
  435. pitch_scale = 1.0;
  436. autoplay = false;
  437. setseek.set(-1);
  438. prev_output_count = 0;
  439. max_distance = 2000;
  440. attenuation = 1;
  441. setplay.set(-1);
  442. area_mask = 1;
  443. stream_paused = false;
  444. stream_paused_fade_in = false;
  445. stream_paused_fade_out = false;
  446. AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
  447. cached_global_panning_strength = ProjectSettings::get_singleton()->get("audio/2d_panning_strength");
  448. }
  449. AudioStreamPlayer2D::~AudioStreamPlayer2D() {
  450. }