2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
2012-11-19 10:08:15 +01:00
|
|
|
// Copyright (C) 2002-2012 Werner Schweer
|
2012-05-26 14:26:10 +02:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __NOTE_H__
|
|
|
|
#define __NOTE_H__
|
|
|
|
|
|
|
|
/**
|
|
|
|
\file
|
2012-07-13 14:36:26 +02:00
|
|
|
Definition of classes Note and NoteHead.
|
2012-05-26 14:26:10 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "element.h"
|
|
|
|
#include "symbol.h"
|
2012-11-19 10:08:15 +01:00
|
|
|
#include "noteevent.h"
|
2013-10-24 12:09:00 +02:00
|
|
|
#include "pitchspelling.h"
|
2016-01-04 14:48:58 +01:00
|
|
|
#include "shape.h"
|
2016-07-31 15:23:11 +02:00
|
|
|
#include "tremolo.h"
|
2016-10-22 20:16:42 +02:00
|
|
|
#include "key.h"
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
class QPainter;
|
|
|
|
|
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class Tie;
|
|
|
|
class Chord;
|
|
|
|
class NoteEvent;
|
|
|
|
class Text;
|
|
|
|
class Score;
|
|
|
|
class Sym;
|
|
|
|
class MuseScoreView;
|
|
|
|
class Bend;
|
|
|
|
class AccidentalState;
|
|
|
|
class Accidental;
|
|
|
|
class NoteDot;
|
2012-09-12 16:19:03 +02:00
|
|
|
class Spanner;
|
2014-04-28 18:38:50 +02:00
|
|
|
class StaffType;
|
2014-06-24 17:16:22 +02:00
|
|
|
enum class SymId;
|
2015-04-02 10:33:53 +02:00
|
|
|
enum class AccidentalType : char;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-05-31 19:48:28 +02:00
|
|
|
static const int MAX_DOTS = 4;
|
2013-11-25 15:02:23 +01:00
|
|
|
|
2016-09-22 16:07:47 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ NoteHead
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class NoteHead : public Symbol {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2015-03-03 18:59:46 +01:00
|
|
|
Q_ENUMS(Group)
|
|
|
|
Q_ENUMS(Type)
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
2014-06-25 21:18:26 +02:00
|
|
|
enum class Group : signed char {
|
|
|
|
HEAD_NORMAL = 0,
|
|
|
|
HEAD_CROSS,
|
2016-10-22 20:16:42 +02:00
|
|
|
HEAD_PLUS,
|
|
|
|
HEAD_XCIRCLE,
|
|
|
|
HEAD_WITHX,
|
|
|
|
HEAD_TRIANGLE_UP,
|
|
|
|
HEAD_TRIANGLE_DOWN,
|
|
|
|
HEAD_SLASHED1,
|
|
|
|
HEAD_SLASHED2,
|
2014-06-25 21:18:26 +02:00
|
|
|
HEAD_DIAMOND,
|
2016-10-22 20:16:42 +02:00
|
|
|
HEAD_DIAMOND_OLD,
|
|
|
|
HEAD_CIRCLED,
|
|
|
|
HEAD_CIRCLED_LARGE,
|
|
|
|
HEAD_LARGE_ARROW,
|
|
|
|
HEAD_BREVIS_ALT,
|
|
|
|
|
2014-06-25 21:18:26 +02:00
|
|
|
HEAD_SLASH,
|
2016-10-22 20:16:42 +02:00
|
|
|
|
|
|
|
HEAD_SOL,
|
|
|
|
HEAD_LA,
|
|
|
|
HEAD_FA,
|
|
|
|
HEAD_MI,
|
2014-06-25 21:18:26 +02:00
|
|
|
HEAD_DO,
|
|
|
|
HEAD_RE,
|
|
|
|
HEAD_TI,
|
2016-10-22 20:16:42 +02:00
|
|
|
// not exposed from here
|
|
|
|
HEAD_DO_WALKER,
|
|
|
|
HEAD_RE_WALKER,
|
|
|
|
HEAD_TI_WALKER,
|
|
|
|
HEAD_DO_FUNK,
|
|
|
|
HEAD_RE_FUNK,
|
|
|
|
HEAD_TI_FUNK,
|
|
|
|
|
|
|
|
HEAD_DO_NAME,
|
|
|
|
HEAD_RE_NAME,
|
|
|
|
HEAD_MI_NAME,
|
|
|
|
HEAD_FA_NAME,
|
|
|
|
HEAD_SOL_NAME,
|
|
|
|
HEAD_LA_NAME,
|
|
|
|
HEAD_TI_NAME,
|
|
|
|
HEAD_SI_NAME,
|
|
|
|
|
|
|
|
HEAD_A_SHARP,
|
|
|
|
HEAD_A,
|
|
|
|
HEAD_A_FLAT,
|
|
|
|
HEAD_B_SHARP,
|
|
|
|
HEAD_B,
|
|
|
|
HEAD_B_FLAT,
|
|
|
|
HEAD_C_SHARP,
|
|
|
|
HEAD_C,
|
|
|
|
HEAD_C_FLAT,
|
|
|
|
HEAD_D_SHARP,
|
|
|
|
HEAD_D,
|
|
|
|
HEAD_D_FLAT,
|
|
|
|
HEAD_E_SHARP,
|
|
|
|
HEAD_E,
|
|
|
|
HEAD_E_FLAT,
|
|
|
|
HEAD_F_SHARP,
|
|
|
|
HEAD_F,
|
|
|
|
HEAD_F_FLAT,
|
|
|
|
HEAD_G_SHARP,
|
|
|
|
HEAD_G,
|
|
|
|
HEAD_G_FLAT,
|
|
|
|
HEAD_H,
|
|
|
|
HEAD_H_SHARP,
|
|
|
|
|
2014-06-25 21:18:26 +02:00
|
|
|
HEAD_GROUPS,
|
|
|
|
HEAD_INVALID = -1
|
|
|
|
};
|
2014-06-25 22:01:26 +02:00
|
|
|
enum class Type : signed char {
|
|
|
|
HEAD_AUTO = -1,
|
|
|
|
HEAD_WHOLE = 0,
|
|
|
|
HEAD_HALF = 1,
|
|
|
|
HEAD_QUARTER = 2,
|
|
|
|
HEAD_BREVIS = 3,
|
|
|
|
HEAD_TYPES
|
|
|
|
};
|
2014-06-25 21:18:26 +02:00
|
|
|
|
2015-03-03 18:59:46 +01:00
|
|
|
NoteHead(Score* s = 0) : Symbol(s) {}
|
2014-06-27 13:41:49 +02:00
|
|
|
NoteHead &operator=(const NoteHead&) = delete;
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual NoteHead* clone() const override { return new NoteHead(*this); }
|
|
|
|
virtual Element::Type type() const override { return Element::Type::NOTEHEAD; }
|
2013-11-25 15:02:23 +01:00
|
|
|
|
2014-06-25 21:18:26 +02:00
|
|
|
Group headGroup() const;
|
2014-07-22 14:26:24 +02:00
|
|
|
|
2016-10-18 09:21:54 +02:00
|
|
|
static QString group2userName(Group group);
|
|
|
|
static QString type2userName(Type type);
|
|
|
|
static QString group2name(Group group);
|
|
|
|
static QString type2name(Type type);
|
|
|
|
static Group name2group(QString s);
|
|
|
|
static Type name2type(QString s);
|
2014-06-25 21:18:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// NoteVal
|
|
|
|
// helper structure
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
struct NoteVal {
|
|
|
|
int pitch { -1 };
|
2014-09-22 14:31:28 +02:00
|
|
|
int tpc1 { Tpc::TPC_INVALID };
|
|
|
|
int tpc2 { Tpc::TPC_INVALID };
|
2014-06-25 21:18:26 +02:00
|
|
|
int fret { FRET_NONE };
|
|
|
|
int string { STRING_NONE };
|
|
|
|
NoteHead::Group headGroup { NoteHead::Group::HEAD_NORMAL };
|
|
|
|
|
|
|
|
NoteVal() {}
|
|
|
|
NoteVal(int p) : pitch(p) {}
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2016-03-18 09:29:16 +01:00
|
|
|
static const int INVALID_LINE = -10000;
|
|
|
|
|
2012-08-12 11:44:36 +02:00
|
|
|
//---------------------------------------------------------------------------------------
|
2012-07-11 21:29:42 +02:00
|
|
|
// @@ Note
|
2014-05-16 13:44:32 +02:00
|
|
|
/// Graphic representation of a note.
|
2012-07-25 11:49:34 +02:00
|
|
|
//
|
2015-04-24 01:38:32 +02:00
|
|
|
// @P accidental Accidental note accidental (null if none)
|
|
|
|
// @P accidentalType int note accidental type
|
|
|
|
// @P dots array[NoteDot] list of note dots (some can be null, read only)
|
|
|
|
// @P dotsCount int number of note dots (read only)
|
2016-05-03 01:21:42 +02:00
|
|
|
// @P elements array[Element] list of elements attached to notehead
|
2015-04-24 01:38:32 +02:00
|
|
|
// @P fret int fret number in tablature
|
|
|
|
// @P ghost bool ghost note (guitar: death note)
|
|
|
|
// @P headGroup enum (NoteHead.HEAD_NORMAL, .HEAD_BREVIS_ALT, .HEAD_CROSS, .HEAD_DIAMOND, .HEAD_DO, .HEAD_FA, .HEAD_LA, .HEAD_MI, .HEAD_RE, .HEAD_SLASH, .HEAD_SOL, .HEAD_TI, .HEAD_XCIRCLE, .HEAD_TRIANGLE)
|
|
|
|
// @P headType enum (NoteHead.HEAD_AUTO, .HEAD_BREVIS, .HEAD_HALF, .HEAD_QUARTER, .HEAD_WHOLE)
|
|
|
|
// @P hidden bool hidden, not played note (read only)
|
|
|
|
// @P line int notehead position (read only)
|
2016-05-03 01:21:42 +02:00
|
|
|
// @P mirror bool mirror notehead on x axis (read only)
|
2015-04-24 01:38:32 +02:00
|
|
|
// @P pitch int midi pitch
|
|
|
|
// @P play bool play note
|
|
|
|
// @P ppitch int actual played midi pitch (honoring ottavas) (read only)
|
2016-05-03 01:21:42 +02:00
|
|
|
// @P small bool small notehead
|
2015-04-24 01:38:32 +02:00
|
|
|
// @P string int string number in tablature
|
|
|
|
// @P subchannel int midi subchannel (for midi articulation) (read only)
|
|
|
|
// @P tieBack Tie note backward tie (null if none, read only)
|
|
|
|
// @P tieFor Tie note forward tie (null if none, read only)
|
|
|
|
// @P tpc int tonal pitch class, as per concert pitch setting
|
|
|
|
// @P tpc1 int tonal pitch class, non transposed
|
|
|
|
// @P tpc2 int tonal pitch class, transposed
|
|
|
|
// @P tuning float tuning offset in cent
|
|
|
|
// @P userDotPosition enum (Direction.AUTO, Direction.DOWN, Direction.UP)
|
|
|
|
// @P userMirror enum (DirectionH.AUTO, DirectionH.LEFT, DirectionH.RIGHT)
|
2014-05-16 13:44:32 +02:00
|
|
|
// @P veloOffset int
|
2015-04-24 01:38:32 +02:00
|
|
|
// @P veloType enum (Note.OFFSET_VAL, Note.USER_VAL)
|
2012-08-12 11:44:36 +02:00
|
|
|
//---------------------------------------------------------------------------------------
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
class Note : public Element {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
2015-04-24 01:38:32 +02:00
|
|
|
Q_PROPERTY(Ms::Accidental* accidental READ accidental)
|
|
|
|
Q_PROPERTY(int accidentalType READ qmlAccidentalType WRITE qmlSetAccidentalType)
|
2016-06-28 20:48:23 +02:00
|
|
|
Q_PROPERTY(QQmlListProperty<Ms::NoteDot> dots READ qmlDots)
|
2015-04-24 01:38:32 +02:00
|
|
|
Q_PROPERTY(int dotsCount READ qmlDotsCount)
|
2016-06-28 20:48:23 +02:00
|
|
|
Q_PROPERTY(QQmlListProperty<Ms::Element> elements READ qmlElements)
|
2015-04-24 01:38:32 +02:00
|
|
|
Q_PROPERTY(int fret READ fret WRITE undoSetFret)
|
|
|
|
Q_PROPERTY(bool ghost READ ghost WRITE undoSetGhost)
|
|
|
|
Q_PROPERTY(Ms::NoteHead::Group headGroup READ headGroup WRITE undoSetHeadGroup)
|
|
|
|
Q_PROPERTY(Ms::NoteHead::Type headType READ headType WRITE undoSetHeadType)
|
|
|
|
Q_PROPERTY(bool hidden READ hidden)
|
|
|
|
Q_PROPERTY(int line READ line)
|
|
|
|
Q_PROPERTY(bool mirror READ mirror)
|
|
|
|
Q_PROPERTY(int pitch READ pitch WRITE undoSetPitch)
|
|
|
|
Q_PROPERTY(bool play READ play WRITE undoSetPlay)
|
|
|
|
Q_PROPERTY(int ppitch READ ppitch)
|
|
|
|
Q_PROPERTY(bool small READ small WRITE undoSetSmall)
|
|
|
|
Q_PROPERTY(int string READ string WRITE undoSetString)
|
|
|
|
Q_PROPERTY(int subchannel READ subchannel)
|
|
|
|
Q_PROPERTY(Ms::Tie* tieBack READ tieBack)
|
|
|
|
Q_PROPERTY(Ms::Tie* tieFor READ tieFor)
|
|
|
|
Q_PROPERTY(int tpc READ tpc)
|
|
|
|
Q_PROPERTY(int tpc1 READ tpc1 WRITE undoSetTpc1)
|
|
|
|
Q_PROPERTY(int tpc2 READ tpc2 WRITE undoSetTpc2)
|
|
|
|
Q_PROPERTY(qreal tuning READ tuning WRITE undoSetTuning)
|
2016-03-02 13:20:19 +01:00
|
|
|
//TODO-WS Q_PROPERTY(Ms::MScore::Direction userDotPosition READ userDotPosition WRITE undoSetUserDotPosition)
|
2015-04-24 01:38:32 +02:00
|
|
|
Q_PROPERTY(Ms::MScore::DirectionH userMirror READ userMirror WRITE undoSetUserMirror)
|
|
|
|
Q_PROPERTY(int veloOffset READ veloOffset WRITE undoSetVeloOffset)
|
|
|
|
Q_PROPERTY(Ms::Note::ValueType veloType READ veloType WRITE undoSetVeloType)
|
|
|
|
|
2014-06-25 20:02:40 +02:00
|
|
|
Q_ENUMS(ValueType)
|
2016-03-02 13:20:19 +01:00
|
|
|
//TODO-WS Q_ENUMS(Ms::MScore::Direction)
|
2014-06-26 10:53:57 +02:00
|
|
|
Q_ENUMS(Ms::MScore::DirectionH)
|
2014-06-25 20:02:40 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum class ValueType : char { OFFSET_VAL, USER_VAL };
|
2015-04-04 14:27:41 +02:00
|
|
|
int qmlAccidentalType() const { return int(accidentalType()); }
|
|
|
|
void qmlSetAccidentalType(int t) { setAccidentalType(static_cast<AccidentalType>(t)); }
|
2012-05-28 11:29:21 +02:00
|
|
|
|
2014-06-25 20:02:40 +02:00
|
|
|
private:
|
2015-02-19 10:28:25 +01:00
|
|
|
bool _ghost { false }; ///< ghost note (guitar: death note)
|
|
|
|
bool _hidden { false }; ///< markes this note as the hidden one if there are
|
|
|
|
///< overlapping notes; hidden notes are not played
|
|
|
|
///< and heads + accidentals are not shown
|
|
|
|
bool _dotsHidden { false }; ///< dots of hidden notes are hidden too
|
|
|
|
///< except if only one note is dotted
|
|
|
|
bool _fretConflict { false }; ///< used by TAB staves to mark a fretting conflict:
|
|
|
|
///< two or mor enotes on the same string
|
|
|
|
bool dragMode { false };
|
|
|
|
bool _mirror { false }; ///< True if note is mirrored at stem.
|
|
|
|
bool _small { false };
|
|
|
|
bool _play { true }; // note is not played if false
|
|
|
|
mutable bool _mark { false }; // for use in sequencer
|
|
|
|
bool _fixed { false }; // for slash notation
|
|
|
|
|
2016-09-13 09:39:50 +02:00
|
|
|
MScore::DirectionH _userMirror { MScore::DirectionH::AUTO }; ///< user override of mirror
|
|
|
|
Direction _userDotPosition { Direction::AUTO }; ///< user override of dot position
|
2015-02-19 10:28:25 +01:00
|
|
|
|
|
|
|
NoteHead::Group _headGroup { NoteHead::Group::HEAD_NORMAL };
|
|
|
|
NoteHead::Type _headType { NoteHead::Type::HEAD_AUTO };
|
|
|
|
|
|
|
|
ValueType _veloType { ValueType::OFFSET_VAL };
|
2015-11-02 14:09:03 +01:00
|
|
|
|
|
|
|
char _offTimeType { 0 }; // compatibility only 1 - user(absolute), 2 - offset (%)
|
|
|
|
char _onTimeType { 0 }; // compatibility only 1 - user, 2 - offset
|
|
|
|
|
|
|
|
int _subchannel { 0 }; ///< articulation
|
2016-03-18 09:29:16 +01:00
|
|
|
int _line { INVALID_LINE }; ///< y-Position; 0 - top line.
|
2015-11-02 14:09:03 +01:00
|
|
|
int _fret { -1 }; ///< for tablature view
|
|
|
|
int _string { -1 };
|
|
|
|
mutable int _tpc[2] { Tpc::TPC_INVALID, Tpc::TPC_INVALID }; ///< tonal pitch class (concert/transposing)
|
|
|
|
mutable int _pitch { 0 }; ///< Note pitch as midi value (0 - 127).
|
|
|
|
|
2015-02-19 10:28:25 +01:00
|
|
|
int _veloOffset { 0 }; ///< velocity user offset in percent, or absolute velocity for this note
|
|
|
|
int _fixedLine { 0 }; // fixed line number if _fixed == true
|
|
|
|
int _lineOffset { 0 }; ///< Used during mouse dragging.
|
|
|
|
qreal _tuning { 0.0 }; ///< pitch offset in cent, playable only by internal synthesizer
|
|
|
|
|
|
|
|
Accidental* _accidental { 0 };
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-02-19 10:28:25 +01:00
|
|
|
Tie* _tieFor { 0 };
|
|
|
|
Tie* _tieBack { 0 };
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-02-06 22:03:43 +01:00
|
|
|
ElementList _el; ///< fingering, other text, symbols or images
|
|
|
|
QVector<NoteDot*> _dots;
|
2012-11-19 10:08:15 +01:00
|
|
|
NoteEventList _playEvents;
|
2016-02-06 22:03:43 +01:00
|
|
|
QVector<Spanner*> _spannerFor;
|
|
|
|
QVector<Spanner*> _spannerBack;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-10-22 20:16:42 +02:00
|
|
|
SymId _cachedNoteheadSym; // use in draw to avoid recomputing at every update
|
|
|
|
SymId _cachedSymNull; // additional symbol for some transparent notehead
|
|
|
|
|
2013-10-22 12:05:31 +02:00
|
|
|
virtual QRectF drag(EditData*) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
void endDrag();
|
|
|
|
void endEdit();
|
2012-09-12 16:19:03 +02:00
|
|
|
void addSpanner(Spanner*);
|
|
|
|
void removeSpanner(Spanner*);
|
2014-04-09 09:40:25 +02:00
|
|
|
int concertPitchIdx() const;
|
2014-04-22 17:02:03 +02:00
|
|
|
void updateRelLine(int relLine, bool undoable);
|
2016-10-22 20:16:42 +02:00
|
|
|
bool isNoteName() const;
|
|
|
|
SymId noteHead() const;
|
2012-09-12 16:19:03 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
Note(Score* s = 0);
|
2014-07-10 18:59:44 +02:00
|
|
|
Note(const Note&, bool link = false);
|
2012-05-26 14:26:10 +02:00
|
|
|
~Note();
|
2014-07-10 18:59:44 +02:00
|
|
|
|
|
|
|
Note& operator=(const Note&) = delete;
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual Note* clone() const override { return new Note(*this, false); }
|
|
|
|
Element::Type type() const override { return Element::Type::NOTE; }
|
2013-05-28 15:42:02 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual qreal mag() const override;
|
2013-05-28 15:42:02 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
void layout();
|
|
|
|
void layout2();
|
|
|
|
void scanElements(void* data, void (*func)(void*, Element*), bool all=true);
|
|
|
|
void setTrack(int val);
|
|
|
|
|
|
|
|
int playTicks() const;
|
|
|
|
|
|
|
|
qreal headWidth() const;
|
|
|
|
qreal headHeight() const;
|
2014-04-28 18:38:50 +02:00
|
|
|
qreal tabHeadWidth(StaffType* tab = 0) const;
|
|
|
|
qreal tabHeadHeight(StaffType* tab = 0) const;
|
2015-06-03 10:23:01 +02:00
|
|
|
QPointF stemDownNW() const;
|
|
|
|
QPointF stemUpSE() const;
|
2013-01-02 09:29:17 +01:00
|
|
|
|
2014-06-25 21:18:26 +02:00
|
|
|
NoteHead::Group headGroup() const { return _headGroup; }
|
2014-06-25 22:01:26 +02:00
|
|
|
NoteHead::Type headType() const { return _headType; }
|
2014-06-25 21:18:26 +02:00
|
|
|
void setHeadGroup(NoteHead::Group val);
|
2014-06-25 22:01:26 +02:00
|
|
|
void setHeadType(NoteHead::Type t);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual int subtype() const override { return (int) _headGroup; }
|
|
|
|
virtual QString subtypeName() const override;
|
2014-07-17 15:07:12 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
void setPitch(int val);
|
2012-07-16 20:21:31 +02:00
|
|
|
void undoSetPitch(int val);
|
2014-04-09 09:40:25 +02:00
|
|
|
void setPitch(int pitch, int tpc1, int tpc2);
|
|
|
|
int pitch() const { return _pitch; }
|
|
|
|
int ppitch() const; ///< playback pitch
|
|
|
|
int epitch() const; ///< effective pitch
|
2012-11-19 10:08:15 +01:00
|
|
|
qreal tuning() const { return _tuning; }
|
|
|
|
void setTuning(qreal v) { _tuning = v; }
|
2014-04-09 09:40:25 +02:00
|
|
|
void undoSetTpc(int v);
|
|
|
|
int transposition() const;
|
2014-11-15 21:28:16 +01:00
|
|
|
bool fixed() const { return _fixed; }
|
|
|
|
void setFixed(bool v) { _fixed = v; }
|
|
|
|
int fixedLine() const { return _fixedLine; }
|
|
|
|
void setFixedLine(int v) { _fixedLine = v; }
|
2014-04-09 09:40:25 +02:00
|
|
|
|
|
|
|
int tpc() const;
|
|
|
|
int tpc1() const { return _tpc[0]; } // non transposed tpc
|
|
|
|
int tpc2() const { return _tpc[1]; } // transposed tpc
|
2016-02-04 17:06:32 +01:00
|
|
|
QString tpcUserName(bool explicitAccidental = false) const;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
void setTpc(int v);
|
2014-04-09 09:40:25 +02:00
|
|
|
void setTpc1(int v) { _tpc[0] = v; }
|
|
|
|
void setTpc2(int v) { _tpc[1] = v; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void setTpcFromPitch();
|
2014-04-10 13:13:37 +02:00
|
|
|
int tpc1default(int pitch) const;
|
|
|
|
int tpc2default(int pitch) const;
|
2014-05-26 18:18:01 +02:00
|
|
|
void undoSetTpc1(int tpc) { undoChangeProperty(P_ID::TPC1, tpc); }
|
|
|
|
void undoSetTpc2(int tpc) { undoChangeProperty(P_ID::TPC2, tpc); }
|
2014-04-14 10:39:27 +02:00
|
|
|
int transposeTpc(int tpc);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-04-04 14:27:41 +02:00
|
|
|
Accidental* accidental() const { return _accidental; }
|
2012-11-19 10:08:15 +01:00
|
|
|
void setAccidental(Accidental* a) { _accidental = a; }
|
2014-09-22 14:31:28 +02:00
|
|
|
|
2015-04-03 18:23:51 +02:00
|
|
|
AccidentalType accidentalType() const;
|
2015-04-02 10:33:53 +02:00
|
|
|
void setAccidentalType(AccidentalType type);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-11-15 21:28:16 +01:00
|
|
|
int line() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
void setLine(int n);
|
2015-09-01 06:19:20 +02:00
|
|
|
int physicalLine() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
int fret() const { return _fret; }
|
|
|
|
void setFret(int val) { _fret = val; }
|
|
|
|
int string() const { return _string; }
|
|
|
|
void setString(int val);
|
|
|
|
bool ghost() const { return _ghost; }
|
|
|
|
void setGhost(bool val) { _ghost = val; }
|
|
|
|
bool fretConflict() const { return _fretConflict; }
|
|
|
|
void setFretConflict(bool val) { _fretConflict = val; }
|
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void add(Element*) override;
|
|
|
|
virtual void remove(Element*) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
bool mirror() const { return _mirror; }
|
|
|
|
void setMirror(bool val) { _mirror = val; }
|
|
|
|
|
|
|
|
bool small() const { return _small; }
|
2013-01-02 09:29:17 +01:00
|
|
|
void setSmall(bool val);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-08-23 13:55:54 +02:00
|
|
|
bool play() const { return _play; }
|
|
|
|
void setPlay(bool val) { _play = val; }
|
|
|
|
|
2015-01-28 15:20:33 +01:00
|
|
|
Ms::Tie* tieFor() const { return _tieFor; }
|
|
|
|
Ms::Tie* tieBack() const { return _tieBack; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void setTieFor(Tie* t) { _tieFor = t; }
|
|
|
|
void setTieBack(Tie* t) { _tieBack = t; }
|
2015-01-28 15:20:33 +01:00
|
|
|
Note* firstTiedNote() const;
|
|
|
|
Note* lastTiedNote() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
Chord* chord() const { return (Chord*)parent(); }
|
|
|
|
void setChord(Chord* a) { setParent((Element*)a); }
|
2016-10-29 12:32:58 +02:00
|
|
|
virtual void draw(QPainter*) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-10-16 18:12:58 +02:00
|
|
|
virtual void read(XmlReader&) override;
|
2016-09-22 12:02:27 +02:00
|
|
|
virtual bool readProperties(XmlReader&) override;
|
2014-10-16 18:12:58 +02:00
|
|
|
virtual void write(Xml& xml) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-08-13 21:01:21 +02:00
|
|
|
bool acceptDrop(const DropData&) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
Element* drop(const DropData&);
|
|
|
|
|
2013-01-02 09:29:17 +01:00
|
|
|
bool hidden() const { return _hidden; }
|
|
|
|
void setHidden(bool val) { _hidden = val; }
|
2014-02-22 11:19:44 +01:00
|
|
|
bool dotsHidden() const { return _dotsHidden; }
|
|
|
|
void setDotsHidden(bool val) { _dotsHidden = val; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
NoteType noteType() const;
|
2016-02-04 17:06:32 +01:00
|
|
|
QString noteTypeUserName() const;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-07-15 11:57:07 +02:00
|
|
|
ElementList el() { return _el; }
|
|
|
|
const ElementList el() const { return _el; }
|
2016-06-28 20:48:23 +02:00
|
|
|
QQmlListProperty<Ms::Element> qmlElements() { return QmlListAccess<Ms::Element>(this, _el); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-01-02 09:29:17 +01:00
|
|
|
int subchannel() const { return _subchannel; }
|
|
|
|
void setSubchannel(int val) { _subchannel = val; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-06-26 10:53:57 +02:00
|
|
|
MScore::DirectionH userMirror() const { return _userMirror; }
|
|
|
|
void setUserMirror(MScore::DirectionH d) { _userMirror = d; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-03-02 13:20:19 +01:00
|
|
|
Direction userDotPosition() const { return _userDotPosition; }
|
|
|
|
void setUserDotPosition(Direction d) { _userDotPosition = d; }
|
2012-05-26 14:26:10 +02:00
|
|
|
bool dotIsUp() const; // actual dot position
|
|
|
|
|
2012-11-19 10:08:15 +01:00
|
|
|
void reset();
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-05-07 18:09:01 +02:00
|
|
|
ValueType veloType() const { return _veloType; }
|
|
|
|
void setVeloType(ValueType v) { _veloType = v; }
|
2013-01-02 09:29:17 +01:00
|
|
|
int veloOffset() const { return _veloOffset; }
|
|
|
|
void setVeloOffset(int v) { _veloOffset = v; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2012-11-19 10:08:15 +01:00
|
|
|
void setOnTimeOffset(int v);
|
|
|
|
void setOffTimeOffset(int v);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
int customizeVelocity(int velo) const;
|
2016-01-04 14:48:58 +01:00
|
|
|
NoteDot* dot(int n) { return _dots[n]; }
|
2016-02-06 22:03:43 +01:00
|
|
|
const QVector<NoteDot*>& dots() const { return _dots; }
|
|
|
|
QVector<NoteDot*>& dots() { return _dots; }
|
2016-01-04 14:48:58 +01:00
|
|
|
|
2016-06-28 20:48:23 +02:00
|
|
|
QQmlListProperty<Ms::NoteDot> qmlDots() { return QmlListAccess<Ms::NoteDot>(this, _dots); }
|
2016-01-04 14:48:58 +01:00
|
|
|
|
2015-03-19 10:39:18 +01:00
|
|
|
int qmlDotsCount();
|
2012-05-26 14:26:10 +02:00
|
|
|
void updateAccidental(AccidentalState*);
|
|
|
|
void updateLine();
|
2014-12-15 23:08:33 +01:00
|
|
|
void setNval(const NoteVal&, int tick = -1);
|
2012-11-19 10:08:15 +01:00
|
|
|
NoteEventList& playEvents() { return _playEvents; }
|
|
|
|
const NoteEventList& playEvents() const { return _playEvents; }
|
|
|
|
NoteEvent* noteEvent(int idx) { return &_playEvents[idx]; }
|
|
|
|
void setPlayEvents(const NoteEventList& l) { _playEvents = l; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-02-06 22:03:43 +01:00
|
|
|
const QVector<Spanner*>& spannerFor() const { return _spannerFor; }
|
|
|
|
const QVector<Spanner*>& spannerBack() const { return _spannerBack; }
|
2013-01-03 16:56:56 +01:00
|
|
|
|
2013-06-10 11:03:34 +02:00
|
|
|
void addSpannerBack(Spanner* e) { _spannerBack.push_back(e); }
|
|
|
|
bool removeSpannerBack(Spanner* e) { return _spannerBack.removeOne(e); }
|
|
|
|
void addSpannerFor(Spanner* e) { _spannerFor.push_back(e); }
|
|
|
|
bool removeSpannerFor(Spanner* e) { return _spannerFor.removeOne(e); }
|
2012-09-12 16:19:03 +02:00
|
|
|
|
2012-11-14 13:14:56 +01:00
|
|
|
void transposeDiatonic(int interval, bool keepAlterations, bool useDoubleAccidentals);
|
|
|
|
|
2012-08-12 11:44:36 +02:00
|
|
|
void undoSetFret(int);
|
|
|
|
void undoSetString(int);
|
|
|
|
void undoSetGhost(bool);
|
|
|
|
void undoSetMirror(bool);
|
|
|
|
void undoSetSmall(bool);
|
2013-08-23 13:55:54 +02:00
|
|
|
void undoSetPlay(bool);
|
2012-08-12 11:44:36 +02:00
|
|
|
void undoSetTuning(qreal);
|
2014-05-07 18:09:01 +02:00
|
|
|
void undoSetVeloType(ValueType);
|
2012-08-12 11:44:36 +02:00
|
|
|
void undoSetVeloOffset(int);
|
|
|
|
void undoSetOnTimeUserOffset(int);
|
|
|
|
void undoSetOffTimeUserOffset(int);
|
2014-06-26 10:53:57 +02:00
|
|
|
void undoSetUserMirror(MScore::DirectionH);
|
2016-03-02 13:20:19 +01:00
|
|
|
void undoSetUserDotPosition(Direction);
|
2014-06-25 21:18:26 +02:00
|
|
|
void undoSetHeadGroup(NoteHead::Group);
|
2014-06-25 22:01:26 +02:00
|
|
|
void undoSetHeadType(NoteHead::Type);
|
2012-08-12 11:44:36 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const override;
|
2013-02-20 17:53:15 +01:00
|
|
|
|
2013-06-10 11:03:34 +02:00
|
|
|
bool mark() const { return _mark; }
|
|
|
|
void setMark(bool v) const { _mark = v; }
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void setScore(Score* s) override;
|
2016-03-02 13:20:19 +01:00
|
|
|
void setDotY(Direction);
|
2014-08-13 21:01:21 +02:00
|
|
|
|
2014-07-18 00:11:00 +02:00
|
|
|
void addBracket();
|
2013-11-25 15:42:40 +01:00
|
|
|
|
2016-10-22 20:16:42 +02:00
|
|
|
static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type, int tpc, Key key, NoteHeadScheme scheme);
|
2014-06-25 22:01:26 +02:00
|
|
|
static SymId noteHead(int direction, NoteHead::Group, NoteHead::Type);
|
2014-06-26 12:40:37 +02:00
|
|
|
NoteVal noteVal() const;
|
2014-06-20 22:48:34 +02:00
|
|
|
|
|
|
|
virtual Element* nextElement() override;
|
|
|
|
virtual Element* prevElement() override;
|
2016-02-04 17:06:32 +01:00
|
|
|
|
|
|
|
virtual QString accessibleInfo() const override;
|
|
|
|
virtual QString screenReaderInfo() const override;
|
|
|
|
virtual QString accessibleExtraInfo() const override;
|
2016-01-04 14:48:58 +01:00
|
|
|
|
|
|
|
virtual Shape shape() const override;
|
2016-03-19 11:41:38 +01:00
|
|
|
std::vector<Note*> tiedNotes() const;
|
2016-09-22 12:02:27 +02:00
|
|
|
|
|
|
|
void setOffTimeType(int v) { _offTimeType = v; }
|
|
|
|
void setOnTimeType(int v) { _onTimeType = v; }
|
|
|
|
int offTimeType() const { return _offTimeType; }
|
|
|
|
int onTimeType() const { return _onTimeType; }
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
} // namespace Ms
|
|
|
|
|
2014-06-25 21:18:26 +02:00
|
|
|
Q_DECLARE_METATYPE(Ms::NoteHead::Group);
|
2014-06-25 22:01:26 +02:00
|
|
|
Q_DECLARE_METATYPE(Ms::NoteHead::Type);
|
2014-06-25 20:02:40 +02:00
|
|
|
Q_DECLARE_METATYPE(Ms::Note::ValueType);
|
2013-05-13 18:49:17 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|