-
Notifications
You must be signed in to change notification settings - Fork 7
/
FretboardComponent.qml
837 lines (680 loc) · 26.9 KB
/
FretboardComponent.qml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
import QtQuick 2.6
import QtQuick.Controls 2.1
import QtQuick.Window 2.2
import MuseScore 3.0
Item {
id: fretplugin
// Reference to the plugin, gives access to the main MuseScore plugin API.
property var mscore: null
implicitWidth: fretView.implicitWidth
implicitHeight: fretView.implicitHeight
QtObject {
id: compatibility
readonly property bool useApi334: mscore ? (mscore.mscoreVersion > 30303) : false // Cursor.addNote(pitch, addToChord), Cursor.prev()
readonly property bool useApi350: mscore ? (mscore.mscoreVersion >= 30500) : false // instrument data, range selection
readonly property bool useApi4: mscore ? (mscore.mscoreVersion >= 40000) : false
readonly property bool useApi44: mscore ? (mscore.mscoreVersion >= 40400) : false
}
readonly property bool darkMode: Window.window ? Window.window.color.hsvValue < 0.5 : false
QtObject {
id: style
readonly property color textColor: fretplugin.darkMode ? "#EFF0F1" : "#333333"
readonly property color backgroundColor: fretplugin.darkMode ? "#2C2C2C" : "#e3e3e3"
}
property var score: null
property var cursor: null
property int cursorLastTick: -1
property var instrument: null
property var tuning: [64, 59, 55, 50, 45, 40, 0, 0, 0, 0] // default is 6-string classical guitar tuning
function getPitch(string, fret) {
return tuning[string] + fret;
}
readonly property var tpcNoteNames: [
"F♭♭", "C♭♭", "G♭♭", "D♭♭", "A♭♭", "E♭♭", "B♭♭",
"F♭", "C♭", "G♭", "D♭", "A♭", "E♭", "B♭",
"F", "C", "G", "D", "A", "E", "B",
"F♯", "C♯", "G♯", "D♯", "A♯", "E♯", "B♯",
"F♯♯", "C♯♯", "G♯♯", "D♯♯", "A♯♯", "E♯♯", "B♯♯"
]
function getNoteName(tpc) {
var name = tpcNoteNames[tpc + 1];
if (compatibility.useApi4) {
return qsTranslate("action", name[0]) + name.substr(1);
} else {
return qsTranslate("InspectorAmbitus", name);
}
}
function guessNoteName(string, fret) {
var pitch = getPitch(string, fret);
var key = cursor.keySignature;
var tpc = (pitch * 7 + 26 - (11 + key)) % 12 + (11 + key);
return getNoteName(tpc);
}
function findSegment(e) {
while (e && e.type != Element.SEGMENT)
e = e.parent;
return e;
}
function findSelectedChord() {
if (!score)
return null;
// Prevent the previous chord being considered a current position when
// moving to the next measure in the second (or greater) voice.
if (!cursor.element)
return null;
var selectedElements = score.selection.elements;
for (var i = 0; i < selectedElements.length; ++i) {
var e = selectedElements[i];
if (e.type == Element.NOTE) {
var chord = e.parent;
// HACK
// removeElement(chord) may leave the chord selected,
// so ensure this chord is really bound to a segment
// or another chord as a grace note.
var seg = findSegment(chord);
var realChord = seg.elementAt(chord.track);
if (!realChord || realChord.type != Element.CHORD)
return null;
if (chord.is(realChord))
return chord;
var grace = realChord.graceNotes;
for (var i = 0; i < grace.length; ++i) {
if (grace[i].is(chord))
return chord;
}
return null;
}
}
}
function updateSelectedChord() {
var chord = findSelectedChord();
if (chord) {
setDisplayedNotes(chord.notes);
} else {
setDisplayedNotes([]);
}
}
function updateSelection() {
if (score.selection.isRange) { // MuseScore 3.5+
var selectedElements = score.selection.elements;
var notes = [];
for (var i = 0; i < selectedElements.length; ++i) {
var e = selectedElements[i];
if (e.type == Element.NOTE) {
notes.push(e);
}
}
setDisplayedNotes(notes);
} else {
updateSelectedChord();
}
updateInstrumentData();
cursorLastTick = cursor.tick;
}
function updateInstrumentData() {
if (!compatibility.useApi350)
return;
var e = score.selection.elements[0];
var seg = findSegment(e);
if (!e || !seg)
return;
var newPart = e.staff.part;
if (!newPart || !newPart.hasTabStaff)
return;
var newInstrument = newPart.instrumentAtTick(seg.tick);
if (!newInstrument || newInstrument.is(fretplugin.instrument))
return;
fretplugin.instrument = newInstrument;
var stringData = newInstrument.stringData;
if (stringData.frets <= 0)
return;
var strings = stringData.strings;
var newTuning = [];
for (var i = 0; i < strings.length; ++i) {
newTuning.push(strings[i].pitch);
}
// The plugin uses string data in reverse order.
newTuning.reverse();
if (e.type == Element.NOTE) {
var transposition = getTransposition(newTuning, e);
if (transposition) {
applyTransposition(newTuning, transposition);
}
}
if (newTuning.length > 0) {
fretplugin.tuning = newTuning;
stringsComboBox.currentIndex = newTuning.length;
fretsComboBox.currentIndex = stringData.frets;
}
console.log("new tuning:", newTuning);
}
function getFretIndex(string, fret) {
return tuning.length * fret + string;
}
function setDisplayedNotes(notes) {
var noteInfo = {};
for (var i = 0; i < notes.length; ++i) {
var n = notes[i];
if (n.string > -1 && n.fret > -1) {
var idx = getFretIndex(n.string, n.fret);
noteInfo[idx] = getNoteName(n.tpc);
}
}
fretView.selectedNotes = noteInfo;
}
function updateCurrentScore() {
if (mscore.curScore && !mscore.curScore.is(score)) {
score = mscore.curScore;
cursor = score.newCursor();
if (typeof cursor.inputStateMode !== "undefined") {
// Possible future versions API expansion
cursor.inputStateMode = Cursor.INPUT_STATE_SYNC_WITH_SCORE;
} else {
// Obtaining a cursor while in note input mode can lead to crashes, prevent this
mscore.cmd("escape");
cursor = score.newCursor();
}
} else if (score && !mscore.curScore) {
score = null;
cursor = null;
}
}
function updateState(selectionChanged) {
updateCurrentScore();
if (selectionChanged || cursor.tick != cursorLastTick)
updateSelection();
}
function onRun() {
updateCurrentScore();
updateSelection();
}
function determineTuning(chord) {
if (!chord)
return;
if (compatibility.useApi350) {
// We use string data directly with this API, so it should be
// sufficient just to figure out instrument transposition.
var note = chord.notes[0];
var step = 12;
var transposition = getTransposition(tuning, note);
if (transposition) {
applyTransposition(tuning, transposition);
} else {
for (var pitch = 127; pitch > 0; pitch -= step) {
var testNote = mscore.newElement(Element.NOTE);
testNote.string = string;
testNote.pitch = pitch;
mscore.curScore.startCmd();
chord.add(testNote);
mscore.curScore.endCmd();
transposition = getTransposition(tuning, testNote);
mscore.cmd("undo");
if (transposition) {
applyTransposition(tuning, transposition);
break;
}
}
}
console.log("guessed tuning (transposition):", tuning);
return;
}
for (var i = 0; i < tuning.length; ++i)
tuning[i] = 0;
for (var i = 0; i < chord.notes.length; ++i) {
var existingNote = chord.notes[i];
tuning[existingNote.string] = existingNote.pitch - existingNote.fret;
}
var string = 0;
var step = 12;
for (var pitch = 127; pitch > 0; pitch -= step) {
var testNote = mscore.newElement(Element.NOTE);
testNote.string = string;
testNote.pitch = pitch;
mscore.curScore.startCmd();
chord.add(testNote);
mscore.curScore.endCmd();
if (testNote.string > -1 && testNote.fret > -1) {
const testNoteString = testNote.string;
if (testNote.fret > 0) {
tuning[testNoteString] = pitch - testNote.fret;
string = testNoteString + 1;
// switch to a smaller step if haven't done it yet
step = 4;
} else if (!tuning[testNoteString])
tuning[testNoteString] = pitch - testNote.fret;
}
mscore.cmd("undo");
}
// TODO: make it toggleable? Or make it done on each selection change (then record tunings for tracks?)
var nstrings = 0;
for (var i = 0; i < tuning.length; ++i) {
if (tuning[i])
nstrings = i + 1;
}
stringsComboBox.currentIndex = nstrings;
console.log("guessed tuning:", tuning);
}
function getTransposition(tuning, note) {
// Out-of-range notes seem to have fret 0, so we cannot
// rely on fret-0 notes to determine transposition.
if (note.string > -1 && note.fret > 0)
return note.pitch - note.fret - tuning[note.string];
return 0;
}
function applyTransposition(tuning, transposition) {
for (var i = 0; i < tuning.length; ++i) {
if (tuning[i]) {
tuning[i] += transposition;
}
}
}
function addNoteWithCursor(string, fret, addToChord) {
var oldNote = mscore.curScore.selection.elements[0];
if (oldNote && oldNote.type != Element.NOTE)
oldNote = null;
if (compatibility.useApi334)
cursor.addNote(fretplugin.getPitch(string, fret), addToChord);
else
cursor.addNote(fretplugin.getPitch(string, fret));
var note = mscore.curScore.selection.elements[0]; // TODO: is there any better way to get the last added note?
if (note && note.type != Element.NOTE)
note = null;
if (!note || note.is(oldNote)) {
// no note has been added
if (addToChord) {
// fall back to adding a new note (maybe we are in a different voice?)
return addNoteWithCursor(string, fret, false);
}
return null;
}
note.string = string;
note.fret = fret;
note.pitch = fretplugin.getPitch(string, fret);
if (typeof cursor.stringNumber !== "undefined") {
// Possible future versions API expansion
cursor.stringNumber = note.string;
} else if (oldNote && oldNote.voice != note.voice) {
// It is important to have a cursor on a correct string when
// switching voices to have a correct chord selected. Try to
// rewind tablature cursor to the correct string.
for (var i = 0; i < fretView.strings; ++i)
mscore.cmd("string-above");
for (var i = 0; i < note.string; ++i)
mscore.cmd("string-below");
}
if (compatibility.useApi334) {
if (!cursor.segment.is(findSegment(note))) {
cursor.track = note.track;
cursor.prev();
}
}
return note;
}
function doAddNote(string, fret) {
score.startCmd();
var chord = findSelectedChord();
var note = null;
if (chord) {
var chordNotes = chord.notes;
for (var i = 0; i < chordNotes.length; ++i) {
var chordNote = chordNotes[i];
if (chordNote.string == string) {
note = chordNote;
break;
}
}
if (note && note.string == string && note.fret == fret) {
mscore.removeElement(note);
// TODO: removing last note leaves the removed chord selected...
// see HACK in findSelectedChord() to work around this
} else {
// To avoid computing TPC manually remove the old note
// and insert the new one: TPC will be computed for it
// automatically
// TODO: or still compute TPC to preserve other properties?...
var oldNote = note;
if (compatibility.useApi334) {
note = addNoteWithCursor(string, fret, /* addToChord */ true);
} else {
if (oldNote)
note = note.clone();
else
note = mscore.newElement(Element.NOTE);
note.string = string;
note.fret = fret;
note.pitch = fretplugin.getPitch(string, fret);
chord.add(note);
}
// removing the old note after adding the new one
// since otherwise we may happen to delete the last
// note of a chord which is forbidden.
if (oldNote) {
chord.remove(oldNote);
}
}
} else {
note = addNoteWithCursor(string, fret, /* addToChord */ false);
}
score.endCmd();
if (compatibility.useApi4) {
// Note playback hack.
var moveAndPlayCmd = "";
if (cursor.tick > 0) {
cursor.prev();
moveAndPlayCmd = "next-chord";
} else {
cursor.next();
moveAndPlayCmd = "prev-chord";
}
var cursorElement = cursor.element;
var selectedElement = score.selection.elements[0];
if (cursorElement && selectedElement) {
var cursorSegment = findSegment(cursor.element);
var selectedSegment = findSegment(selectedElement);
// Seems to be the case if changing a chord not in note input mode.
if (!cursorSegment.is(selectedElement)) {
var newSelectionElement = (cursorElement.type == Element.CHORD)
? cursorElement.notes[0]
: cursorElement;
score.selection.select(newSelectionElement);
}
}
cursor.track = note.track;
cmd(moveAndPlayCmd);
}
return note;
}
function addNote(string, fret) {
if (!score.is(mscore.curScore))
return;
if (score.selection.isRange) // MuseScore 3.5+
return;
var note = doAddNote(string, fret);
if (note && (note.string != string || note.fret != fret)) {
console.log("couldn't add a note, try changing tuning...")
var chord = note.parent;
determineTuning(chord);
mscore.cmd("undo");
// try with the adjusted tuning
note = doAddNote(string, fret);
if (note && (note.string != string || note.fret != fret)) {
console.log("still couldn't add a note, revert")
mscore.cmd("undo");
}
}
// our changes may have not triggered selection change
updateSelection();
}
Component {
id: dotComponent
Rectangle {
height: 16
width: 16
radius: 16
color: "black"
}
}
Component {
id: markerComponent
Rectangle {
id: marker
property string text: ""
height: 18
width: 18
radius: 18
color: "red"
Text {
anchors.centerIn: parent
font.pixelSize: 14
fontSizeMode: Text.Fit
text: marker.text
}
}
}
Column {
id: fretSettings
width: Math.max(stringsComboBox.implicitWidth, fretsComboBox.implicitWidth)
Row {
anchors.horizontalCenter: parent.horizontalCenter
ToolButton {
onClicked: mscore.cmd("prev-chord")
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: compatibility.useApi4
? qsTranslate("action", "Previous chord / Shift text left")
: qsTranslate("action", "Previous Chord")
contentItem: Text {
text: "<"
color: style.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
ToolButton {
onClicked: mscore.cmd("next-chord")
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: compatibility.useApi4
? qsTranslate("action", "Next chord / Shift text right")
: qsTranslate("action", "Next Chord")
contentItem: Text {
text: ">"
color: style.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
ToolSeparator {
width: parent.width
orientation: Qt.Horizontal
}
ComboBox {
id: stringsComboBox
width: parent.width
currentIndex: 6
readonly property string baseText: compatibility.useApi4
? qsTranslate("EditStaffBase", "Number of strings:")
: qsTranslate("InspectorFretDiagram", "Strings:")
displayText: baseText + " " + currentText
model: 11
contentItem: Text {
leftPadding: !stringsComboBox.mirrored ? 12 : 1
rightPadding: stringsComboBox.mirrored ? 12 : 1
text: parent.displayText
color: style.textColor
verticalAlignment: Text.AlignVCenter
}
Component.onCompleted: {
if (compatibility.useApi4) {
background.text = "";
} else {
background.color = Qt.binding(function() { return style.backgroundColor; });
}
}
}
ComboBox {
id: fretsComboBox
width: parent.width
currentIndex: 19
readonly property string baseText: compatibility.useApi4
? qsTranslate("EditStringDataBase", "Number of frets:")
: qsTranslate("InspectorFretDiagram", "Frets:")
displayText: baseText + " " + currentText
model: 51
contentItem: Text {
leftPadding: !fretsComboBox.mirrored ? 12 : 1
rightPadding: fretsComboBox.mirrored ? 12 : 1
text: parent.displayText
color: style.textColor
verticalAlignment: Text.AlignVCenter
}
Component.onCompleted: {
if (compatibility.useApi4) {
background.text = "";
} else {
background.color = Qt.binding(function() { return style.backgroundColor; });
}
}
}
Loader {
id: leftHandedCheckBox
width: parent.width
property bool checked: item.checked
source: compatibility.useApi4 ? (compatibility.useApi44 ? "MU44CheckBox.qml" : "MU40CheckBox.qml") : undefined
sourceComponent: compatibility.useApi4 ? undefined : mu3checkBoxComponent
// Show full text in a tooltip if it doesn't fit into width.
ToolTip.visible: (item.width < item.implicitWidth) && item.hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: item.text
Component {
id: mu3checkBoxComponent
CheckBox {
Component.onCompleted: contentItem.color = Qt.binding(function() { return style.textColor; })
}
}
onLoaded: {
item.checked = false;
item.text = qsTranslate("action", "Flip direction");
}
}
}
Component {
id: fretNormalComponent
Rectangle {
property bool hasTopHalfDot: false
property bool hasBottomHalfDot: false
color: "brown"
clip: true
Rectangle {
width: 1
anchors {
left: fretView.leftHanded ? undefined : (parent ? parent.left : undefined)
right: fretView.leftHanded ? (parent ? parent.right : undefined) : undefined
top: parent ? parent.top : undefined
bottom: parent ? parent.bottom : undefined
}
color: "white"
}
Rectangle {
height: 2
anchors {
left: parent ? parent.left : undefined
right: parent ? parent.right : undefined
verticalCenter: parent ? parent.verticalCenter : undefined
}
color: "black"
}
Loader {
sourceComponent: parent.hasTopHalfDot ? dotComponent : null
anchors {
horizontalCenter: parent ? parent.horizontalCenter : undefined
verticalCenter: parent ? parent.top : undefined
}
}
Loader {
sourceComponent: parent.hasBottomHalfDot ? dotComponent : null
anchors {
horizontalCenter: parent ? parent.horizontalCenter : undefined
verticalCenter: parent ? parent.bottom : undefined
}
}
}
}
Component {
id: fretZeroComponent
Item {
property bool hasTopHalfDot: false
property bool hasBottomHalfDot: false
Rectangle {
id: fretZero
width: parent.width / 2
anchors {
right: parent ? parent.right : undefined
top: parent ? parent.top : undefined
bottom: parent ? parent.bottom : undefined
}
color: "darkgrey"
}
Rectangle {
height: 2
anchors {
left: parent ? parent.left : undefined
right: parent ? parent.right : undefined
verticalCenter: parent ? parent.verticalCenter : undefined
}
color: "black"
}
}
}
Grid {
id: fretView
anchors {
left: fretSettings.right
leftMargin: 8
}
property var selectedNotes: Object()
property int frets: +fretsComboBox.currentText + 1
property int strings: +stringsComboBox.currentText
property bool leftHanded: leftHandedCheckBox.checked
onLeftHandedChanged: {
// Force rebuilding the view. Otherwise the leftmost fret doesn't display well.
visible = false;
visible = true;
}
columns: frets
rows: strings
property var dots: [3, 5, 7, 9, 15, 17, 19, 21]
property var doubleDots: [12, 24]
function hasDot(string, fret) {
if (string == 0)
return false;
var mid = Math.floor(strings / 2);
if (string == mid - 1 || string == mid + 1)
return doubleDots.indexOf(fret) != -1;
if (string == mid)
return dots.indexOf(fret) != -1;
return false;
}
Repeater {
model: fretView.visible ? (fretView.frets * fretView.strings) : 0
delegate: ItemDelegate {
id: fretRect
implicitWidth: 70 * Math.pow(0.96, fret)
implicitHeight: 25
property bool marked: !!fretView.selectedNotes[getFretIndex(str, fret)]
property int str: Math.floor(model.index / fretView.frets)
property int fret: fretView.leftHanded ? (fretView.frets - 1 - (model.index % fretView.frets)) : (model.index % fretView.frets)
onClicked: fretplugin.addNote(str, fret)
background: Loader {
id: loader
sourceComponent: fret === 0 ? fretZeroComponent : fretNormalComponent
Binding { target: loader.item; property: "hasTopHalfDot"; value: fretView.hasDot(fretRect.str, fretRect.fret) }
Binding { target: loader.item; property: "hasBottomHalfDot"; value: fretRect.str + 1 < fretView.strings && fretView.hasDot(fretRect.str + 1, fretRect.fret) }
}
Loader {
id: markerLoader
sourceComponent: markerComponent
anchors.centerIn: parent
visible: fretRect.marked || fretRect.hovered
opacity: fretRect.marked ? 1.0 : 0.67
Component.onCompleted: {
if (visible)
fretRect.setMarkerText()
}
onVisibleChanged: {
if (visible && !fretRect.marked)
fretRect.setMarkerText()
}
}
onMarkedChanged: setMarkerText()
function setMarkerText() {
if (marked)
markerLoader.item.text = Qt.binding(function() { return fretView.selectedNotes[getFretIndex(str, fret)] || ""; });
else
markerLoader.item.text = fretplugin.guessNoteName(fretRect.str, fretRect.fret);
}
}
}
}
}