LCOV - code coverage report
Current view: top level - src/engraving/playback/mapping - keyboardssetupdataresolver.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 8 8
Test Date: 2026-11-05 04:07:02

            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 "keyboardssetupdataresolver.h"
      24              : 
      25              : #include <unordered_set>
      26              : 
      27              : using namespace mu::engraving;
      28              : using namespace muse::mpe;
      29              : 
      30           46 : PlaybackSetupData KeyboardsSetupDataResolver::doResolve(const Instrument* instrument)
      31              : {
      32              :     static const std::unordered_map<std::string, PlaybackSetupData> SETUP_DATA_MAP = {
      33              :         { "celesta", { SoundId::Celesta, SoundCategory::Keyboards } },
      34              :         { "clavichord", { SoundId::Clavichord, SoundCategory::Keyboards, { SoundSubCategory::Baroque } } },
      35              :         { "clavinet", { SoundId::Clavichord, SoundCategory::Keyboards, { SoundSubCategory::Electric } } },
      36              :         { "ondes-martenot", { SoundId::OndesMartenot, SoundCategory::Keyboards, { SoundSubCategory::Electric } } },
      37              :         { "harpsichord", { SoundId::Harpsichord, SoundCategory::Keyboards } },
      38              :         { "virginal", { SoundId::Virginal, SoundCategory::Keyboards, { SoundSubCategory::Baroque } } },
      39              :         { "electric-piano", { SoundId::Piano, SoundCategory::Keyboards, { SoundSubCategory::Electric } } },
      40              :         { "grand-piano", { SoundId::Piano, SoundCategory::Keyboards, { SoundSubCategory::Grand } } },
      41              :         { "honky-tonk-piano", { SoundId::Piano, SoundCategory::Keyboards, { SoundSubCategory::HonkyTonk } } },
      42              :         { "piano", { SoundId::Piano, SoundCategory::Keyboards } },
      43              :         { "toy-piano", { SoundId::Piano, SoundCategory::Keyboards, { SoundSubCategory::Toy } } },
      44              :         { "upright-piano", { SoundId::Piano, SoundCategory::Keyboards, { SoundSubCategory::Upright } } },
      45              : 
      46              :         { "hammond-organ", { SoundId::Organ, SoundCategory::Keyboards, { SoundSubCategory::Hammond } } },
      47              :         { "organ", { SoundId::Organ, SoundCategory::Keyboards } },
      48              :         { "percussive-organ", { SoundId::Organ, SoundCategory::Keyboards, { SoundSubCategory::Percussive } } },
      49              :         { "pipe-organ", { SoundId::Organ, SoundCategory::Keyboards, { SoundSubCategory::Piped } } },
      50              :         { "rotary-organ", { SoundId::Organ, SoundCategory::Keyboards, { SoundSubCategory::Rotary } } },
      51              :         { "harmonium", { SoundId::Organ, SoundCategory::Keyboards, { SoundSubCategory::Reed } } },
      52              :         { "reed-organ", { SoundId::Organ, SoundCategory::Keyboards, { SoundSubCategory::Reed } } },
      53              : 
      54              :         { "brass-synthesizer", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      55              :                                                                                    SoundSubCategory::Brass } } },
      56              :         { "string-synthesizer", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      57              :                                                                                     SoundSubCategory::String } } },
      58              :         { "mallet-synthesizer", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric } } },
      59              :         { "atmosphere-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      60              :                                                                                   SoundSubCategory::FX_Atmosphere } } },
      61              :         { "brightness-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      62              :                                                                                   SoundSubCategory::FX_Brightness } } },
      63              :         { "crystal-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      64              :                                                                                SoundSubCategory::FX_Crystal } } },
      65              :         { "echoes-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      66              :                                                                               SoundSubCategory::FX_Echoes } } },
      67              :         { "goblins-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      68              :                                                                                SoundSubCategory::FX_Goblins } } },
      69              :         { "rain-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric, SoundSubCategory::FX_Rain } } },
      70              :         { "effect-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric, SoundSubCategory::FX_Atmosphere,
      71              :                                                                               SoundSubCategory::FX_Brightness, SoundSubCategory::FX_Crystal,
      72              :                                                                               SoundSubCategory::FX_Echoes, SoundSubCategory::FX_Goblins,
      73              :                                                                               SoundSubCategory::FX_Rain } } },
      74              :         { "sine-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      75              :                                                                             SoundSubCategory::Sine_Wave } } },
      76              :         { "square-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      77              :                                                                               SoundSubCategory::Square_Wave } } },
      78              :         { "saw-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      79              :                                                                            SoundSubCategory::Sawtooth_Wave } } },
      80              :         { "new-age-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      81              :                                                                                SoundSubCategory::NewAge } } },
      82              :         { "pad-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      83              :                                                                            SoundSubCategory::Pad } } },
      84              :         { "warm-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      85              :                                                                             SoundSubCategory::Warm } } },
      86              :         { "poly-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      87              :                                                                             SoundSubCategory::Polysynth } } },
      88              :         { "choir-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      89              :                                                                              SoundSubCategory::Choir } } },
      90              :         { "metallic-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      91              :                                                                                 SoundSubCategory::Metallic } } },
      92              :         { "halo-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      93              :                                                                             SoundSubCategory::Halo } } },
      94              :         { "sweep-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      95              :                                                                              SoundSubCategory::Sweep } } },
      96              :         { "soundtrack-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      97              :                                                                                   SoundSubCategory::FX_SoundTrack } } },
      98              :         { "sci-fi-synth", { SoundId::Synthesizer, SoundCategory::Keyboards, { SoundSubCategory::Electric,
      99              :                                                                               SoundSubCategory::FX_SciFi } } },
     100          133 :     };
     101              : 
     102           46 :     auto search = SETUP_DATA_MAP.find(instrument->id().toStdString());
     103           46 :     if (search == SETUP_DATA_MAP.cend()) {
     104           41 :         static PlaybackSetupData empty;
     105           41 :         return empty;
     106              :     }
     107              : 
     108            5 :     return search->second;
     109           43 : }
        

Generated by: LCOV version 2.0-1