LCOV - code coverage report
Current view: top level - src/importexport/midi/internal - midiconfiguration.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 40 0
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              : #include "midiconfiguration.h"
      23              : 
      24              : #include "settings.h"
      25              : 
      26              : #include "engraving/types/constants.h"
      27              : 
      28              : #include "midiimport/importmidi_operations.h"
      29              : 
      30              : using namespace mu;
      31              : using namespace muse;
      32              : using namespace mu::iex::midi;
      33              : 
      34              : static const Settings::Key SHORTEST_NOTE_KEY("iex_midi", "io/midi/shortestNote");
      35              : static const Settings::Key EXPORTRPNS_KEY("iex_midi", "io/midi/exportRPNs");
      36              : static const Settings::Key EXPAND_REPEATS_KEY("iex_midi", "io/midi/expandRepeats");
      37              : static const Settings::Key ROUND_TEMPO_KEY("iex_midi", "io/midi/roundTempo");
      38              : 
      39            0 : void MidiConfiguration::init()
      40              : {
      41            0 :     settings()->setDefaultValue(SHORTEST_NOTE_KEY, Val(mu::engraving::Constants::DIVISION / 4));
      42            0 :     settings()->valueChanged(SHORTEST_NOTE_KEY).onReceive(this, [this](const Val& val) {
      43            0 :         m_midiShortestNoteChanged.send(val.toInt());
      44            0 :     });
      45              : 
      46            0 :     settings()->setDefaultValue(ROUND_TEMPO_KEY, Val(true));
      47            0 :     settings()->valueChanged(ROUND_TEMPO_KEY).onReceive(this, [this](const Val& val) {
      48            0 :         m_roundTempoChanged.send(val.toBool());
      49            0 :     });
      50              : 
      51            0 :     settings()->setDefaultValue(EXPAND_REPEATS_KEY, Val(true));
      52            0 :     settings()->setDefaultValue(EXPORTRPNS_KEY, Val(true));
      53            0 : }
      54              : 
      55            0 : int MidiConfiguration::midiShortestNote() const
      56              : {
      57            0 :     return settings()->value(SHORTEST_NOTE_KEY).toInt();
      58              : }
      59              : 
      60            0 : void MidiConfiguration::setMidiShortestNote(int ticks)
      61              : {
      62            0 :     settings()->setSharedValue(SHORTEST_NOTE_KEY, Val(ticks));
      63            0 : }
      64              : 
      65            0 : async::Channel<int> MidiConfiguration::midiShortestNoteChanged() const
      66              : {
      67            0 :     return m_midiShortestNoteChanged;
      68              : }
      69              : 
      70            0 : bool MidiConfiguration::roundTempo() const
      71              : {
      72            0 :     return settings()->value(ROUND_TEMPO_KEY).toBool();
      73              : }
      74              : 
      75            0 : void MidiConfiguration::setRoundTempo(bool round)
      76              : {
      77            0 :     settings()->setSharedValue(ROUND_TEMPO_KEY, Val(round));
      78            0 : }
      79              : 
      80            0 : async::Channel<bool> MidiConfiguration::roundTempoChanged() const
      81              : {
      82            0 :     return m_roundTempoChanged;
      83              : }
      84              : 
      85            0 : void MidiConfiguration::setMidiImportOperationsFile(const std::optional<muse::io::path_t>& filePath) const
      86              : {
      87            0 :     if (filePath) {
      88            0 :         midiImportOperations.setOperationsFile(filePath.value().toQString());
      89              :     }
      90            0 : }
      91              : 
      92            0 : bool MidiConfiguration::isExpandRepeats() const
      93              : {
      94            0 :     return settings()->value(EXPAND_REPEATS_KEY).toBool();
      95              : }
      96              : 
      97            0 : void MidiConfiguration::setExpandRepeats(bool expand)
      98              : {
      99            0 :     settings()->setSharedValue(EXPAND_REPEATS_KEY, Val(expand));
     100            0 : }
     101              : 
     102            0 : bool MidiConfiguration::isMidiExportRpns() const
     103              : {
     104            0 :     return settings()->value(EXPORTRPNS_KEY).toBool();
     105              : }
     106              : 
     107            0 : void MidiConfiguration::setIsMidiExportRpns(bool exportRpns)
     108              : {
     109            0 :     settings()->setSharedValue(EXPORTRPNS_KEY, Val(exportRpns));
     110            0 : }
        

Generated by: LCOV version 2.0-1