LCOV - code coverage report
Current view: top level - src/engraving/playback/metaparsers/internal - arpeggiometaparser.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 94.4 % 36 34
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 "arpeggiometaparser.h"
      24              : 
      25              : #include "dom/arpeggio.h"
      26              : 
      27              : using namespace mu::engraving;
      28              : using namespace muse;
      29              : 
      30           13 : void ArpeggioMetaParser::doParse(const EngravingItem* item, const RenderingContext& ctx, mpe::ArticulationMap& result)
      31              : {
      32           13 :     IF_ASSERT_FAILED(item->isArpeggio()) {
      33            1 :         return;
      34              :     }
      35              : 
      36           13 :     const Arpeggio* arpeggio = toArpeggio(item);
      37              : 
      38           13 :     if (!arpeggio->playArpeggio()) {
      39            0 :         return;
      40              :     }
      41              : 
      42           13 :     mpe::ArticulationType type = mpe::ArticulationType::Undefined;
      43              : 
      44           13 :     switch (arpeggio->arpeggioType()) {
      45            1 :     case ArpeggioType::NORMAL:
      46            1 :         type = mpe::ArticulationType::Arpeggio;
      47            1 :         break;
      48            8 :     case ArpeggioType::UP:
      49            8 :         type = mpe::ArticulationType::ArpeggioUp;
      50            8 :         break;
      51            1 :     case ArpeggioType::DOWN:
      52            1 :         type = mpe::ArticulationType::ArpeggioDown;
      53            1 :         break;
      54            1 :     case ArpeggioType::DOWN_STRAIGHT:
      55            1 :         type = mpe::ArticulationType::ArpeggioStraightDown;
      56            1 :         break;
      57            1 :     case ArpeggioType::UP_STRAIGHT:
      58            1 :         type = mpe::ArticulationType::ArpeggioStraightUp;
      59            1 :         break;
      60            1 :     default:
      61            1 :         break;
      62              :     }
      63              : 
      64           13 :     if (type == mpe::ArticulationType::Undefined) {
      65            1 :         return;
      66              :     }
      67              : 
      68           12 :     const mpe::ArticulationPattern& pattern = ctx.profile->pattern(type);
      69           12 :     if (pattern.empty()) {
      70            0 :         return;
      71              :     }
      72              : 
      73           24 :     mpe::ArticulationMeta articulationMeta;
      74           12 :     articulationMeta.type = type;
      75           12 :     articulationMeta.pattern = pattern;
      76           12 :     articulationMeta.timestamp = ctx.nominalTimestamp;
      77           12 :     articulationMeta.overallDuration = ctx.nominalDuration * arpeggio->Stretch();
      78              : 
      79           12 :     appendArticulationData(std::move(articulationMeta), result);
      80              : }
        

Generated by: LCOV version 2.0-1