LCOV - code coverage report
Current view: top level - muse/framework/audio/engine/internal/fx - fxresolver.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 51 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) 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 "fxresolver.h"
      24              : 
      25              : #include "audio/common/audiosanitizer.h"
      26              : 
      27              : #include "log.h"
      28              : 
      29              : using namespace muse::async;
      30              : using namespace muse::audio;
      31              : using namespace muse::audio::fx;
      32              : 
      33            0 : std::vector<IFxProcessorPtr> FxResolver::resolveMasterFxList(const AudioFxChain& fxChain, const OutputSpec& outputSpec)
      34              : {
      35              :     ONLY_AUDIO_ENGINE_THREAD;
      36              : 
      37            0 :     TRACEFUNC;
      38              : 
      39            0 :     std::lock_guard lock(m_mutex);
      40              : 
      41            0 :     std::vector<IFxProcessorPtr> result;
      42              : 
      43            0 :     for (const auto& resolver : m_resolvers) {
      44            0 :         AudioFxChain fxChainByType;
      45              : 
      46            0 :         for (const auto& fx : fxChain) {
      47            0 :             if (resolver.first == fx.second.type() || fx.second.type() == AudioFxType::Undefined) {
      48            0 :                 fxChainByType.insert(fx);
      49              :             }
      50              :         }
      51              : 
      52            0 :         if (fxChainByType.empty()) {
      53            0 :             continue;
      54              :         }
      55              : 
      56            0 :         std::vector<IFxProcessorPtr> fxList = resolver.second->resolveMasterFxList(std::move(fxChainByType), outputSpec);
      57            0 :         result.insert(result.end(), fxList.begin(), fxList.end());
      58            0 :     }
      59              : 
      60            0 :     return result;
      61            0 : }
      62              : 
      63            0 : std::vector<IFxProcessorPtr> FxResolver::resolveFxList(const TrackId trackId, const AudioFxChain& fxChain, const OutputSpec& outputSpec)
      64              : {
      65              :     ONLY_AUDIO_ENGINE_THREAD;
      66              : 
      67            0 :     TRACEFUNC;
      68              : 
      69            0 :     std::lock_guard lock(m_mutex);
      70              : 
      71            0 :     std::vector<IFxProcessorPtr> result;
      72              : 
      73            0 :     for (const auto& resolver : m_resolvers) {
      74            0 :         AudioFxChain fxChainByType;
      75              : 
      76            0 :         for (const auto& fx : fxChain) {
      77            0 :             if (resolver.first == fx.second.type() || fx.second.type() == AudioFxType::Undefined) {
      78            0 :                 fxChainByType.insert(fx);
      79              :             }
      80              :         }
      81              : 
      82            0 :         if (fxChainByType.empty()) {
      83            0 :             continue;
      84              :         }
      85              : 
      86            0 :         std::vector<IFxProcessorPtr> fxList = resolver.second->resolveFxList(trackId, std::move(fxChainByType), outputSpec);
      87            0 :         result.insert(result.end(), fxList.begin(), fxList.end());
      88            0 :     }
      89              : 
      90            0 :     return result;
      91            0 : }
      92              : 
      93            0 : AudioResourceMetaList FxResolver::resolveAvailableResources() const
      94              : {
      95              :     ONLY_AUDIO_ENGINE_THREAD;
      96              : 
      97            0 :     TRACEFUNC;
      98              : 
      99            0 :     std::lock_guard lock(m_mutex);
     100              : 
     101            0 :     AudioResourceMetaList result;
     102              : 
     103            0 :     for (const auto& pair : m_resolvers) {
     104            0 :         const AudioResourceMetaList& resolvedResources = pair.second->resolveResources();
     105            0 :         result.insert(result.end(), resolvedResources.begin(), resolvedResources.end());
     106            0 :     }
     107              : 
     108            0 :     return result;
     109            0 : }
     110              : 
     111            0 : void FxResolver::registerResolver(const AudioFxType type, IResolverPtr resolver)
     112              : {
     113              :     ONLY_AUDIO_MAIN_OR_ENGINE_THREAD;
     114              : 
     115            0 :     std::lock_guard lock(m_mutex);
     116              : 
     117            0 :     m_resolvers.insert_or_assign(type, std::move(resolver));
     118            0 : }
     119              : 
     120            0 : void FxResolver::clearAllFx()
     121              : {
     122              :     ONLY_AUDIO_MAIN_OR_ENGINE_THREAD;
     123              : 
     124            0 :     std::lock_guard lock(m_mutex);
     125              : 
     126            0 :     for (auto it = m_resolvers.begin(); it != m_resolvers.end(); ++it) {
     127            0 :         it->second->clearAllFx();
     128              :     }
     129            0 : }
        

Generated by: LCOV version 2.0-1