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 "../iplaybackconfiguration.h"
26 : #include "async/asyncable.h"
27 :
28 : #include "modularity/ioc.h"
29 : #include "musesampler/imusesamplerinfo.h"
30 : #include "audio/main/iaudioconfiguration.h"
31 :
32 : namespace mu::playback {
33 : class PlaybackConfiguration : public IPlaybackConfiguration, public muse::async::Asyncable
34 : {
35 : muse::GlobalInject<muse::audio::IAudioConfiguration> audioConfiguration;
36 : muse::GlobalInject<muse::musesampler::IMuseSamplerInfo> musesamplerInfo;
37 :
38 : public:
39 0 : PlaybackConfiguration() = default;
40 :
41 : void init();
42 :
43 : bool playNotesWhenEditing() const override;
44 : void setPlayNotesWhenEditing(bool value) override;
45 : muse::async::Notification playNotesWhenEditingChanged() const override;
46 :
47 : bool playChordWhenEditing() const override;
48 : void setPlayChordWhenEditing(bool value) override;
49 : muse::async::Channel<bool> playChordWhenEditingChanged() const override;
50 :
51 : bool playHarmonyWhenEditing() const override;
52 : void setPlayHarmonyWhenEditing(bool value) override;
53 : muse::async::Channel<bool> playHarmonyWhenEditingChanged() const override;
54 :
55 : bool playNotesOnMidiInput() const override;
56 : void setPlayNotesOnMidiInput(bool value) override;
57 : muse::async::Channel<bool> playNotesOnMidiInputChanged() const override;
58 :
59 : PlaybackCursorType cursorType() const override;
60 :
61 : bool isMixerSectionVisible(MixerSectionType sectionType) const override;
62 : void setMixerSectionVisible(MixerSectionType sectionType, bool visible) override;
63 : muse::async::Channel<MixerSectionType, bool> isMixerSectionVisibleChanged() const override;
64 :
65 : bool isAuxSendVisible(muse::audio::aux_channel_idx_t index) const override;
66 : void setAuxSendVisible(muse::audio::aux_channel_idx_t index, bool visible) override;
67 : muse::async::Channel<muse::audio::aux_channel_idx_t, bool> isAuxSendVisibleChanged() const override;
68 :
69 : bool isAuxChannelVisible(muse::audio::aux_channel_idx_t index) const override;
70 : void setAuxChannelVisible(muse::audio::aux_channel_idx_t index, bool visible) const override;
71 : muse::async::Channel<muse::audio::aux_channel_idx_t, bool> isAuxChannelVisibleChanged() const override;
72 :
73 : muse::audio::gain_t defaultAuxSendValue(muse::audio::aux_channel_idx_t index, muse::audio::AudioSourceType sourceType,
74 : const muse::String& instrumentSoundId) const override;
75 :
76 : bool muteHiddenInstruments() const override;
77 : void setMuteHiddenInstruments(bool mute) override;
78 : muse::async::Channel<bool> muteHiddenInstrumentsChanged() const override;
79 :
80 : const SoundProfileName& basicSoundProfileName() const override;
81 : const SoundProfileName& museSoundsProfileName() const override;
82 : const SoundProfileName& compatMuseSoundsProfileName() const override;
83 :
84 : SoundProfileName defaultProfileForNewProjects() const override;
85 : void setDefaultProfileForNewProjects(const SoundProfileName& name) override;
86 :
87 : bool soundPresetsMultiSelectionEnabled() const override;
88 : void setSoundPresetsMultiSelectionEnabled(bool enabled) override;
89 :
90 : bool needToShowResetSoundFlagsWhenChangeSoundWarning() const override;
91 : void setNeedToShowResetSoundFlagsWhenChangeSoundWarning(bool show) override;
92 :
93 : bool needToShowResetSoundFlagsWhenChangePlaybackProfileWarning() const override;
94 : void setNeedToShowResetSoundFlagsWhenChangePlaybackProfileWarning(bool show) override;
95 :
96 : bool shouldShowOnlineSoundsProcessingError() const override;
97 : void setShouldShowOnlineSoundsProcessingError(bool show) override;
98 : muse::async::Notification shouldShowOnlineSoundsProcessingErrorChanged() const override;
99 :
100 : OnlineSoundsShowProgressBarMode onlineSoundsShowProgressBarMode() const override;
101 : void setOnlineSoundsShowProgressBarMode(OnlineSoundsShowProgressBarMode mode) override;
102 : muse::async::Notification onlineSoundsShowProgressBarModeChanged() const override;
103 :
104 : muse::String onlineSoundsHandbookUrl() const override;
105 :
106 : bool shouldMeasureInputLag() const override;
107 :
108 : private:
109 : const SoundProfileName& fallbackSoundProfileStr() const;
110 :
111 : muse::async::Notification m_playNotesWhenEditingChanged;
112 : muse::async::Notification m_shouldShowOnlineSoundsProcessingErrorChanged;
113 : muse::async::Notification m_onlineSoundsShowProgressBarModeChanged;
114 : muse::async::Channel<bool> m_playChordWhenEditingChanged;
115 : muse::async::Channel<bool> m_playHarmonyWhenEditingChanged;
116 : muse::async::Channel<bool> m_playNotesOnMidiInputChanged;
117 : muse::async::Channel<muse::audio::aux_channel_idx_t, bool> m_isAuxSendVisibleChanged;
118 : muse::async::Channel<muse::audio::aux_channel_idx_t, bool> m_isAuxChannelVisibleChanged;
119 : muse::async::Channel<MixerSectionType, bool> m_isMixerSectionVisibleChanged;
120 :
121 : muse::async::Channel<bool> m_muteHiddenInstrumentsChanged;
122 : };
123 : }
|