LCOV - code coverage report
Current view: top level - muse/framework/audio/common - workmode.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 20 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2025 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 "workmode.h"
      24              : 
      25              : #include "global/settings.h"
      26              : 
      27              : #include "muse_framework_config.h"
      28              : 
      29              : #include "log.h"
      30              : 
      31              : using namespace muse;
      32              : using namespace muse::audio;
      33              : 
      34              : workmode::Mode workmode::m_mode = workmode::Mode::Undefined;
      35              : workmode::Mode workmode::m_desiredMode = workmode::Mode::Undefined;
      36              : 
      37              : static const Settings::Key WORKMODE_KEY("audio", "dev/workmode");
      38              : 
      39            0 : void workmode::load()
      40              : {
      41            0 :     int val = settings()->value(WORKMODE_KEY).toInt();
      42            0 :     if (val > 0 && val <= 3) {
      43            0 :         m_mode = static_cast<Mode>(val);
      44              :     } else {
      45            0 :         m_mode = defaultMode();
      46              :     }
      47              : 
      48            0 :     if (m_mode == Mode::WorkerMode_NOT_SUPPORTED) {
      49            0 :         LOGW() << "WorkerMode is not supported, using HybridMode instead";
      50            0 :         m_mode = Mode::HybridMode;
      51              :     }
      52              : 
      53            0 :     m_desiredMode = m_mode;
      54            0 : }
      55              : 
      56            0 : workmode::Mode workmode::defaultMode()
      57              : {
      58            0 :     return static_cast<Mode>(MUSE_MODULE_AUDIO_WORKMODE);
      59              : }
      60              : 
      61            0 : workmode::Mode workmode::mode()
      62              : {
      63            0 :     return m_mode;
      64              : }
      65              : 
      66            0 : void workmode::setMode(Mode m)
      67              : {
      68              :     //! NOTE Need restart
      69            0 :     settings()->setLocalValue(WORKMODE_KEY, Val(static_cast<int>(m)));
      70            0 :     m_desiredMode = m;
      71            0 : }
      72              : 
      73            0 : workmode::Mode workmode::desiredMode()
      74              : {
      75            0 :     return m_desiredMode;
      76              : }
        

Generated by: LCOV version 2.0-1