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-19 04:14:36

            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 "muse_framework_config.h"
      26              : 
      27              : #ifndef NO_QT_SUPPORT
      28              : #include "global/settings.h"
      29              : #endif
      30              : 
      31              : #include "log.h"
      32              : 
      33              : using namespace muse;
      34              : using namespace muse::audio;
      35              : 
      36              : workmode::Mode workmode::m_mode = workmode::Mode::Undefined;
      37              : workmode::Mode workmode::m_desiredMode = workmode::Mode::Undefined;
      38              : 
      39              : //! NOTE Without Qt there are no settings, the default mode is used
      40              : #ifndef NO_QT_SUPPORT
      41              : static const Settings::Key WORKMODE_KEY("audio", "dev/workmode");
      42              : #endif
      43              : 
      44            0 : void workmode::load()
      45              : {
      46              : #ifndef NO_QT_SUPPORT
      47            0 :     int val = settings()->value(WORKMODE_KEY).toInt();
      48              : #else
      49              :     int val = 0;
      50              : #endif
      51            0 :     if (val > 0 && val <= 3) {
      52            0 :         m_mode = static_cast<Mode>(val);
      53              :     } else {
      54            0 :         m_mode = defaultMode();
      55              :     }
      56              : 
      57            0 :     if (m_mode == Mode::WorkerMode_NOT_SUPPORTED) {
      58            0 :         LOGW() << "WorkerMode is not supported, using HybridMode instead";
      59            0 :         m_mode = Mode::HybridMode;
      60              :     }
      61              : 
      62            0 :     m_desiredMode = m_mode;
      63            0 : }
      64              : 
      65            0 : workmode::Mode workmode::defaultMode()
      66              : {
      67            0 :     return static_cast<Mode>(MUSE_MODULE_AUDIO_WORKMODE);
      68              : }
      69              : 
      70            0 : workmode::Mode workmode::mode()
      71              : {
      72            0 :     return m_mode;
      73              : }
      74              : 
      75            0 : void workmode::setMode(Mode m)
      76              : {
      77              :     //! NOTE Need restart
      78              : #ifndef NO_QT_SUPPORT
      79            0 :     settings()->setLocalValue(WORKMODE_KEY, Val(static_cast<int>(m)));
      80              : #endif
      81            0 :     m_desiredMode = m;
      82            0 : }
      83              : 
      84            0 : workmode::Mode workmode::desiredMode()
      85              : {
      86            0 :     return m_desiredMode;
      87              : }
        

Generated by: LCOV version 2.0-1