audio-related minor refactor

This commit is contained in:
MihailRis
2024-04-10 20:11:43 +03:00
parent c8ca56fb8e
commit 1549a02731
5 changed files with 20 additions and 28 deletions
+1 -2
View File
@@ -383,13 +383,12 @@ void audio::update(double delta) {
entry.second->update(delta);
}
float masterVolume = channels.at(0)->getVolume();
for (auto it = speakers.begin(); it != speakers.end();) {
auto speaker = it->second.get();
int speakerChannel = speaker->getChannel();
auto channel = get_channel(speakerChannel);
if (channel != nullptr) {
speaker->update(channel, speakerChannel == 0 ? 1.0f : masterVolume);
speaker->update(channel);
}
if (speaker->isStopped()) {
streams.erase(it->first);