1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-17 06:29:28 +00:00

Use fold expression for final-answer is_stereo.

This commit is contained in:
Thomas Harte 2024-02-08 11:10:08 -05:00
parent d481f335b8
commit 147d817977

View File

@ -17,6 +17,15 @@
namespace Outputs::Speaker {
/// @returns @c true if any of the templated sources is stereo; @c false otherwise.
template <typename... S> constexpr bool is_stereo() {
bool is_stereo = false;
([&] {
is_stereo |= S::is_stereo;
}(), ...);
return is_stereo;
}
/*!
A CompoundSource adds together the sound generated by multiple individual SampleSources.
An owner may optionally assign relative volumes.
@ -148,7 +157,7 @@ template <typename... T> class CompoundSource:
/*!
@c true if any of the sources owned by this CompoundSource is stereo.
*/
static constexpr bool is_stereo = CompoundSourceHolder<T...>::is_stereo;
static constexpr bool is_stereo = ::Outputs::Speaker::is_stereo<T...>();
/*!
@returns the average output peak given the sources owned by this CompoundSource and the