Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2025 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #pragma once
24 :
25 : #include "mscore.h"
26 : #include "pitchspelling.h"
27 : #include "../types/types.h"
28 :
29 : namespace mu::engraving {
30 : //---------------------------------------------------------
31 : // NoteVal
32 : /// helper structure
33 : /// \cond PLUGIN_API \private \endcond
34 : //---------------------------------------------------------
35 : struct NoteVal {
36 : int pitch = -1;
37 : int velocityOverride = 0;
38 : int tpc1 = Tpc::TPC_INVALID;
39 : int tpc2 = Tpc::TPC_INVALID;
40 : int fret = INVALID_FRET_INDEX;
41 : int string = INVALID_STRING_INDEX;
42 : NoteHeadGroup headGroup = NoteHeadGroup::HEAD_NORMAL;
43 :
44 6141 : NoteVal() {}
45 1096 : NoteVal(int p)
46 1096 : : pitch(p) {}
47 :
48 0 : bool operator==(const NoteVal& v) const
49 : {
50 0 : return pitch == v.pitch
51 0 : && velocityOverride == v.velocityOverride
52 0 : && tpc1 == v.tpc1
53 0 : && tpc2 == v.tpc2
54 0 : && fret == v.fret
55 0 : && string == v.string
56 0 : && headGroup == v.headGroup;
57 : }
58 :
59 0 : int tpc(bool concertPitch) const
60 : {
61 0 : return concertPitch ? tpc1 : tpc2;
62 : }
63 :
64 566 : bool isRest() const
65 : {
66 566 : return pitch == -1;
67 : }
68 : };
69 :
70 : using NoteValList = std::vector<NoteVal>;
71 : }
|