Skip to content

Commit

Permalink
Guitar harmonics base class
Browse files Browse the repository at this point in the history
  • Loading branch information
laturetab committed May 21, 2021
1 parent 1bad027 commit 59c9979
Show file tree
Hide file tree
Showing 5 changed files with 673 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/libmscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ set(MODULE_SRC
pedal.h
pitch.cpp
pitch.h
pitchadjuster.cpp
pitchadjuster.h
pitchspelling.cpp
pitchspelling.h
pitchvalue.h
Expand Down
6 changes: 5 additions & 1 deletion src/libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ Note::Note(const Note& n, bool link)
_accidental = 0;
_cachedNoteheadSym = n._cachedNoteheadSym;
_cachedSymNull = n._cachedSymNull;
_pitchAdjuster = n._pitchAdjuster;

if (n._accidental) {
add(new Accidental(*(n._accidental)));
Expand Down Expand Up @@ -1467,6 +1468,7 @@ void Note::write(XmlWriter& xml) const
Pid::GHOST, Pid::HEAD_TYPE, Pid::VELO_TYPE, Pid::FIXED, Pid::FIXED_LINE }) {
writeProperty(xml, id);
}
_pitchAdjuster.write(xml);

for (Spanner* e : _spannerFor) {
e->writeSpannerStart(xml, this, track());
Expand Down Expand Up @@ -1643,6 +1645,8 @@ bool Note::readProperties(XmlReader& e)
NoteDot* dot = new NoteDot(score());
dot->read(e);
add(dot);
} else if (tag == "pitchAdjust") {
_pitchAdjuster.read(e);
} else if (tag == "Events") {
_playEvents.clear(); // remove default event
while (e.readNextStartElement()) {
Expand Down Expand Up @@ -2581,7 +2585,7 @@ int Note::ppitch() const
}
}

return _pitch + ottaveCapoFret();
return _pitch + ottaveCapoFret() + _pitchAdjuster.getAlter();
}

//---------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/libmscore/note.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "shape.h"
#include "key.h"
#include "sym.h"
#include "pitchadjuster.h"

namespace Ms {
class Tie;
Expand Down Expand Up @@ -310,6 +311,8 @@ class Note final : public Element

QString _fretString;

PitchAdjuster _pitchAdjuster; // guitar harmonics

void startDrag(EditData&) override;
QRectF drag(EditData& ed) override;
void endDrag(EditData&) override;
Expand Down
Loading

0 comments on commit 59c9979

Please sign in to comment.