Display pause icon and several details
This commit is contained in:
parent
400e109aab
commit
30c93c96a7
8 changed files with 56 additions and 7 deletions
|
@ -28,4 +28,5 @@ HEADERS += \
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
qml/desktop.qrc \
|
qml/desktop.qrc \
|
||||||
data/temperaments.qrc
|
data/temperaments.qrc \
|
||||||
|
images/images.qrc
|
||||||
|
|
18
images/icon-m-pause.svg
Normal file
18
images/icon-m-pause.svg
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
|
||||||
|
<g id="icon-m-pause">
|
||||||
|
<rect id="icon-m-pause_1_" style="opacity:0;fill:#FFFFFF;" width="64" height="64"/>
|
||||||
|
<g>
|
||||||
|
<circle style="opacity:0.2;fill:#FFFFFF;" cx="32" cy="32" r="24"/>
|
||||||
|
<g>
|
||||||
|
<path style="fill:#FFFFFF;" d="M29.715,38.79c0,1.65-1.35,3-3,3h-0.63c-1.65,0-3-1.35-3-3V24.144c0-1.65,1.35-3,3-3h0.63
|
||||||
|
c1.65,0,3,1.35,3,3V38.79z"/>
|
||||||
|
<path style="fill:#FFFFFF;" d="M40.916,38.79c0,1.65-1.35,3-3,3h-0.631c-1.65,0-3-1.35-3-3V24.144c0-1.65,1.35-3,3-3h0.631
|
||||||
|
c1.65,0,3,1.35,3,3V38.79z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1,016 B |
5
images/images.qrc
Normal file
5
images/images.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource prefix="/images/">
|
||||||
|
<file>icon-m-pause.svg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -27,4 +27,6 @@ Item {
|
||||||
property int fontSizeMedium: 16
|
property int fontSizeMedium: 16
|
||||||
property int fontSizeLarge: 25
|
property int fontSizeLarge: 25
|
||||||
property int fontSizeExtraLarge: 40
|
property int fontSizeExtraLarge: 40
|
||||||
|
|
||||||
|
property string icon_pause: "qrc://images/icon-m-pause.svg"
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,6 @@ Item {
|
||||||
property color led_green: "green"
|
property color led_green: "green"
|
||||||
property color led_red: "red"
|
property color led_red: "red"
|
||||||
|
|
||||||
opacity: tuner.running ? 1 : 0.8
|
|
||||||
|
|
||||||
property bool dev_is_ok: Math.abs(tuner.deviation) <= deviation_ok
|
property bool dev_is_ok: Math.abs(tuner.deviation) <= deviation_ok
|
||||||
|
|
||||||
Led {
|
Led {
|
||||||
|
@ -155,6 +153,7 @@ Item {
|
||||||
|
|
||||||
// frequency and temperament
|
// frequency and temperament
|
||||||
Column {
|
Column {
|
||||||
|
id: freq_temp
|
||||||
x: is_portrait ? theme.paddingLarge : meter.x + meter.width / 6
|
x: is_portrait ? theme.paddingLarge : meter.x + meter.width / 6
|
||||||
y: is_portrait ? theme.paddingLarge : meter.y + meter.height - theme.fontSizeSmall * 4 - theme.paddingLarge
|
y: is_portrait ? theme.paddingLarge : meter.y + meter.height - theme.fontSizeSmall * 4 - theme.paddingLarge
|
||||||
width: parent.width * 0.4
|
width: parent.width * 0.4
|
||||||
|
@ -163,10 +162,23 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
text: tuner.la + " hz"
|
text: tuner.la + " hz"
|
||||||
font.pixelSize: theme.fontSizeSmall
|
font.pixelSize: theme.fontSizeSmall
|
||||||
|
color: theme.secondaryColor
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: tuner.temperament_list[tuner.temperament_idx]
|
text: tuner.temperament_list[tuner.temperament_idx]
|
||||||
font.pixelSize: theme.fontSizeSmall
|
font.pixelSize: theme.fontSizeSmall
|
||||||
|
color: theme.secondaryColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// icon for pause status
|
||||||
|
Image {
|
||||||
|
visible: !tuner.running
|
||||||
|
|
||||||
|
x: is_portrait ? parent.width - freq_temp.x - width : parent.width - freq_temp.x - width * 2
|
||||||
|
y: freq_temp.y
|
||||||
|
width: theme.iconSizeMedium
|
||||||
|
height: width
|
||||||
|
source: theme.icon_pause ? theme.icon_pause : "image://theme/icon-m-pause?" + theme.secondaryColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,13 +58,19 @@ PitchDetection::PitchDetection()
|
||||||
scale = new Scale();
|
scale = new Scale();
|
||||||
temperaments = new Temperaments(":/data");
|
temperaments = new Temperaments(":/data");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* done by worker before first frame,
|
||||||
|
* and protected in scale: construct equal if nothing
|
||||||
|
* on first analyse
|
||||||
|
*/
|
||||||
|
/*
|
||||||
if (temperaments->SetTemperament(0)) {
|
if (temperaments->SetTemperament(0)) {
|
||||||
scale->SetNotesFrequencies(temperaments->NotesFrequencies());
|
scale->SetNotesFrequencies(temperaments->NotesFrequencies());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scale->ConstructEqualTemperament();
|
scale->ConstructEqualTemperament();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +220,7 @@ void PitchDetection::analyse_file(const char *filename)
|
||||||
|
|
||||||
const int nb_frame = 1024;
|
const int nb_frame = 1024;
|
||||||
PitchDetection *pitch = new PitchDetection();
|
PitchDetection *pitch = new PitchDetection();
|
||||||
|
pitch->SetTemperament(0);
|
||||||
int16_t buffer[nb_frame];
|
int16_t buffer[nb_frame];
|
||||||
PitchResult result;
|
PitchResult result;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ TunerWorker::TunerWorker() :
|
||||||
running(false),
|
running(false),
|
||||||
quit(false),
|
quit(false),
|
||||||
la_to_update(0),
|
la_to_update(0),
|
||||||
temperament_to_update(-1)
|
temperament_to_update(0) // update the first time in every cases
|
||||||
{
|
{
|
||||||
//qRegisterMetaType<PitchDetection::PitchResult>("PitchDetection::PitchResult");
|
//qRegisterMetaType<PitchDetection::PitchResult>("PitchDetection::PitchResult");
|
||||||
}
|
}
|
||||||
|
@ -183,11 +183,15 @@ void TunerWorker::Entry()
|
||||||
pa_simple_flush(p_simple, NULL);
|
pa_simple_flush(p_simple, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if srteam was stopped, reset analyse
|
// if stream was stopped, reset analyse
|
||||||
if (new_stream) {
|
if (new_stream) {
|
||||||
pitchDetection->Reset();
|
pitchDetection->Reset();
|
||||||
|
blank_prevent(true);
|
||||||
nb_sample_running = 0;
|
nb_sample_running = 0;
|
||||||
new_stream = false;
|
new_stream = false;
|
||||||
|
// send a not-found result on restart
|
||||||
|
result.found = false;
|
||||||
|
emit resultUpdated(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get audio data
|
// get audio data
|
||||||
|
|
|
@ -137,5 +137,5 @@ void Scale::SetLa(double la)
|
||||||
{
|
{
|
||||||
assert(la > 0);
|
assert(la > 0);
|
||||||
actualLa = la;
|
actualLa = la;
|
||||||
updateScale();
|
if (freq_setted) updateScale();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue