Sailfish: build integration, display frequencie
This commit is contained in:
parent
8815fd2b65
commit
1ed6b9eed5
10 changed files with 270 additions and 2 deletions
11
harbour-sailtuner.desktop
Normal file
11
harbour-sailtuner.desktop
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Icon=harbour-sailtuner
|
||||||
|
Exec=harbour-sailtuner
|
||||||
|
X-Nemo-Application-Type=silica-qt5
|
||||||
|
Name=SailTuner
|
||||||
|
# translation example:
|
||||||
|
# your app name in German locale (de)
|
||||||
|
#
|
||||||
|
# Remember to comment out the following line, if you do not want to use
|
||||||
|
# a different app name in German locale (de).
|
BIN
harbour-sailtuner.png
Normal file
BIN
harbour-sailtuner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
20
harbour-sailtuner.pro
Normal file
20
harbour-sailtuner.pro
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
QT += qml quick gui multimedia
|
||||||
|
TARGET = harbour-sailtuner
|
||||||
|
|
||||||
|
CONFIG += c++11 sailfishapp sailfishapp_i18n
|
||||||
|
|
||||||
|
DEFINES += TARGET=\""$(TARGET")\"
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
qml/sailfish.qrc
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
src/sailfish.cpp \
|
||||||
|
src/Tuner.cpp \
|
||||||
|
src/audio/LinearFilter.cpp \
|
||||||
|
src/audio/ZeroCross.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
src/Tuner.hpp \
|
||||||
|
src/audio/LinearFilter.hpp \
|
||||||
|
src/audio/ZeroCross.hpp
|
55
qml/Sailfish.qml
Normal file
55
qml/Sailfish.qml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import Sailfish.Silica 1.0
|
||||||
|
import harbour.sailtuner.tuner 1.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sailfish main page
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
id: app
|
||||||
|
allowedOrientations: Orientation.All
|
||||||
|
|
||||||
|
property bool userRunning: true
|
||||||
|
property int dbFontSize: 100
|
||||||
|
property QtObject tuner
|
||||||
|
|
||||||
|
initialPage: Component {
|
||||||
|
ApplicationWindow {
|
||||||
|
Tuner {
|
||||||
|
id: tunerObject
|
||||||
|
running: Qt.application.active && app.userRunning
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject tuner: tunerObject
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: tuner.freq.toFixed(2) + " Hz"
|
||||||
|
font.pixelSize: 90
|
||||||
|
color: Theme.primaryColor
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
app.tuner = tunerObject
|
||||||
|
//togglePause.connect(app.togglePause)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cover: Component {
|
||||||
|
CoverBackground {
|
||||||
|
Text {
|
||||||
|
color: Theme.primaryColor
|
||||||
|
font.pixelSize: 40
|
||||||
|
text: app.tuner.freq.toFixed(2) + " Hz"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function togglePause() {
|
||||||
|
app.userRunning = app.userRunning ? false : true
|
||||||
|
}
|
||||||
|
}
|
5
qml/sailfish.qrc
Normal file
5
qml/sailfish.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource prefix="/qml/">
|
||||||
|
<file>Sailfish.qml</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
72
rpm/Makefile
Normal file
72
rpm/Makefile
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
# helper to build for Sailfish with sdk engine
|
||||||
|
|
||||||
|
SAILFISHOS_DIR = $(HOME)/SailfishOS
|
||||||
|
|
||||||
|
SSH_KEYS_DIR = $(SAILFISHOS_DIR)/vmshare/ssh/private_keys
|
||||||
|
SSH_KEY_ENGINE = $(SSH_KEYS_DIR)/engine/mersdk
|
||||||
|
SSH_KEY_EMULATOR = $(SSH_KEYS_DIR)/SailfishOS_Emulator/nemo
|
||||||
|
|
||||||
|
SSH_LOGIN_ENGINE = mersdk@localhost
|
||||||
|
SSH_LOGIN_EMULATOR = nemo@localhost
|
||||||
|
SSH_LOGIN_JOLLA = nemo@jolla
|
||||||
|
|
||||||
|
HOME_ENGINE = /home/mersdk/share
|
||||||
|
|
||||||
|
BUILD_DIR_LOCAL = $(HOME)/merBuild/sailtuner
|
||||||
|
BUILD_DIR_ENGINE = $(HOME_ENGINE)/merBuild/sailtuner
|
||||||
|
|
||||||
|
SOURCE_DIR_LOCAL = $(PWD)/..
|
||||||
|
#SOURCE_DIR_ENGINE = $(subst $(HOME),$(HOME_ENGINE),$(SOURCE_DIR_LOCAL))
|
||||||
|
SOURCE_DIR_ENGINE = /home/src1/SailTuner
|
||||||
|
|
||||||
|
PRO_FILE = harbour-sailtuner.pro
|
||||||
|
|
||||||
|
I486_TARGET = SailfishOS-i486
|
||||||
|
JOLLA_TARGET = SailfishOS-armv7hl
|
||||||
|
|
||||||
|
ENGINE_PORT = 2222
|
||||||
|
EMULATOR_PORT = 2223
|
||||||
|
|
||||||
|
BUILD_DIR_LOCAL_I486 = $(BUILD_DIR_LOCAL)/$(I486_TARGET)
|
||||||
|
BUILD_DIR_LOCAL_JOLLA = $(BUILD_DIR_LOCAL)/$(JOLLA_TARGET)
|
||||||
|
|
||||||
|
BUILD_DIR_ENGINE_I486 = $(BUILD_DIR_ENGINE)/$(I486_TARGET)
|
||||||
|
BUILD_DIR_ENGINE_JOLLA = $(BUILD_DIR_ENGINE)/$(JOLLA_TARGET)
|
||||||
|
|
||||||
|
SSH_ENGINE = ssh -p 2222 -i $(SSH_KEY_ENGINE) $(SSH_LOGIN_ENGINE)
|
||||||
|
SSH_EMULATOR = ssh -p 2223 -i $(SSH_KEY_EMULATOR) $(SSH_LOGIN_EMULATOR)
|
||||||
|
|
||||||
|
SCP_EMULATOR = scp -P 2223 -i $(SSH_KEY_EMULATOR)
|
||||||
|
|
||||||
|
RPM_I486 = harbour-sailtuner-0.1-1.i486.rpm
|
||||||
|
RPM_JOLLA = harbour-sailtuner-0.1-1.armv7hl.rpm
|
||||||
|
|
||||||
|
MB2 = mb2 -p $(SOURCE_DIR_ENGINE)
|
||||||
|
|
||||||
|
all: $(BUILD_DIR_LOCAL_I486)/Makefile
|
||||||
|
|
||||||
|
$(BUILD_DIR_LOCAL_I486):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(BUILD_DIR_LOCAL_I486)/Makefile: $(BUILD_DIR_LOCAL_I486)
|
||||||
|
$(SSH_ENGINE) "cd $(BUILD_DIR_ENGINE_I486) && $(MB2) qmake $(SOURCE_DIR_ENGINE)/$(PRO_FILE)"
|
||||||
|
|
||||||
|
rpm-i486: $(BUILD_DIR_LOCAL_I486)/Makefile
|
||||||
|
$(SSH_ENGINE) "cd $(BUILD_DIR_ENGINE_I486) && $(MB2) rpm"
|
||||||
|
|
||||||
|
install-i486: rpm-i486
|
||||||
|
$(SCP_EMULATOR) $(BUILD_DIR_LOCAL_I486)/RPMS/$(RPM_I486) $(SSH_LOGIN_EMULATOR):
|
||||||
|
$(SSH_EMULATOR) "sudo rpm -i $(RPM_I486) --force"
|
||||||
|
|
||||||
|
$(BUILD_DIR_LOCAL_JOLLA):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(BUILD_DIR_LOCAL_JOLLA)/Makefile: $(BUILD_DIR_LOCAL_JOLLA)
|
||||||
|
$(SSH_ENGINE) "cd $(BUILD_DIR_ENGINE_JOLLA) && $(MB2) -t $(JOLLA_TARGET) qmake $(SOURCE_DIR_ENGINE)/$(PRO_FILE)"
|
||||||
|
|
||||||
|
rpm-jolla: $(BUILD_DIR_LOCAL_JOLLA)/Makefile
|
||||||
|
$(SSH_ENGINE) "cd $(BUILD_DIR_ENGINE_JOLLA) && $(MB2) -t $(JOLLA_TARGET) rpm"
|
||||||
|
|
||||||
|
install-jolla: rpm-jolla
|
||||||
|
scp $(BUILD_DIR_LOCAL_JOLLA)/RPMS/$(RPM_JOLLA) $(SSH_LOGIN_JOLLA):
|
||||||
|
ssh $(SSH_LOGIN_JOLLA) "devel-su rpm -i $(RPM_JOLLA) --force"
|
70
rpm/harbour-sailtuner.spec
Normal file
70
rpm/harbour-sailtuner.spec
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
#
|
||||||
|
# Do NOT Edit the Auto-generated Part!
|
||||||
|
# Generated by: spectacle version 0.27
|
||||||
|
#
|
||||||
|
|
||||||
|
Name: harbour-sailtuner
|
||||||
|
|
||||||
|
# >> macros
|
||||||
|
# << macros
|
||||||
|
|
||||||
|
%{!?qtc_qmake:%define qtc_qmake %qmake}
|
||||||
|
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
|
||||||
|
%{!?qtc_make:%define qtc_make make}
|
||||||
|
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
||||||
|
Summary: Chromatic tuner
|
||||||
|
Version: 0.1
|
||||||
|
Release: 1
|
||||||
|
Group: Qt/Qt
|
||||||
|
License: GPL
|
||||||
|
URL: http://legolas.vefblog.net/
|
||||||
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
|
#Source100: harbour-saildbmeter.yaml
|
||||||
|
Requires: sailfishsilica-qt5 >= 0.10.9
|
||||||
|
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
|
||||||
|
BuildRequires: pkgconfig(Qt5Core)
|
||||||
|
BuildRequires: pkgconfig(Qt5Qml)
|
||||||
|
BuildRequires: pkgconfig(Qt5Quick)
|
||||||
|
BuildRequires: desktop-file-utils
|
||||||
|
|
||||||
|
%description
|
||||||
|
Instrumental multi-temperament chromatic tuner
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{name}-%{version}
|
||||||
|
|
||||||
|
# >> setup
|
||||||
|
# << setup
|
||||||
|
|
||||||
|
%build
|
||||||
|
# >> build pre
|
||||||
|
# << build pre
|
||||||
|
|
||||||
|
%qtc_qmake5
|
||||||
|
|
||||||
|
%qtc_make %{?_smp_mflags}
|
||||||
|
|
||||||
|
# >> build post
|
||||||
|
# << build post
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
# >> install pre
|
||||||
|
# << install pre
|
||||||
|
%qmake5_install
|
||||||
|
|
||||||
|
# >> install post
|
||||||
|
# << install post
|
||||||
|
|
||||||
|
desktop-file-install --delete-original \
|
||||||
|
--dir %{buildroot}%{_datadir}/applications \
|
||||||
|
%{buildroot}%{_datadir}/applications/*.desktop
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_bindir}
|
||||||
|
%{_datadir}/%{name}
|
||||||
|
%{_datadir}/applications/%{name}.desktop
|
||||||
|
%{_datadir}/icons/hicolor/86x86/apps/%{name}.png
|
||||||
|
# >> files
|
||||||
|
# << files
|
|
@ -46,6 +46,7 @@ Tuner::~Tuner()
|
||||||
|
|
||||||
void Tuner::Start()
|
void Tuner::Start()
|
||||||
{
|
{
|
||||||
|
cerr << __func__ << endl;
|
||||||
high_filter->Clear();
|
high_filter->Clear();
|
||||||
cross->Clear();
|
cross->Clear();
|
||||||
recorder->record();
|
recorder->record();
|
||||||
|
@ -55,6 +56,7 @@ void Tuner::Start()
|
||||||
|
|
||||||
void Tuner::Stop()
|
void Tuner::Stop()
|
||||||
{
|
{
|
||||||
|
cerr << __func__ << endl;
|
||||||
running = false;
|
running = false;
|
||||||
recorder->stop();
|
recorder->stop();
|
||||||
runningChanged();
|
runningChanged();
|
||||||
|
|
|
@ -9,7 +9,7 @@ using namespace std;
|
||||||
/// Maximum rest of division to be a multiple of
|
/// Maximum rest of division to be a multiple of
|
||||||
#define EPS_DIVISOR 0.1
|
#define EPS_DIVISOR 0.1
|
||||||
/// Consider it is a correct pattern to avoid multiples of
|
/// Consider it is a correct pattern to avoid multiples of
|
||||||
#define CORRECT_DEVIATION 0.05
|
#define CORRECT_DEVIATION 1
|
||||||
|
|
||||||
// local functions
|
// local functions
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ pair<double,double> FindPattern(const vector<double> &values, double pattern_min
|
||||||
best = res;
|
best = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cerr << " -> " << best.first << " " << best.second << endl;
|
||||||
if (best.second > CORRECT_DEVIATION) return pair<double,double>(0,0);
|
if (best.second > CORRECT_DEVIATION) return pair<double,double>(0,0);
|
||||||
cout << " -> " << best.first << " " << best.second << " ";
|
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
33
src/sailfish.cpp
Normal file
33
src/sailfish.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQuickView>
|
||||||
|
#include <QtQml>
|
||||||
|
#include <sailfishapp.h>
|
||||||
|
#include "Tuner.hpp"
|
||||||
|
|
||||||
|
class Main {
|
||||||
|
private:
|
||||||
|
QGuiApplication *app;
|
||||||
|
QQuickView *view;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Main(int &argc, char* argv[]) {
|
||||||
|
app = SailfishApp::application(argc, argv);
|
||||||
|
view = SailfishApp::createView();
|
||||||
|
view->setSource(QUrl("qrc:///qml/Sailfish.qml"));
|
||||||
|
QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));
|
||||||
|
}
|
||||||
|
Main() {}
|
||||||
|
~Main() {}
|
||||||
|
|
||||||
|
int Launch() {
|
||||||
|
view->show();
|
||||||
|
return app->exec();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECL_EXPORT int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
qmlRegisterType<Tuner>("harbour.sailtuner.tuner", 1, 0, "Tuner");
|
||||||
|
Main *appli = new Main(argc, argv);
|
||||||
|
return appli->Launch();
|
||||||
|
}
|
Loading…
Reference in a new issue