Skip to content

Commit

Permalink
IMixer add reset channel group (stop)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed Nov 12, 2023
1 parent 6e744e7 commit 2658b94
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace HyperSonicDrivers::audio

virtual void reset() noexcept = 0;
virtual void reset(const uint8_t id) noexcept = 0;
virtual void reset(const mixer::eChannelGroup group) noexcept = 0;

virtual void pause() noexcept = 0;
virtual void pause(const uint8_t id) noexcept = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ namespace HyperSonicDrivers::audio::sdl2
m_channels[id]->reset();
}

void Mixer::reset(const mixer::eChannelGroup group) noexcept
{
std::scoped_lock lck(m_mutex);

for (const auto& ch : m_channels)
{
if (ch->getChannelGroup() == group)
ch->reset();
}
}

void Mixer::pause() noexcept
{
std::scoped_lock lck(m_mutex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace HyperSonicDrivers::audio::sdl2

void reset() noexcept override;
void reset(const uint8_t id) noexcept override;
void reset(const mixer::eChannelGroup group) noexcept override;

void pause() noexcept override;
void pause(const uint8_t id) noexcept override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace HyperSonicDrivers::audio

void reset() noexcept override {};
void reset(const uint8_t id) noexcept override {};
void reset(const mixer::eChannelGroup group) noexcept override {};

void pause() noexcept override {};
void pause(const uint8_t id) noexcept override {};
Expand Down

0 comments on commit 2658b94

Please sign in to comment.