Loopp/src/timemanager.hxx

59 lines
1.0 KiB
C++
Raw Normal View History

#ifndef LUPPP_TIME_H
#define LUPPP_TIME_H
#include <iostream>
#include <cstdio>
#include "buffers.hxx"
#include "eventhandler.hxx"
2013-07-31 11:55:48 +02:00
#include "observer/time.hxx"
using namespace std;
class TimeManager
{
public:
2013-08-15 22:05:19 +02:00
TimeManager();
2013-08-15 22:05:19 +02:00
int getFpb();
void setBpm(float bpm);
2013-12-01 20:01:58 +01:00
void setBpmZeroOne(float bpm);
2013-08-15 22:05:19 +02:00
void setFpb(float f);
2013-08-15 22:05:19 +02:00
void registerObserver(TimeObserver* o);
2013-08-15 22:05:19 +02:00
void tap();
void process(Buffers* buffers);
/// returns the number of samples till beat if a beat exists in this process
/// Otherwise returns nframes
int getNframesToBeat();
private:
2013-09-17 14:11:11 +02:00
int samplerate;
/// holds the number of frames before a beat
//int nframesToBeat;
2013-12-05 20:57:17 +01:00
long long totalFrameCounter;
/// counts down frames until the next beat
2013-12-05 20:57:17 +01:00
long beatFrameCountdown;
float fpb;
int beatCounter;
/// tap tempo measurements
int frame;
int tapTempoPos;
int tapTempo[3];
2013-07-31 11:55:48 +02:00
std::vector<TimeObserver*> observers;
};
#endif // LUPPP_TIME_H