1import QtQuick 2.0
2import MuseScore 3.0
3
4MuseScore {
5      menuPath: "Plugins.p1"
6      onRun: {
7            openLog("p1.log");
8            logn("test script p1: read score elements")
9
10            var cursor      = curScore.newCursor();
11            cursor.voice    = 0;
12            cursor.staffIdx = 0;
13            cursor.filter   = -1;
14            cursor.rewind(0);
15
16            while (cursor.segment) {
17                  var e = cursor.element;
18                  if (e) {
19                        log2("found:", e.name + " (" + e.type + ") at " + cursor.segment.tick);
20                        if (e.type == Element.CHORD) {
21//                             log2("  durationType:",  e.durationType); // TODO: some wrapper/string conversion?
22                            log2("  beamMode:",      e.beamMode);
23                            log2("  small:",         e.small);
24                            log2("  stemDirection:", e.stemDirection);
25
26                            log2("  duration:", e.duration.str);
27//                            log2("    numerator:",   e.duration.numerator);
28//                            log2("    denominator:", e.duration.denominator);
29//                            log2("    ticks:",       e.duration.ticks);
30//                            var notes = e.notes;
31//                            for (var i = 0; i < notes.length; i++) {
32//                                var note = notes[i];
33//                                log2("  ", note._name());
34//                                log2("    subchannel:", note.subchannel);
35//                                log2("    line:", note.line);
36//                                log2("    fret:", note.fret);
37//                                log2("    string:", note.string);
38//                                log2("    tpc:", note.tpc);
39//                                log2("    tpc1:", note.tpc1);
40//                                log2("    tpc2:", note.tpc2);
41//                                log2("    pitch:", note.pitch);
42//                                log2("    ppitch:", note.ppitch);
43//                                log2("    ghost:", note.ghost);
44//                                log2("    hidden:", note.hidden);
45//                                log2("    mirror:", note.mirror);
46//                                log2("    small:", note.small);
47//                                log2("    play:", note.play);
48//                                log2("    tuning:", note.tuning);
49//                                log2("    veloType:", note.veloType);
50//                                log2("    veloOffset:", note.veloOffset);
51//                                log2("    userMirror:", note.userMirror);
52//                                log2("    userDotPosition:", note.userDotPosition);
53//                                log2("    headGroup:", note.headGroup);
54//                                log2("    headType:", note.headType);
55//                                log2("    accidentalType:", note.accidentalType);
56//                                log2("    dotsCount:", note.dotsCount);
57//                                if (note.accidental) {
58//                                      var acc = note.accidental;
59//                                      log2("      ", acc._name());
60//                                      log2("        hasBracket:", acc.hasBracket);
61//                                      log2("        small:", acc.small);
62//                                      log2("        accType:", acc.accType);
63//                                      log2("        role:", acc.role);
64//                                      }
65//                                }
66                            }
67                        if (e.type == Element.REST) {
68//                            logn("  duration:");
69//                            log2("    numerator:",   e.duration.numerator);
70//                            log2("    denominator:", e.duration.denominator);
71//                            log2("    ticks:",       e.duration.ticks);
72//                            log2("  beamMode:", e.beamMode);
73//                            log2("  small:", e.small);
74                            }
75                        }
76                  cursor.next();
77                  }
78            closeLog();
79            Qt.quit()
80            }
81      }
82