Skip to content

Commit 35c908a

Browse files
committed
refactor: detach buffer on sound stop and remove unused data member
1 parent 7130edc commit 35c908a

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

src/common/systems/audio-system.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ namespace our {
199199

200200
void AudioSystem::stopSound(ALuint source) {
201201
alSourceStop(source);
202+
alSourcei(source, AL_BUFFER, AL_NONE); // detach buffer so it can be safely deleted
202203
checkALError("Stopping sound");
203204
}
204205

src/common/systems/audio-system.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ namespace our {
2020
void update(World* world);
2121
void destroy();
2222

23-
std::vector<ALuint> sources; // List of all AL sources used by this system
24-
2523
// On-demand function to play a sound at a 3D world position (fire-and-forget)
2624
// Play a sound at a 3D world position (fire-and-forget)
2725
// - buffer: the AudioBuffer containing the sound data to play

0 commit comments

Comments
 (0)