1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Add a bus_renamed AudioServer signal

This commit is contained in:
MewPurPur
2023-09-14 13:39:23 +03:00
parent 5c43e4c1ef
commit f29b6e73c2
10 changed files with 64 additions and 62 deletions

View File

@@ -236,6 +236,14 @@ bool AudioStreamPlayer::_is_active() const {
return false;
}
void AudioStreamPlayer::_on_bus_layout_changed() {
notify_property_list_changed();
}
void AudioStreamPlayer::_on_bus_renamed(int p_bus_index, const StringName &p_old_name, const StringName &p_new_name) {
notify_property_list_changed();
}
void AudioStreamPlayer::set_stream_paused(bool p_pause) {
// TODO this does not have perfect recall, fix that maybe? If there are zero playbacks registered with the AudioServer, this bool isn't persisted.
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
@@ -303,10 +311,6 @@ void AudioStreamPlayer::_validate_property(PropertyInfo &p_property) const {
}
}
void AudioStreamPlayer::_bus_layout_changed() {
notify_property_list_changed();
}
bool AudioStreamPlayer::has_stream_playback() {
return !stream_playbacks.is_empty();
}
@@ -372,7 +376,8 @@ void AudioStreamPlayer::_bind_methods() {
}
AudioStreamPlayer::AudioStreamPlayer() {
AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer::_bus_layout_changed));
AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer::_on_bus_layout_changed));
AudioServer::get_singleton()->connect("bus_renamed", callable_mp(this, &AudioStreamPlayer::_on_bus_renamed));
}
AudioStreamPlayer::~AudioStreamPlayer() {