From 916a12ff3dbbb289d6b15e781e32a3468aff96ab Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 29 Apr 2021 16:48:34 +0200 Subject: [PATCH] :bug: Fix missing sounds When playing the same sound twice with in a short duration then the sound it self, the secound request would go unfulfilled. The solution is to simply rewind the stream pointer before requesting a playback. --- Source/utils/soundsample.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/utils/soundsample.cpp b/Source/utils/soundsample.cpp index 45d2be396..ccf6e247e 100644 --- a/Source/utils/soundsample.cpp +++ b/Source/utils/soundsample.cpp @@ -51,6 +51,7 @@ void SoundSample::Play(int lVolume, int lPan, int channel) : copysign(1.F - std::pow(Base, static_cast(-std::fabs(lPan) / Scale)), static_cast(lPan))); + stream_->rewind(); if (!stream_->play()) { LogError(LogCategory::Audio, "Aulib::Stream::play (from SoundSample::Play): {}", SDL_GetError()); return;