Skip to content

Commit

Permalink
code rev
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed Nov 5, 2023
1 parent d5a310d commit f2b30d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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<PCMStream>(sound);

auto channelId = m_mixer->play(
Expand Down Expand Up @@ -111,7 +121,6 @@ namespace HyperSonicDrivers::drivers
}

releaseEndedStreams_();
//assert(m_PCMStreams_channels.size() == 0);
}

void PCMDriver::releaseEndedStreams_() noexcept
Expand All @@ -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<audio::streams::PCMStream>& stream) noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace HyperSonicDrivers::drivers
const uint8_t max_streams;
private:
std::shared_ptr<audio::IMixer> m_mixer;
std::vector<std::shared_ptr<audio::streams::PCMStream>> m_PCMStreams;
std::vector<std::shared_ptr<audio::streams::PCMStream>> m_PCMStreams; // TODO: is this still required?
std::map<std::shared_ptr<audio::streams::PCMStream>, int> m_PCMStreams_channels;

void releaseEndedStreams_() noexcept;
Expand Down

0 comments on commit f2b30d9

Please sign in to comment.