summaryrefslogtreecommitdiffhomepage
path: root/tuner.h
blob: f5cb5e4d55c06ac4b597907eedc97c5f0f98daca (plain)
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
#pragma once

#include <complex>
#include <memory>
#include <string>
#include <vector>

namespace RIT {

struct Pitch {
	double f{}; // in Hz
	double deviation{}; // 0.0 == perfect, +/-1.0: at next note
	std::string name; // "" for none, "A", "A#", ... for notes
};

class Tuner {
public:
	Tuner(int size, int f_sample);
	~Tuner();

	double fMin();
	double fMax();

	Pitch operator() (const std::vector<std::complex<double>> &v);

private:
	struct Impl;
	std::unique_ptr<Impl> mImpl;
}; // class Tuner

} // namespace RIT