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 "stringssetupdataresolver.h"
24 :
25 : using namespace mu::engraving;
26 : using namespace muse;
27 : using namespace muse::mpe;
28 :
29 41 : PlaybackSetupData StringsSetupDataResolver::doResolve(const Instrument* instrument)
30 : {
31 : static const std::unordered_map<std::string, mpe::PlaybackSetupData> SETUP_DATA_MAP = {
32 : { "harp", { SoundId::Harp, SoundCategory::Strings, { mpe::SoundSubCategory::Plucked } } },
33 : { "cavaquinho", { SoundId::Cavaquinho, SoundCategory::Strings, { SoundSubCategory::Acoustic,
34 : SoundSubCategory::Steel,
35 : SoundSubCategory::Plucked } } },
36 : { "cavaquinho-tablature", { SoundId::Cavaquinho, SoundCategory::Strings, { SoundSubCategory::Acoustic,
37 : SoundSubCategory::Steel,
38 : SoundSubCategory::Plucked } } },
39 : { "soprano-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
40 : SoundSubCategory::Nylon,
41 : SoundSubCategory::Soprano,
42 : SoundSubCategory::Plucked } } },
43 : { "alto-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
44 : SoundSubCategory::Nylon,
45 : SoundSubCategory::Alto,
46 : SoundSubCategory::Plucked } } },
47 : { "baritone-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
48 : SoundSubCategory::Nylon,
49 : SoundSubCategory::Baritone,
50 : SoundSubCategory::Plucked } } },
51 : { "contra-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
52 : SoundSubCategory::Nylon,
53 : SoundSubCategory::Contra,
54 : SoundSubCategory::Plucked } } },
55 :
56 : { "electric-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Electric,
57 : SoundSubCategory::Plucked } } },
58 : { "electric-guitar-treble-clef", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Electric,
59 : SoundSubCategory::Plucked } } },
60 : { "electric-guitar-tablature", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Electric,
61 : SoundSubCategory::Plucked } } },
62 :
63 : { "guitar-steel", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
64 : SoundSubCategory::Steel,
65 : SoundSubCategory::Plucked } } },
66 : { "guitar-steel-treble-clef", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
67 : SoundSubCategory::Steel,
68 : SoundSubCategory::Plucked } } },
69 : { "guitar-steel-tablature", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
70 : SoundSubCategory::Steel,
71 : SoundSubCategory::Plucked } } },
72 : { "pedal-steel-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
73 : SoundSubCategory::Pedal,
74 : SoundSubCategory::Steel,
75 : SoundSubCategory::Plucked } } },
76 :
77 : { "guitar-nylon", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
78 : SoundSubCategory::Nylon,
79 : SoundSubCategory::Plucked } } },
80 : { "guitar-nylon-treble-clef", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
81 : SoundSubCategory::Nylon,
82 : SoundSubCategory::Plucked } } },
83 : { "guitar-nylon-tablature", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
84 : SoundSubCategory::Nylon,
85 : SoundSubCategory::Plucked } } },
86 : { "7-string-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
87 : SoundSubCategory::Nylon,
88 : SoundSubCategory::Plucked } } },
89 : { "7-string-guitar-tablature", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
90 : SoundSubCategory::Nylon,
91 : SoundSubCategory::Plucked } } },
92 : { "11-string-alto-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
93 : SoundSubCategory::Nylon,
94 : SoundSubCategory::Alto,
95 : SoundSubCategory::Plucked } } },
96 : { "12-string-guitar", { SoundId::Guitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
97 : SoundSubCategory::Steel,
98 : SoundSubCategory::TwelveString,
99 : SoundSubCategory::Plucked } } },
100 :
101 : { "5-string-electric-bass-high-c", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
102 : SoundSubCategory::Tenor,
103 : SoundSubCategory::Plucked } } },
104 : { "5-string-electric-bass-tab-high-c", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
105 : SoundSubCategory::Tenor,
106 : SoundSubCategory::Plucked } } },
107 : { "5-string-electric-bass-tab", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
108 : SoundSubCategory::Plucked } } },
109 : { "5-string-electric-bass", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
110 : SoundSubCategory::Plucked } } },
111 : { "6-string-electric-bass", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
112 : SoundSubCategory::Plucked } } },
113 : { "6-string-electric-bass-tab", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
114 : SoundSubCategory::Plucked } } },
115 : { "bass-guitar", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
116 : SoundSubCategory::Plucked } } },
117 : { "bass-guitar-tablature", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
118 : SoundSubCategory::Plucked } } },
119 : { "electric-bass-4-str-tab", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
120 : SoundSubCategory::Plucked } } },
121 : { "electric-bass", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
122 : SoundSubCategory::Plucked } } },
123 : { "fretless-electric-bass", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Electric,
124 : SoundSubCategory::Fretless,
125 : SoundSubCategory::Plucked } } },
126 : { "acoustic-bass", { SoundId::BassGuitar, SoundCategory::Strings, { SoundSubCategory::Acoustic,
127 : SoundSubCategory::Plucked } } },
128 :
129 : { "banjo", { SoundId::Banjo, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
130 : { "tenor-banjo", { SoundId::Banjo, SoundCategory::Strings, { SoundSubCategory::Tenor,
131 : SoundSubCategory::Plucked } } },
132 : { "banjo-tablature", { SoundId::Banjo, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
133 : { "irish-tenor-banjo", { SoundId::Banjo, SoundCategory::Strings, { SoundSubCategory::Irish,
134 : SoundSubCategory::Tenor,
135 : SoundSubCategory::Plucked } } },
136 : { "irish-tenor-banjo-tablature", { SoundId::Banjo, SoundCategory::Strings, { SoundSubCategory::Irish,
137 : SoundSubCategory::Tenor,
138 : SoundSubCategory::Plucked } } },
139 :
140 : { "ukulele", { SoundId::Ukulele, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
141 : { "ukulele-4-str-tab", { SoundId::Ukulele, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
142 : { "ukulele-low-g", { SoundId::Ukulele, SoundCategory::Strings, { SoundSubCategory::Tenor,
143 : SoundSubCategory::Plucked } } },
144 : { "tenor-ukulele", { SoundId::Ukulele, SoundCategory::Strings, { SoundSubCategory::Tenor,
145 : SoundSubCategory::Plucked } } },
146 : { "baritone-ukulele", { SoundId::Ukulele, SoundCategory::Strings, { SoundSubCategory::Baritone,
147 : SoundSubCategory::Plucked } } },
148 :
149 : { "mandolin", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
150 : { "mandolin-tablature", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
151 : { "alto-mandola", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Alto,
152 : SoundSubCategory::Plucked } } },
153 : { "mandola", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
154 : { "tenor-mandola", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Tenor,
155 : SoundSubCategory::Plucked } } },
156 : { "octave-mandolin", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Octave,
157 : SoundSubCategory::Plucked } } },
158 : { "mandocello", { SoundId::Mandolin, SoundCategory::Strings, { SoundSubCategory::Octave,
159 : SoundSubCategory::Plucked } } },
160 :
161 : { "mtn-dulcimer-std", { SoundId::MtnDulcimer, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
162 : { "mtn-dulcimer-std-chrom-tab", { SoundId::MtnDulcimer, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
163 : { "mtn-dulcimer-baritone", { SoundId::MtnDulcimer, SoundCategory::Strings, { SoundSubCategory::Baritone,
164 : SoundSubCategory::Plucked, } } },
165 : { "mtn-dulcimer-bartn-chrom-tab", { SoundId::MtnDulcimer, SoundCategory::Strings, { SoundSubCategory::Baritone,
166 : SoundSubCategory::Plucked } } },
167 : { "mtn-dulcimer-bass", { SoundId::MtnDulcimer, SoundCategory::Strings, { SoundSubCategory::Bass,
168 : SoundSubCategory::Plucked } } },
169 : { "mtn-dulcimer-bass-chrom-tab", { SoundId::MtnDulcimer, SoundCategory::Strings, { SoundSubCategory::Bass,
170 : SoundSubCategory::Plucked } } },
171 :
172 : { "lute", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
173 : { "lute-tablature", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
174 : { "ren.-tenor-lute-5-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Tenor,
175 : SoundSubCategory::Plucked } } },
176 : { "ren.-tenor-lute-6-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Tenor,
177 : SoundSubCategory::Plucked } } },
178 : { "ren.-tenor-lute-7-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Tenor,
179 : SoundSubCategory::Plucked } } },
180 : { "ren.-tenor-lute-8-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Tenor,
181 : SoundSubCategory::Plucked } } },
182 : { "ren.-tenor-lute-9-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Tenor,
183 : SoundSubCategory::Plucked, } } },
184 : { "ren.-tenor-lute-10-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Tenor,
185 : SoundSubCategory::Plucked } } },
186 : { "baroque-lute-13-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Baroque,
187 : SoundSubCategory::Plucked } } },
188 : { "archlute-14-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
189 : { "bouzouki-3-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Greek,
190 : SoundSubCategory::Plucked } } },
191 : { "bouzouki-4-course", { SoundId::Lute, SoundCategory::Strings, { SoundSubCategory::Greek,
192 : SoundSubCategory::Plucked } } },
193 :
194 : { "theorbo-14-course", { SoundId::Theorbo, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
195 :
196 : { "balalaika", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Prima,
197 : SoundSubCategory::Plucked } } },
198 : { "balalaika-piccolo", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Piccolo,
199 : SoundSubCategory::Plucked } } },
200 : { "balalaika-prima", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Prima,
201 : SoundSubCategory::Plucked } } },
202 : { "balalaika-alto", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Prima,
203 : SoundSubCategory::Alto,
204 : SoundSubCategory::Plucked } } },
205 : { "balalaika-bass", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Prima,
206 : SoundSubCategory::Bass,
207 : SoundSubCategory::Plucked } } },
208 : { "balalaika-contrabass", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Prima,
209 : SoundSubCategory::Contra_Bass,
210 : SoundSubCategory::Plucked } } },
211 : { "balalaika-secunda", { SoundId::Balalaika, SoundCategory::Strings, { SoundSubCategory::Secunda,
212 : SoundSubCategory::Plucked } } },
213 :
214 : { "guzheng", { SoundId::Guzheng, SoundCategory::Strings, { SoundSubCategory::Chinese,
215 : SoundSubCategory::Plucked } } },
216 : { "guqin", { SoundId::Guqin, SoundCategory::Strings, { SoundSubCategory::Chinese,
217 : SoundSubCategory::Plucked } } },
218 : { "pipa", { SoundId::Pipa, SoundCategory::Strings, { SoundSubCategory::Chinese,
219 : SoundSubCategory::Plucked } } },
220 : { "yangqin", { SoundId::Yangqin, SoundCategory::Strings, { SoundSubCategory::Chinese } } },
221 : { "gayageum", { SoundId::Gayageum, SoundCategory::Strings, { SoundSubCategory::Korean,
222 : SoundSubCategory::Plucked } } },
223 : { "koto", { SoundId::Koto, SoundCategory::Strings, { SoundSubCategory::Japanese,
224 : SoundSubCategory::Plucked } } },
225 : { "oud", { SoundId::Oud, SoundCategory::Strings, { SoundSubCategory::African,
226 : SoundSubCategory::Plucked } } },
227 : { "shamisen", { SoundId::Shamisen, SoundCategory::Strings, { SoundSubCategory::Japanese,
228 : SoundSubCategory::Plucked } } },
229 : { "sitar", { SoundId::Sitar, SoundCategory::Strings, { SoundSubCategory::Indian,
230 : SoundSubCategory::Plucked } } },
231 : { "prim", { SoundId::Prim, SoundCategory::Strings, { SoundSubCategory::Plucked, } } },
232 : { "brac", { SoundId::Brac, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
233 : { "bugarija", { SoundId::Bugarija, SoundCategory::Strings, { mpe::SoundSubCategory::Plucked } } },
234 : { "berda", { SoundId::Berda, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
235 : { "celo", { SoundId::Celo, SoundCategory::Strings, { SoundSubCategory::Plucked } } },
236 : { "bandurria", { SoundId::Bandurria, SoundCategory::Strings, { SoundSubCategory::Spanish,
237 : SoundSubCategory::Plucked } } },
238 : { "bandurria-tablature", { SoundId::Bandurria, SoundCategory::Strings, { SoundSubCategory::Spanish,
239 : SoundSubCategory::Plucked } } },
240 : { "laud", { SoundId::Laud, SoundCategory::Strings, { SoundSubCategory::Spanish,
241 : SoundSubCategory::Plucked } } },
242 : { "laud-tablature", { SoundId::Laud, SoundCategory::Strings, { SoundSubCategory::Spanish,
243 : SoundSubCategory::Plucked } } },
244 :
245 : { "strings", { SoundId::StringsGroup, SoundCategory::Strings } },
246 : { "double-bass", { SoundId::Contrabass, SoundCategory::Strings, { SoundSubCategory::Orchestral } } },
247 : { "contrabass", { SoundId::Contrabass, SoundCategory::Strings, { SoundSubCategory::Orchestral } } },
248 : { "contrabasses", { SoundId::Contrabass, SoundCategory::Strings, { SoundSubCategory::Orchestral,
249 : SoundSubCategory::Section } } },
250 : { "violin", { SoundId::Violin, SoundCategory::Strings, { SoundSubCategory::Orchestral } } },
251 : { "violins", { SoundId::Violin, SoundCategory::Strings, { SoundSubCategory::Orchestral,
252 : SoundSubCategory::Section } } },
253 : { "viola", { SoundId::Viola, SoundCategory::Strings, { SoundSubCategory::Orchestral } } },
254 : { "violas", { SoundId::Viola, SoundCategory::Strings, { SoundSubCategory::Orchestral,
255 : SoundSubCategory::Section } } },
256 : { "violoncello", { SoundId::Violoncello, SoundCategory::Strings, { SoundSubCategory::Orchestral } } },
257 : { "violoncellos", { SoundId::Violoncello, SoundCategory::Strings, { SoundSubCategory::Orchestral,
258 : SoundSubCategory::Section } } },
259 :
260 : { "treble-viol", { SoundId::Viol, SoundCategory::Strings } },
261 : { "alto-viol", { SoundId::Viol, SoundCategory::Strings, { SoundSubCategory::Alto } } },
262 : { "pardessus-de-viole", { SoundId::PardessusViol, SoundCategory::Strings } },
263 : { "tenor-viol", { SoundId::Viol, SoundCategory::Strings, { SoundSubCategory::Tenor } } },
264 : { "baryton", { SoundId::Viol, SoundCategory::Strings, { SoundSubCategory::Baritone } } },
265 : { "viola-da-gamba", { SoundId::ViolaDaGamba, SoundCategory::Strings } },
266 : { "viola-da-gamba-tablature", { SoundId::ViolaDaGamba, SoundCategory::Strings } },
267 : { "violone", { SoundId::Violone, SoundCategory::Strings } },
268 : { "d-violone", { SoundId::Violone, SoundCategory::Strings } },
269 :
270 : { "octobass", { SoundId::Octobass, SoundCategory::Strings } },
271 : { "erhu", { SoundId::Erhu, SoundCategory::Strings, { SoundSubCategory::Chinese } } },
272 : { "nyckelharpa", { SoundId::Nyckelharpa, SoundCategory::Strings, { SoundSubCategory::Swedish } } },
273 : { "ajaeng", { SoundId::Ajaeng, SoundCategory::Strings, { SoundSubCategory::Korean } } },
274 :
275 : { "bass-synthesizer", { SoundId::Synthesizer, SoundCategory::Strings, { SoundSubCategory::Electric,
276 : SoundSubCategory::Bass,
277 : SoundSubCategory::Plucked } } },
278 : { "bowed-synth", { SoundId::Synthesizer, SoundCategory::Strings, { SoundSubCategory::Electric,
279 : SoundSubCategory::Bowed } } },
280 : { "timple-canario", { SoundId::TimpleCanario, SoundCategory::Strings, { SoundSubCategory::Acoustic,
281 : SoundSubCategory::Nylon,
282 : SoundSubCategory::Spanish,
283 : SoundSubCategory::Plucked } } },
284 : { "timple-canario-tablature", { SoundId::TimpleCanario, SoundCategory::Strings, { SoundSubCategory::Acoustic,
285 : SoundSubCategory::Nylon,
286 : SoundSubCategory::Spanish,
287 : SoundSubCategory::Plucked } } },
288 286 : };
289 :
290 41 : auto search = SETUP_DATA_MAP.find(instrument->id().toStdString());
291 41 : if (search == SETUP_DATA_MAP.cend()) {
292 21 : static PlaybackSetupData empty;
293 21 : return empty;
294 : }
295 :
296 : static const std::unordered_set<SoundId> supportPrimaryAndSecondaryCategories {
297 : SoundId::Violin
298 22 : };
299 :
300 20 : if (muse::contains(supportPrimaryAndSecondaryCategories, search->second.soundId())) {
301 16 : SoundSubCategory category = instrument->isPrimary() ? SoundSubCategory::Primary : SoundSubCategory::Secondary;
302 16 : PlaybackSetupData setupData = search->second;
303 16 : setupData.add(category);
304 16 : return setupData;
305 16 : }
306 :
307 4 : return search->second;
308 122 : }
|