-
Notifications
You must be signed in to change notification settings - Fork 21
/
VoicesBody.cpp
57 lines (41 loc) · 1.19 KB
/
VoicesBody.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*****************************************************************************
VoicesBody.cpp
Copyright (c) 2020 Raphael DINGE
*Tab=3***********************************************************************/
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "VoicesBody.h"
#include <cmath>
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : trigger
==============================================================================
*/
void VoicesBody::trigger ()
{
_cur_voice = (_cur_voice + 1) % _voices.size ();
for (size_t i = 0 ; i < _voices.size () ; ++i)
{
auto & voice = _voices [i];
if (i == _cur_voice)
{
voice.trigger ();
}
else
{
voice.stop ();
}
}
}
/*
==============================================================================
Name : set_speed
==============================================================================
*/
void VoicesBody::set_speed (float step_spl)
{
for (auto && voice : _voices)
{
voice.set_speed (step_spl);
}
}