SailTuner/src/Tuner.hpp

85 lines
2.4 KiB
C++
Raw Normal View History

2016-01-03 19:32:36 +03:00
/* Copyright 2016 (C) Louis-Joseph Fournier
* louisjoseph.fournier@gmail.com
*
* This file is part of SailTuner.
*
* SailTuner is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SailTuner is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _TUNER_HPP
#define _TUNER_HPP
#include <QStringList>
#include "PitchDetection.hpp"
#include "TunerWorker.hpp"
class Tuner : public QObject {
Q_OBJECT
2016-01-10 01:33:19 +03:00
Q_PROPERTY(bool playing READ GetPlaying WRITE SetPlaying NOTIFY playingChanged)
Q_PROPERTY(bool running READ GetRunning WRITE SetRunning NOTIFY runningChanged)
Q_PROPERTY(double freq READ GetFreq NOTIFY resultChanged)
Q_PROPERTY(double deviation READ GetDeviation NOTIFY resultChanged)
Q_PROPERTY(int note READ GetNote NOTIFY resultChanged)
Q_PROPERTY(int octave READ GetOctave NOTIFY resultChanged)
2016-01-02 12:19:37 +03:00
Q_PROPERTY(bool found READ GetFound NOTIFY foundChanged)
Q_PROPERTY(int temperament_idx READ GetTemperamentIndex WRITE SetTemperamentIndex NOTIFY temperamentChanged)
Q_PROPERTY(QStringList temperament_list READ GetTemperamentList NOTIFY temperamentListChanged)
Q_PROPERTY(double la READ GetLa WRITE SetLa NOTIFY laChanged)
private:
TunerWorker *worker;
QThread workerThread;
PitchDetection::PitchResult result;
QStringList temperament_list;
2016-01-10 01:33:19 +03:00
bool running, playing;
double la;
int temperament_idx;
public:
Tuner();
~Tuner();
2016-01-10 01:33:19 +03:00
bool GetPlaying();
void SetPlaying(bool p);
bool GetRunning();
void SetRunning(bool r);
double GetFreq();
int GetNote();
int GetOctave();
double GetDeviation();
2016-01-02 12:19:37 +03:00
bool GetFound();
unsigned int GetTemperamentIndex();
void SetTemperamentIndex(int idx);
QStringList GetTemperamentList() const;
double GetLa();
void SetLa(double la);
public slots:
// slots from worker
void ResultUpdated(const PitchDetection::PitchResult &result);
void TemperamentListUpdated(const QStringList &list);
signals:
// signals to UI
2016-01-10 01:33:19 +03:00
void playingChanged();
void runningChanged();
2016-01-02 12:19:37 +03:00
void foundChanged();
void laChanged();
void resultChanged();
void temperamentChanged();
void temperamentListChanged();
};
#endif