diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.cpp index d1a4f4dc..e8250868 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.cpp @@ -41,6 +41,12 @@ namespace HyperSonicDrivers::drivers return isPCMStreamPlaying_(ss); } + /*for (const auto& ss : m_PCMStreams_channels) + { + if (ss.first->getSound() == sound) + return isPCMStreamPlaying_(ss.first); + }*/ + return false; } @@ -51,6 +57,10 @@ namespace HyperSonicDrivers::drivers if (it == m_PCMStreams.end()) return std::nullopt; + //releaseEndedStreams_(); + //if (m_PCMStreams_channels.size() == max_streams) + // return std::nullopt; + *it = std::make_shared(sound); auto channelId = m_mixer->play( @@ -111,7 +121,6 @@ namespace HyperSonicDrivers::drivers } releaseEndedStreams_(); - //assert(m_PCMStreams_channels.size() == 0); } void PCMDriver::releaseEndedStreams_() noexcept @@ -126,6 +135,7 @@ namespace HyperSonicDrivers::drivers m_PCMStreams[i] = nullptr; } } + //assert(m_PCMStreams_channels.size() == 0); } inline bool PCMDriver::isPCMStreamPlaying_(const std::shared_ptr& stream) noexcept diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.hpp index 8ec5e5f9..d7b90472 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/PCMDriver.hpp @@ -39,7 +39,7 @@ namespace HyperSonicDrivers::drivers const uint8_t max_streams; private: std::shared_ptr m_mixer; - std::vector> m_PCMStreams; + std::vector> m_PCMStreams; // TODO: is this still required? std::map, int> m_PCMStreams_channels; void releaseEndedStreams_() noexcept;