Merge pull request #94808 from RandomShaper/aud_srv_cod_sty

AudioServer: Fix code style issues
This commit is contained in:
Rémi Verschelde 2024-08-28 00:12:25 +02:00
commit 24f97f3f08
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -486,10 +486,16 @@ void AudioServer::_mix_step() {
} }
// Copy the bus details we mixed with to the previous bus details to maintain volume ramps. // Copy the bus details we mixed with to the previous bus details to maintain volume ramps.
std::copy(std::begin(bus_details.bus_active), std::end(bus_details.bus_active), std::begin(playback->prev_bus_details->bus_active)); for (int i = 0; i < MAX_BUSES_PER_PLAYBACK; i++) {
std::copy(std::begin(bus_details.bus), std::end(bus_details.bus), std::begin(playback->prev_bus_details->bus)); playback->prev_bus_details->bus_active[i] = bus_details.bus_active[i];
for (int bus_idx = 0; bus_idx < MAX_BUSES_PER_PLAYBACK; bus_idx++) { }
std::copy(std::begin(bus_details.volume[bus_idx]), std::end(bus_details.volume[bus_idx]), std::begin(playback->prev_bus_details->volume[bus_idx])); for (int i = 0; i < MAX_BUSES_PER_PLAYBACK; i++) {
playback->prev_bus_details->bus[i] = bus_details.bus[i];
}
for (int i = 0; i < MAX_BUSES_PER_PLAYBACK; i++) {
for (int j = 0; j < MAX_CHANNELS_PER_BUS; j++) {
playback->prev_bus_details->volume[i][j] = bus_details.volume[i][j];
}
} }
switch (playback->state.load()) { switch (playback->state.load()) {
@ -497,7 +503,7 @@ void AudioServer::_mix_step() {
case AudioStreamPlaybackListNode::FADE_OUT_TO_DELETION: case AudioStreamPlaybackListNode::FADE_OUT_TO_DELETION:
playback_list.erase(playback, [](AudioStreamPlaybackListNode *p) { playback_list.erase(playback, [](AudioStreamPlaybackListNode *p) {
delete p->prev_bus_details; delete p->prev_bus_details;
delete p->bus_details; delete p->bus_details.load();
p->stream_playback.unref(); p->stream_playback.unref();
delete p; delete p;
}); });
@ -1199,7 +1205,7 @@ void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, con
} }
idx++; idx++;
} }
playback_node->bus_details = new_bus_details; playback_node->bus_details.store(new_bus_details);
playback_node->prev_bus_details = new AudioStreamPlaybackBusDetails(); playback_node->prev_bus_details = new AudioStreamPlaybackBusDetails();
playback_node->pitch_scale.set(p_pitch_scale); playback_node->pitch_scale.set(p_pitch_scale);