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 "percussionssetupdataresolver.h"
24 :
25 : using namespace mu::engraving;
26 : using namespace muse;
27 : using namespace muse::mpe;
28 :
29 11 : PlaybackSetupData PercussionsSetupDataResolver::doResolve(const Instrument* instrument)
30 : {
31 : static const std::unordered_map<std::string, mpe::PlaybackSetupData> SETUP_DATA_MAP = {
32 : { "timpani", { SoundId::Timpani, SoundCategory::Percussions } },
33 : { "roto-toms", { SoundId::RotoToms, SoundCategory::Percussions } },
34 : { "tubaphone", { SoundId::Tubaphone, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
35 : { "soprano-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
36 : SoundSubCategory::Steel,
37 : SoundSubCategory::Soprano } } },
38 : { "alto-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
39 : SoundSubCategory::Steel,
40 : SoundSubCategory::Alto } } },
41 : { "tenor-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
42 : SoundSubCategory::Steel,
43 : SoundSubCategory::Tenor } } },
44 : { "guitar-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
45 : SoundSubCategory::Steel } } },
46 : { "cello-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
47 : SoundSubCategory::Steel } } },
48 : { "cello-steel-drums-four", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
49 : SoundSubCategory::Steel,
50 : SoundSubCategory::FourPiece } } },
51 : { "tenor-bass-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
52 : SoundSubCategory::Steel,
53 : SoundSubCategory::Tenor,
54 : SoundSubCategory::Bass } } },
55 : { "steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
56 : SoundSubCategory::Steel } } },
57 : { "bass-steel-drums", { SoundId::SteelDrums, SoundCategory::Percussions, { SoundSubCategory::Metal,
58 : SoundSubCategory::Steel,
59 : SoundSubCategory::Bass } } },
60 : { "glockenspiel", { SoundId::Glockenspiel, SoundCategory::Percussions } },
61 : { "xylophone", { SoundId::Xylophone, SoundCategory::Percussions } },
62 : { "xylomarimba", { SoundId::Xylomarimba, SoundCategory::Percussions } },
63 : { "vibraphone", { SoundId::Vibraphone, SoundCategory::Percussions } },
64 : { "dulcimer", { SoundId::Dulcimer, SoundCategory::Percussions } },
65 : { "cimbalom", { SoundId::Cimbalom, SoundCategory::Percussions } },
66 : { "marimba", { SoundId::Marimba, SoundCategory::Percussions } },
67 : { "marimba-single", { SoundId::Marimba, SoundCategory::Percussions } },
68 : { "bass-marimba", { SoundId::Marimba, SoundCategory::Percussions, { SoundSubCategory::Bass } } },
69 : { "contrabass-marimba", { SoundId::Marimba, SoundCategory::Percussions, { SoundSubCategory::Contra_Bass } } },
70 :
71 : { "crotales", { SoundId::Crotales, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
72 : { "almglocken", { SoundId::Kalimba, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
73 : { "tubular-bells", { SoundId::Chimes, SoundCategory::Percussions } },
74 : { "carillon", { SoundId::Carillon, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
75 : { "tuned-gongs", { SoundId::Gong, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
76 : { "opera-gong", { SoundId::Gong, SoundCategory::Percussions, { SoundSubCategory::Metal,
77 : SoundSubCategory::Opera } } },
78 : { "wind-gong", { SoundId::Gong, SoundCategory::Percussions, { SoundSubCategory::Metal,
79 : SoundSubCategory::Wind } } },
80 : { "hand-bells", { SoundId::Bell, SoundCategory::Percussions, { SoundSubCategory::Hand } } },
81 : { "hand-chimes", { SoundId::Chimes, SoundCategory::Percussions, { SoundSubCategory::Hand } } },
82 :
83 : { "orff-soprano-glockenspiel", { SoundId::Glockenspiel, SoundCategory::Percussions, { SoundSubCategory::Soprano,
84 : SoundSubCategory::Orff } } },
85 : { "orff-alto-glockenspiel", { SoundId::Glockenspiel, SoundCategory::Percussions, { SoundSubCategory::Alto,
86 : SoundSubCategory::Orff } } },
87 : { "orff-soprano-metallophone", { SoundId::Metallophone, SoundCategory::Percussions, { SoundSubCategory::Soprano,
88 : SoundSubCategory::Orff } } },
89 : { "orff-soprano-xylophone", { SoundId::Xylophone, SoundCategory::Percussions, { SoundSubCategory::Soprano,
90 : SoundSubCategory::Orff } } },
91 : { "metallophone", { SoundId::Metallophone, SoundCategory::Percussions, { SoundSubCategory::Orff } } },
92 : { "orff-alto-metallophone", { SoundId::Metallophone, SoundCategory::Percussions, { SoundSubCategory::Alto,
93 : SoundSubCategory::Orff } } },
94 : { "orff-alto-xylophone", { SoundId::Xylophone, SoundCategory::Percussions, { SoundSubCategory::Alto,
95 : SoundSubCategory::Orff } } },
96 : { "orff-bass-metallophone", { SoundId::Metallophone, SoundCategory::Percussions, { SoundSubCategory::Bass,
97 : SoundSubCategory::Orff } } },
98 : { "orff-bass-xylophone", { SoundId::Xylophone, SoundCategory::Percussions, { SoundSubCategory::Bass,
99 : SoundSubCategory::Orff } } },
100 :
101 : { "flexatone", { SoundId::Flexatone, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
102 : { "musical-saw", { SoundId::MusicalSaw, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
103 :
104 : { "musical-glasses", { SoundId::MusicalGlasses, SoundCategory::Percussions, { SoundSubCategory::Glass } } },
105 : { "glass-harmonica", { SoundId::Harmonica, SoundCategory::Percussions, { SoundSubCategory::Glass } } },
106 :
107 : { "alto-kalimba", { SoundId::Kalimba, SoundCategory::Percussions, { SoundSubCategory::Alto } } },
108 : { "kalimba", { SoundId::Kalimba, SoundCategory::Percussions } },
109 : { "treble-kalimba", { SoundId::Kalimba, SoundCategory::Percussions, { SoundSubCategory::Treble } } },
110 :
111 : { "automobile-brake-drums", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Metal,
112 : SoundSubCategory::Brake } } },
113 : { "bongos", { SoundId::Bongos, SoundCategory::Percussions } },
114 : { "chinese-tom-toms", { SoundId::TomToms, SoundCategory::Percussions, { SoundSubCategory::Chinese } } },
115 : { "bass-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Bass } } },
116 : { "snare-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Snare } } },
117 : { "tom-toms", { SoundId::TomToms, SoundCategory::Percussions } },
118 : { "ko-tsuzumi", { SoundId::KoTsuzumi, SoundCategory::Percussions } },
119 : { "o-tsuzumi", { SoundId::OTsuzumi, SoundCategory::Percussions } },
120 : { "kakko", { SoundId::Kakko, SoundCategory::Percussions } },
121 : { "shime-daiko", { SoundId::ShimeDaiko, SoundCategory::Percussions } },
122 : { "miya-daiko", { SoundId::MiyaDaiko, SoundCategory::Percussions } },
123 : { "tsuri-daiko", { SoundId::TsuriDaiko, SoundCategory::Percussions } },
124 : { "okedo-daiko", { SoundId::OkedoDaiko, SoundCategory::Percussions } },
125 : { "kane", { SoundId::Kane, SoundCategory::Percussions } },
126 : { "shoko", { SoundId::Shoko, SoundCategory::Percussions } },
127 : { "congas", { SoundId::Conga, SoundCategory::Percussions } },
128 : { "xiaogu", { SoundId::Xiaogu, SoundCategory::Percussions } },
129 : { "bangu", { SoundId::Bangu, SoundCategory::Percussions } },
130 : { "dagu", { SoundId::Dagu, SoundCategory::Percussions } },
131 : { "daluo", { SoundId::Daluo, SoundCategory::Percussions } },
132 : { "xiaoluo", { SoundId::Xiaoluo, SoundCategory::Percussions } },
133 : { "ban", { SoundId::Ban, SoundCategory::Percussions } },
134 : { "dabo", { SoundId::Dabo, SoundCategory::Percussions } },
135 : { "naobo", { SoundId::Naobo, SoundCategory::Percussions } },
136 : { "bangzi", { SoundId::Bangzi, SoundCategory::Percussions } },
137 : { "janggu", { SoundId::Janggu, SoundCategory::Percussions } },
138 : { "samul-janggu", { SoundId::SamulJanggu, SoundCategory::Percussions, { SoundSubCategory::Korean } } },
139 : { "sanjo-janggu", { SoundId::SanjoJanggu, SoundCategory::Percussions, { SoundSubCategory::Korean } } },
140 : { "buk", { SoundId::Buk, SoundCategory::Percussions } },
141 : { "samul-buk", { SoundId::SamulBuk, SoundCategory::Percussions, { SoundSubCategory::Korean } } },
142 : { "sori-buk", { SoundId::SoriBuk, SoundCategory::Percussions, { SoundSubCategory::Korean } } },
143 : { "sogo", { SoundId::Sogo, SoundCategory::Percussions } },
144 : { "kkwaenggwari", { SoundId::Kkwaenggwari, SoundCategory::Percussions } },
145 : { "jing", { SoundId::Jing, SoundCategory::Percussions } },
146 : { "djembe", { SoundId::Djembe, SoundCategory::Percussions } },
147 : { "doumbek", { SoundId::Doumbek, SoundCategory::Percussions } },
148 : { "cuica", { SoundId::Cuica, SoundCategory::Percussions } },
149 : { "cajon", { SoundId::Cajon, SoundCategory::Percussions } },
150 : { "drumset", { SoundId::Drumset, SoundCategory::Percussions } },
151 : { "drum-kit-4", { SoundId::Drumset, SoundCategory::Percussions, { SoundSubCategory::FourPiece } } },
152 : { "drum-kit-5", { SoundId::Drumset, SoundCategory::Percussions, { SoundSubCategory::FivePiece } } },
153 : { "military-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Military } } },
154 : { "frame-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Frame } } },
155 : { "piccolo-snare-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Snare,
156 : SoundSubCategory::Piccolo } } },
157 : { "slit-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Slit } } },
158 : { "tablas", { SoundId::Tablas, SoundCategory::Percussions, { SoundSubCategory::Indian } } },
159 : { "timbales", { SoundId::Timbales, SoundCategory::Percussions } },
160 :
161 : { "anvil", { SoundId::Anvil, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
162 : { "bell-plate", { SoundId::Bell, SoundCategory::Percussions, { SoundSubCategory::Plate,
163 : SoundSubCategory::Metal } } },
164 : { "bell-tree", { SoundId::BellTree, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
165 : { "bells", { SoundId::Bell, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
166 : { "bowl-gongs", { SoundId::Gong, SoundCategory::Percussions, { SoundSubCategory::Metal,
167 : SoundSubCategory::Bowl } } },
168 : { "chains", { SoundId::Chain, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
169 : { "china-cymbal", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Metal,
170 : SoundSubCategory::China } } },
171 : { "cowbell", { SoundId::Bell, SoundCategory::Percussions, { SoundSubCategory::Metal,
172 : SoundSubCategory::Cow } } },
173 : { "agogo-bells", { SoundId::Bell, SoundCategory::Percussions, { SoundSubCategory::Metal,
174 : SoundSubCategory::Agogo } } },
175 : { "crash-cymbal", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Metal,
176 : SoundSubCategory::Crash } } },
177 : { "cymbal", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
178 : { "finger-cymbals", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Metal,
179 : SoundSubCategory::Finger } } },
180 : { "hi-hat", { SoundId::HiHat, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
181 : { "iron-pipes", { SoundId::Pipe, SoundCategory::Percussions, { SoundSubCategory::Metal,
182 : SoundSubCategory::Iron } } },
183 : { "mark-tree", { SoundId::MarkTree, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
184 : { "metal-castanets", { SoundId::Castanet, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
185 : { "metal-wind-chimes", { SoundId::Chimes, SoundCategory::Percussions, { SoundSubCategory::Metal,
186 : SoundSubCategory::Wind } } },
187 : { "ride-cymbal", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Metal,
188 : SoundSubCategory::Ride } } },
189 : { "sleigh-bells", { SoundId::Bell, SoundCategory::Percussions, { SoundSubCategory::Metal,
190 : SoundSubCategory::Sleigh } } },
191 : { "splash-cymbal", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Metal,
192 : SoundSubCategory::Splash } } },
193 : { "tam-tam", { SoundId::TamTam, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
194 : { "thundersheet", { SoundId::Thundersheet, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
195 : { "triangle", { SoundId::Triangle, SoundCategory::Percussions, { SoundSubCategory::Metal } } },
196 :
197 : { "castanets", { SoundId::Castanet, SoundCategory::Percussions, { SoundSubCategory::Wooden } } },
198 : { "claves", { SoundId::Claves, SoundCategory::Percussions, { SoundSubCategory::Wooden } } },
199 : { "guiro", { SoundId::Guiro, SoundCategory::Percussions, { SoundSubCategory::Wooden } } },
200 : { "temple-blocks", { SoundId::Block, SoundCategory::Percussions, { SoundSubCategory::Wooden,
201 : SoundSubCategory::Temple } } },
202 : { "log-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Wooden,
203 : SoundSubCategory::Log } } },
204 : { "ocean-drum", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Ocean } } },
205 : { "wood-blocks", { SoundId::Block, SoundCategory::Percussions, { SoundSubCategory::Wooden } } },
206 : { "wooden-wind-chimes", { SoundId::Chimes, SoundCategory::Percussions, { SoundSubCategory::Wooden,
207 : SoundSubCategory::Wind } } },
208 : { "bamboo-wind-chimes", { SoundId::Chimes, SoundCategory::Percussions, { SoundSubCategory::Wooden,
209 : SoundSubCategory::Wind } } },
210 :
211 : { "cabasa", { SoundId::Cabasa, SoundCategory::Percussions } },
212 : { "maracas", { SoundId::Maraca, SoundCategory::Percussions } },
213 : { "quijada", { SoundId::Quijada, SoundCategory::Percussions } },
214 : { "ratchet", { SoundId::Ratchet, SoundCategory::Percussions } },
215 : { "shaker", { SoundId::Shaker, SoundCategory::Percussions } },
216 : { "shekere", { SoundId::Shekere, SoundCategory::Percussions } },
217 : { "sandpaper-blocks", { SoundId::Block, SoundCategory::Percussions, { SoundSubCategory::Sandpaper } } },
218 : { "glass-wind-chimes", { SoundId::Chimes, SoundCategory::Percussions, { SoundSubCategory::Glass,
219 : SoundSubCategory::Wind } } },
220 : { "shell-wind-chimes", { SoundId::Chimes, SoundCategory::Percussions, { SoundSubCategory::Shell,
221 : SoundSubCategory::Wind } } },
222 : { "percussion", { SoundId::Drumset, SoundCategory::Percussions, { SoundSubCategory::Orchestral } } },
223 : { "stones", { SoundId::Stones, SoundCategory::Percussions } },
224 : { "tambourine", { SoundId::Tambourine, SoundCategory::Percussions } },
225 : { "tubo", { SoundId::Tubo, SoundCategory::Percussions } },
226 : { "vibraslap", { SoundId::Vibraslap, SoundCategory::Percussions } },
227 : { "whip", { SoundId::Whip, SoundCategory::Percussions } },
228 : { "cannon", { SoundId::Cannon, SoundCategory::Percussions } },
229 : { "bird-call", { SoundId::BirdCall, SoundCategory::Percussions } },
230 :
231 : { "marching-snare", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Marching,
232 : SoundSubCategory::Snare } } },
233 : { "marching-tenor-drums", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Marching,
234 : SoundSubCategory::Snare,
235 : SoundSubCategory::Tenor } } },
236 : { "marching-show-tenors", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Show_Style,
237 : SoundSubCategory::Snare,
238 : SoundSubCategory::Tenor } } },
239 : { "marching-bass-drums", { SoundId::Drum, SoundCategory::Percussions, { SoundSubCategory::Marching,
240 : SoundSubCategory::Snare,
241 : SoundSubCategory::Bass } } },
242 : { "marching-cymbals", { SoundId::Cymbal, SoundCategory::Percussions, { SoundSubCategory::Marching,
243 : SoundSubCategory::Metal,
244 : SoundSubCategory::Crash } } },
245 :
246 : { "finger-snap", { SoundId::Snap, SoundCategory::Percussions, { SoundSubCategory::Finger } } },
247 : { "hand-clap", { SoundId::Clap, SoundCategory::Percussions, { SoundSubCategory::Hand } } },
248 : { "slap", { SoundId::Slap, SoundCategory::Percussions, { SoundSubCategory::Hand } } },
249 : { "stamp", { SoundId::Stamp, SoundCategory::Percussions, { SoundSubCategory::Foot } } },
250 :
251 : { "taiko", { SoundId::Taiko, SoundCategory::Percussions } },
252 :
253 : { "percussion-synthesizer", { SoundId::Synthesizer, SoundCategory::Percussions, { SoundSubCategory::Electric,
254 : SoundSubCategory::Percussive } } },
255 322 : };
256 :
257 11 : auto search = SETUP_DATA_MAP.find(instrument->id().toStdString());
258 11 : if (search == SETUP_DATA_MAP.cend()) {
259 3 : if (instrument->useDrumset()) {
260 0 : LOGW() << "Unable to resolve setup data for instrument, id: " << instrument->id()
261 0 : << ", family: " << instrument->family() << "; fallback to drumset";
262 :
263 : static const PlaybackSetupData DRUMSET_FALLBACK {
264 : SoundId::Drumset, SoundCategory::Percussions
265 0 : };
266 :
267 0 : return DRUMSET_FALLBACK;
268 : }
269 :
270 3 : static const PlaybackSetupData empty;
271 3 : return empty;
272 : }
273 :
274 8 : return search->second;
275 155 : }
|