1 /*
2  * Author: Harry van Haaren 2013
3  *         harryhaaren@gmail.com
4  *
5  *  This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LUPPP_METRONOME_H
20 #define LUPPP_METRONOME_H
21 
22 #include <cmath>
23 #include <iostream>
24 
25 #include "buffers.hxx"
26 
27 #include "observer/time.hxx"
28 
29 using namespace std;
30 
31 class Metronome : public TimeObserver
32 {
33 public:
34 	Metronome();
35 	~Metronome();
36 
37 	void setActive(bool a);
38 
39 	void bar();
40 	void beat();
41 	void setFpb(double f);
42 
43 	void setVolume( float v );
44 
45 	void process(int nframes, Buffers* buffers);
46 
47 private:
48 	double fpb;
49 	bool playBar;
50 	bool active;
51 	float vol;
52 
53 	int playPoint, endPoint;
54 	float* barSample;
55 	float* beatSample;
56 
57 };
58 
59 #endif // LUPPP_METRONOME_H
60