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) 2021 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 : #include "bagpembell.h"
24 :
25 : #include "types/typesconv.h"
26 :
27 : #include "dummyparent.h"
28 :
29 : #include "log.h"
30 :
31 : using namespace mu;
32 : using namespace mu::engraving;
33 :
34 : // Staff line and pitch for every bagpipe note
35 : const BagpipeNoteInfo BagpipeEmbellishment::BAGPIPE_NOTEINFO_LIST[] = {
36 : { "LG", 6, 65 },
37 : { "LA", 5, 67 },
38 : { "B", 4, 69 },
39 : { "C", 3, 71 }, // actually C#
40 : { "D", 2, 72 },
41 : { "E", 1, 74 },
42 : { "F", 0, 76 }, // actually F#
43 : { "HG", -1, 77 },
44 : { "HA", -2, 79 }
45 : };
46 :
47 0 : BagpipeEmbellishment::BagpipeEmbellishment(DummyParent* parent)
48 0 : : EngravingItem(ElementType::BAGPIPE_EMBELLISHMENT, parent), m_embelType(EmbellishmentType(0))
49 : {
50 0 : }
51 :
52 : //---------------------------------------------------------
53 : // resolveNoteList
54 : // return notes as list of indices in BagpipeNoteInfoList
55 : //---------------------------------------------------------
56 :
57 0 : BagpipeNoteList BagpipeEmbellishment::resolveNoteList() const
58 : {
59 0 : BagpipeNoteList nl;
60 :
61 0 : StringList notes = TConv::embellishmentNotes(m_embelType);
62 0 : int noteInfoSize = sizeof(BAGPIPE_NOTEINFO_LIST) / sizeof(*BAGPIPE_NOTEINFO_LIST);
63 0 : for (const String& note : notes) {
64 : // search for note in BagpipeNoteInfoList
65 0 : for (int i = 0; i < noteInfoSize; ++i) {
66 0 : if (String::fromAscii(BAGPIPE_NOTEINFO_LIST[i].name.ascii()) == note) {
67 : // found it, append to list
68 0 : nl.push_back(i);
69 0 : break;
70 : }
71 : }
72 : }
73 :
74 0 : return nl;
75 0 : }
76 :
77 : //---------------------------------------------------------
78 : // mag
79 : // return fixed magnification
80 : //---------------------------------------------------------
81 :
82 0 : double BagpipeEmbellishment::mag() const
83 : {
84 0 : return 0.7;
85 : }
|