Add audio::mix helper function

This commit is contained in:
Nikita Lisitsa 2023-01-11 15:23:34 +03:00
parent 5e93208fcb
commit 292ccadc7e
2 changed files with 11 additions and 0 deletions

View file

@ -4,6 +4,7 @@
#include <psemek/audio/channel.hpp>
#include <memory>
#include <vector>
namespace psemek::audio
{
@ -18,4 +19,6 @@ namespace psemek::audio
mixer_ptr make_mixer();
mixer_ptr mix(std::vector<stream_ptr> const & streams);
}

View file

@ -104,4 +104,12 @@ namespace psemek::audio
return std::make_shared<mixer_impl>();
}
mixer_ptr mix(std::vector<stream_ptr> const & streams)
{
auto mixer = make_mixer();
for (auto const & stream : streams)
mixer->add(stream);
return mixer;
}
}