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) 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 <functional>
26 :
27 : #include "iplaybackcommandscontroller.h"
28 :
29 : #include "global/types/ret.h"
30 :
31 : #include "global/modularity/ioc.h"
32 : #include "rcommand/commandable.h"
33 : #include "rcommand/commandtypes.h"
34 : #include "rcommand/icommanddispatcher.h"
35 : #include "rcommand/icommandsstate.h"
36 : #include "interactive/iinteractive.h"
37 : #include "../iplaybackcontroller.h"
38 : #include "../iplaybackconfiguration.h"
39 :
40 : namespace mu::playback {
41 : class PlaybackCommandsController : public IPlaybackCommandsController, public muse::Contextable, public muse::rcommand::Commandable
42 : {
43 : muse::GlobalInject<IPlaybackConfiguration> configuration;
44 : muse::ContextInject<muse::rcommand::ICommandDispatcher> dispatcher = { this };
45 : muse::ContextInject<muse::rcommand::ICommandsState> commandsState = { this };
46 : muse::ContextInject<IPlaybackController> playbackController = { this };
47 : muse::ContextInject<muse::IInteractive> interactive = { this };
48 : public:
49 0 : PlaybackCommandsController(const muse::modularity::ContextPtr& ctx)
50 0 : : muse::Contextable(ctx) {}
51 :
52 : void init();
53 :
54 : private:
55 :
56 : muse::Ret rewind(const muse::rcommand::Params& params);
57 : muse::Ret showPlaybackSetup();
58 :
59 : muse::Ret toggleMixerSection(const muse::rcommand::Params& params);
60 : muse::Ret toggleAuxSend(const muse::rcommand::Params& params);
61 : muse::Ret toggleAuxChannel(const muse::rcommand::Params& params);
62 :
63 : void registerCommand(const muse::rcommand::Command&, const std::function<muse::Ret()>&);
64 : void registerCommand(const muse::rcommand::Command&, const std::function<muse::Ret(const muse::rcommand::Params&)>&);
65 :
66 : void registerCommand(const muse::rcommand::Command&, muse::Ret (IPlaybackController::*)());
67 : template<typename P1>
68 : void registerCommand(const muse::rcommand::Command&, muse::Ret (IPlaybackController::*)(P1), P1);
69 : };
70 : }
|