LCOV - code coverage report
Current view: top level - src/playback - playbackmodule.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 43 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              : 
      23              : #include "playbackmodule.h"
      24              : 
      25              : #include "modularity/ioc.h"
      26              : 
      27              : #include "rcommand/icommandsregister.h"
      28              : #include "rcommand/icommandsstate.h"
      29              : #include "interactive/iinteractiveuriregister.h"
      30              : 
      31              : #include "internal/playbackcontroller.h"
      32              : #include "internal/playbackcommandsregister.h"
      33              : #include "internal/playbackcommandsstate.h"
      34              : #include "internal/playbackconfiguration.h"
      35              : #include "internal/soundprofilesrepository.h"
      36              : #include "internal/knownaudiopluginsconfigurator.h"
      37              : #include "internal/playbackcommandscontroller.h"
      38              : 
      39              : using namespace mu::playback;
      40              : using namespace muse;
      41              : using namespace muse::modularity;
      42              : 
      43              : static const std::string mname("playback");
      44              : 
      45            0 : std::string PlaybackModule::moduleName() const
      46              : {
      47            0 :     return mname;
      48              : }
      49              : 
      50            0 : void PlaybackModule::registerExports()
      51              : {
      52            0 :     m_configuration = std::make_shared<PlaybackConfiguration>();
      53              : 
      54            0 :     globalIoc()->registerExport<IPlaybackConfiguration>(mname, m_configuration);
      55            0 : }
      56              : 
      57            0 : void PlaybackModule::resolveImports()
      58              : {
      59            0 :     auto ir = globalIoc()->resolve<muse::interactive::IInteractiveUriRegister>(mname);
      60            0 :     if (ir) {
      61            0 :         ir->registerQmlUri(Uri("musescore://playback/soundprofiles"), "MuseScore.Playback", "SoundProfilesDialog");
      62              :     }
      63              : 
      64            0 :     auto cr = globalIoc()->resolve<muse::rcommand::ICommandsRegister>(mname);
      65            0 :     if (cr) {
      66            0 :         cr->reg(std::make_shared<PlaybackCommandsRegister>());
      67              :     }
      68              : 
      69              :     // must run before the audioplugins cache loads in onInit
      70            0 :     KnownAudioPluginsConfigurator().init();
      71            0 : }
      72              : 
      73            0 : void PlaybackModule::onInit(const IApplication::RunMode&)
      74              : {
      75            0 :     m_configuration->init();
      76            0 : }
      77              : 
      78            0 : IContextSetup* PlaybackModule::newContext(const muse::modularity::ContextPtr& ctx) const
      79              : {
      80            0 :     return new PlaybackContext(ctx);
      81              : }
      82              : 
      83            0 : void PlaybackContext::registerExports()
      84              : {
      85            0 :     m_commandsController = std::make_shared<PlaybackCommandsController>(iocContext());
      86            0 :     m_playbackController = std::make_shared<PlaybackController>(iocContext());
      87            0 :     m_soundProfileRepo = std::make_shared<SoundProfilesRepository>(iocContext());
      88              : 
      89            0 :     ioc()->registerExport<IPlaybackCommandsController>(mname, m_commandsController);
      90            0 :     ioc()->registerExport<IPlaybackController>(mname, m_playbackController);
      91            0 :     ioc()->registerExport<IPlaybackState>(mname, m_playbackController);
      92            0 :     ioc()->registerExport<ISoundProfilesRepository>(mname, m_soundProfileRepo);
      93            0 : }
      94              : 
      95            0 : void PlaybackContext::resolveImports()
      96              : {
      97            0 :     auto cs = ioc()->resolve<muse::rcommand::ICommandsState>(mname);
      98            0 :     if (cs) {
      99            0 :         cs->reg(std::make_shared<PlaybackCommandsState>(iocContext()));
     100              :     }
     101            0 : }
     102              : 
     103            0 : void PlaybackContext::onInit(const IApplication::RunMode& mode)
     104              : {
     105            0 :     m_playbackController->init();
     106            0 :     m_commandsController->init();
     107              : 
     108            0 :     if (mode != IApplication::RunMode::GuiApp) {
     109            0 :         return;
     110              :     }
     111              : 
     112            0 :     m_soundProfileRepo->init();
     113              : }
     114              : 
     115            0 : void PlaybackContext::onDeinit()
     116              : {
     117            0 :     m_playbackController->deinit();
     118            0 : }
        

Generated by: LCOV version 2.0-1