LCOV - code coverage report
Current view: top level - src/project - iprojectaudiosettings.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 22 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              : #pragma once
      24              : 
      25              : #include <memory>
      26              : 
      27              : #include "async/notification.h"
      28              : #include "audio/common/audiotypes.h"
      29              : #include "engraving/types/types.h"
      30              : #include "playback/playbacktypes.h"
      31              : #include "notation/inotationsolomutestate.h"
      32              : 
      33              : namespace mu::project {
      34              : using AudioInputParams = muse::audio::AudioInputParams;
      35              : using TrackInputParamsMap = std::unordered_map<engraving::InstrumentTrackId, AudioInputParams>;
      36              : 
      37              : //! NOTE This model (structure) is not used in the audio module, there are other models.
      38              : struct AudioOutputParams {
      39              :     muse::audio::AudioFxChain fxChain;
      40              :     muse::audio::volume_db_t volume = 0.f;
      41              :     muse::audio::balance_t balance = 0.f;
      42              :     muse::audio::AuxSendsParams auxSends;
      43              :     bool solo = false;
      44              :     bool muted = false;
      45              :     bool forceMute = false;
      46              : 
      47            0 :     bool operator ==(const AudioOutputParams& other) const
      48              :     {
      49            0 :         return fxChain == other.fxChain
      50            0 :                && muse::is_equal(volume, other.volume)
      51            0 :                && muse::is_equal(balance, other.balance)
      52            0 :                && auxSends == other.auxSends
      53            0 :                && solo == other.solo
      54            0 :                && muted == other.muted
      55            0 :                && forceMute == other.forceMute;
      56              :     }
      57              : 
      58            0 :     muse::audio::ControlParams control() const
      59              :     {
      60            0 :         muse::audio::ControlParams control;
      61            0 :         control.volume = volume;
      62            0 :         control.balance = balance;
      63            0 :         control.muted = muted;
      64            0 :         return control;
      65              :     }
      66              : 
      67            0 :     void setControl(const muse::audio::ControlParams& control)
      68              :     {
      69            0 :         if (!control.volume.hasAutomation()) {
      70            0 :             volume = std::get<muse::audio::volume_db_t>(control.volume.value());
      71              :         }
      72            0 :         if (!control.balance.hasAutomation()) {
      73            0 :             balance = std::get<muse::audio::balance_t>(control.balance.value());
      74              :         }
      75            0 :         muted = control.muted;
      76            0 :     }
      77              : };
      78              : 
      79              : class IProjectAudioSettings
      80              : {
      81              : public:
      82              :     using SoloMuteState = notation::INotationSoloMuteState::SoloMuteState;
      83              : 
      84            0 :     virtual ~IProjectAudioSettings() = default;
      85              : 
      86              :     virtual bool hasAnyAudioSettings() const = 0;
      87              : 
      88              :     virtual const AudioOutputParams& masterAudioOutputParams() const = 0;
      89              :     virtual void setMasterAudioOutputParams(const AudioOutputParams& params) = 0;
      90              : 
      91              :     virtual bool containsAuxOutputParams(muse::audio::aux_channel_idx_t index) const = 0;
      92              :     virtual const AudioOutputParams& auxOutputParams(muse::audio::aux_channel_idx_t index) const = 0;
      93              :     virtual void setAuxOutputParams(muse::audio::aux_channel_idx_t index, const AudioOutputParams& params,
      94              :                                     bool notifySettingsChanged = true) = 0;
      95              : 
      96              :     virtual const TrackInputParamsMap& allTrackInputParams() const = 0;
      97              :     virtual const AudioInputParams& trackInputParams(const engraving::InstrumentTrackId& trackId) const = 0;
      98              :     virtual void setTrackInputParams(const engraving::InstrumentTrackId& trackId, const AudioInputParams& params,
      99              :                                      bool notifySettingsChanged = true) = 0;
     100              :     virtual void clearTrackInputParams() = 0;
     101              :     virtual muse::async::Channel<engraving::InstrumentTrackId> trackInputParamsChanged() const = 0;
     102              : 
     103              :     virtual bool trackHasExistingOutputParams(const engraving::InstrumentTrackId& trackId) const = 0;
     104              :     virtual const AudioOutputParams& trackOutputParams(const engraving::InstrumentTrackId& trackId) const = 0;
     105              :     virtual void setTrackOutputParams(const engraving::InstrumentTrackId& trackId, const AudioOutputParams& params,
     106              :                                       bool notifySettingsChanged = true) = 0;
     107              : 
     108              :     virtual const SoloMuteState& auxSoloMuteState(muse::audio::aux_channel_idx_t index) const = 0;
     109              :     virtual void setAuxSoloMuteState(muse::audio::aux_channel_idx_t index, const SoloMuteState& state) = 0;
     110              :     virtual muse::async::Channel<muse::audio::aux_channel_idx_t, SoloMuteState> auxSoloMuteStateChanged() const = 0;
     111              : 
     112              :     virtual void removeTrackParams(const engraving::InstrumentTrackId& trackId) = 0;
     113              : 
     114              :     virtual const playback::SoundProfileName& activeSoundProfile() const = 0;
     115              :     virtual void setActiveSoundProfile(const playback::SoundProfileName& profileName) = 0;
     116              : 
     117              :     virtual muse::async::Notification settingsChanged() const = 0;
     118              : };
     119              : 
     120              : using IProjectAudioSettingsPtr = std::shared_ptr<IProjectAudioSettings>;
     121              : }
        

Generated by: LCOV version 2.0-1