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