Tuner: fix octave and deviation post-filters
This commit is contained in:
parent
a5e74d6300
commit
ef3f8db1d3
3 changed files with 6 additions and 4 deletions
|
@ -74,6 +74,7 @@ void Tuner::Start()
|
||||||
cerr << __func__ << endl;
|
cerr << __func__ << endl;
|
||||||
count_found = count_not_found = 0;
|
count_found = count_not_found = 0;
|
||||||
nb_sample_running = 0;
|
nb_sample_running = 0;
|
||||||
|
note_found = octave_found = -1;
|
||||||
ResetDeviation();
|
ResetDeviation();
|
||||||
blank_prevent(true);
|
blank_prevent(true);
|
||||||
high_filter->Clear();
|
high_filter->Clear();
|
||||||
|
@ -123,13 +124,13 @@ void Tuner::UpdateDeviation(double d)
|
||||||
deviation_values[(deviation_start + nb_deviation) % nbDeviationValues] = d;
|
deviation_values[(deviation_start + nb_deviation) % nbDeviationValues] = d;
|
||||||
nb_deviation++;
|
nb_deviation++;
|
||||||
deviation_sum += d;
|
deviation_sum += d;
|
||||||
deviation = deviation_sum / nb_deviation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tuner::SetFound(int n, int o, double d)
|
void Tuner::SetFound(int n, int o, double d)
|
||||||
{
|
{
|
||||||
if (n != note_found) {
|
if (n != note_found || o != octave_found) {
|
||||||
note_found = n;
|
note_found = n;
|
||||||
|
octave_found = o;
|
||||||
count_found = 0;
|
count_found = 0;
|
||||||
SetNotFound();
|
SetNotFound();
|
||||||
|
|
||||||
|
@ -151,6 +152,7 @@ void Tuner::SetFound(int n, int o, double d)
|
||||||
octaveChanged();
|
octaveChanged();
|
||||||
}
|
}
|
||||||
UpdateDeviation(d);
|
UpdateDeviation(d);
|
||||||
|
deviation = deviation_sum / nb_deviation;
|
||||||
deviationChanged();
|
deviationChanged();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Tuner : public QObject {
|
||||||
bool running, found;
|
bool running, found;
|
||||||
double freq, deviation;
|
double freq, deviation;
|
||||||
int note, octave, nb_sample_running;
|
int note, octave, nb_sample_running;
|
||||||
int note_found, count_found, count_not_found;
|
int note_found, octave_found, count_found, count_not_found;
|
||||||
int nb_deviation, deviation_start;
|
int nb_deviation, deviation_start;
|
||||||
double deviation_sum;
|
double deviation_sum;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue