2021-08-11 21:00:28 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "tools/music.h"
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class BPMCalculator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit BPMCalculator(const std::shared_ptr<Music>& music);
|
|
|
|
void setMusic(const std::shared_ptr<Music>& music);
|
2021-09-01 21:04:18 +02:00
|
|
|
std::shared_ptr<Music> music() const;
|
2021-08-11 21:00:28 +02:00
|
|
|
|
2021-08-27 19:40:48 +02:00
|
|
|
void start();
|
2021-08-11 21:00:28 +02:00
|
|
|
|
|
|
|
void click();
|
|
|
|
int getCurrentApproximation() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Music> _music;
|
|
|
|
std::vector<microsec> _deltas;
|
|
|
|
microsec _previous_click_offset;
|
|
|
|
};
|