Add a helper function to off all sister voices at once

This commit is contained in:
Paul Ferrand 2020-08-10 17:10:40 +02:00
parent f318c528a2
commit 4529d371f0

View file

@ -56,6 +56,22 @@ struct SisterVoiceRing {
return count;
}
/**
* @brief Off all sisters in a ring
*
* @param voice
* @param delay
*/
template<class T,
absl::enable_if_t<std::is_same<Voice, absl::remove_const_t<T>>::value, int> = 0>
static void offAllSisters(T* voice, int delay) {
if (voice != nullptr) {
SisterVoiceRing::applyToRing(voice, [&] (Voice* v) {
v->off(delay);
});
}
}
/**
* @brief Check if a sister voice ring is well formed
*