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 : #include "playbackcommandsregister.h"
24 :
25 : #include "../playbackcommands.h"
26 :
27 : using namespace muse;
28 : using namespace muse::rcommand;
29 : using namespace muse::ui;
30 : using namespace mu::playback;
31 :
32 : static const std::vector<CommandInfo> s_commandInfos = {
33 : CommandInfo{
34 : PLAY_TOGGLE_COMMAND,
35 : TranslatableString("playback", "Play toggle"),
36 : TranslatableString("playback", "Toggle playback of current score"),
37 : InputSchema(),
38 : Decoration(IconCode::Code::PLAY)
39 : },
40 : CommandInfo{
41 : PLAY_COMMAND,
42 : TranslatableString("playback", "Play"),
43 : TranslatableString("playback", "Play the current score"),
44 : InputSchema(),
45 : Decoration(IconCode::Code::PLAY)
46 : },
47 : CommandInfo{
48 : PLAY_SELECTION_COMMAND,
49 : TranslatableString("playback", "Play from selection"),
50 : TranslatableString("playback", "Play from selection"),
51 : InputSchema(),
52 : Decoration(IconCode::Code::PLAY)
53 : },
54 : CommandInfo{
55 : PAUSE_COMMAND,
56 : TranslatableString("playback", "Pause"),
57 : TranslatableString("playback", "Pause playback"),
58 : InputSchema(),
59 : Decoration(IconCode::Code::PAUSE)
60 : },
61 : CommandInfo{
62 : PAUSE_AND_SELECT_COMMAND,
63 : TranslatableString("playback", "Pause and select"),
64 : TranslatableString("playback", "Pause and select playback position"),
65 : InputSchema(),
66 : Decoration(IconCode::Code::PAUSE)
67 : },
68 : CommandInfo{
69 : STOP_COMMAND,
70 : TranslatableString("playback", "Stop"),
71 : TranslatableString("playback", "Stop playback"),
72 : InputSchema(),
73 : Decoration(IconCode::Code::STOP)
74 : },
75 : CommandInfo{
76 : REWIND_COMMAND,
77 : TranslatableString("playback", "Rewind"),
78 : TranslatableString("playback", "Rewind"),
79 : InputSchema({ { "position", Arg(DataType::Float, u"Playback position in seconds", Val(0)) } }),
80 : Decoration(IconCode::Code::REWIND)
81 : },
82 : CommandInfo{
83 : LOOP_TOGGLE_COMMAND,
84 : TranslatableString("playback", "Loop toggle"),
85 : TranslatableString("playback", "Toggle loop playback"),
86 : InputSchema(),
87 : Decoration(IconCode::Code::LOOP, rcommand::Checkable::Yes)
88 : },
89 :
90 : CommandInfo{
91 : LOOP_IN_COMMAND,
92 : TranslatableString("playback", "Loop in"),
93 : TranslatableString("playback", "Set loop marker left"),
94 : InputSchema(),
95 : Decoration(IconCode::Code::LOOP_IN)
96 : },
97 : CommandInfo{
98 : LOOP_OUT_COMMAND,
99 : TranslatableString("playback", "Loop out"),
100 : TranslatableString("playback", "Set loop marker right"),
101 : InputSchema(),
102 : Decoration(IconCode::Code::LOOP_OUT)
103 : },
104 : CommandInfo{
105 : METRONOME_TOGGLE_COMMAND,
106 : TranslatableString("playback", "Metronome toggle"),
107 : TranslatableString("playback", "Toggle metronome playback"),
108 : InputSchema(),
109 : Decoration(IconCode::Code::METRONOME, rcommand::Checkable::Yes)
110 : },
111 : CommandInfo{
112 : OPEN_PLAYBACK_SETUP_COMMAND,
113 : TranslatableString("playback", "Playback setup"),
114 : TranslatableString("playback", "Show playback setup"),
115 : InputSchema(),
116 : Decoration(IconCode::Code::NONE)
117 : },
118 : CommandInfo{
119 : MIDI_TOGGLE_COMMAND,
120 : TranslatableString("playback", "MIDI toggle"),
121 : TranslatableString("playback", "Toggle MIDI input"),
122 : InputSchema(),
123 : Decoration(IconCode::Code::MIDI_INPUT, rcommand::Checkable::Yes)
124 : },
125 : CommandInfo{
126 : MIDI_INPUT_WRITTEN_PITCH_COMMAND,
127 : TranslatableString("playback", "Written pitch"),
128 : TranslatableString("playback", "Input written pitch"),
129 : InputSchema(),
130 : Decoration(IconCode::Code::NONE, rcommand::Checkable::Yes)
131 : },
132 : CommandInfo{
133 : MIDI_INPUT_SOUNDING_PITCH_COMMAND,
134 : TranslatableString("playback", "Sounding pitch"),
135 : TranslatableString("playback", "Input sounding pitch"),
136 : InputSchema(),
137 : Decoration(IconCode::Code::NONE, rcommand::Checkable::Yes)
138 : },
139 : CommandInfo{
140 : REPEATS_TOGGLE_COMMAND,
141 : TranslatableString("playback", "Play repeats"),
142 : TranslatableString("playback", "Toggle play repeats"),
143 : InputSchema(),
144 : Decoration(IconCode::Code::PLAY_REPEATS, rcommand::Checkable::Yes)
145 : },
146 : CommandInfo{
147 : CHORDSYMBOLS_TOGGLE_COMMAND,
148 : TranslatableString("playback", "Play chord symbols"),
149 : TranslatableString("playback", "Toggle play chord symbols"),
150 : InputSchema(),
151 : Decoration(IconCode::Code::CHORD_SYMBOL, rcommand::Checkable::Yes)
152 : },
153 : CommandInfo{
154 : HEAR_PLAYBACK_WHEN_EDITING_TOGGLE_COMMAND,
155 : TranslatableString("playback", "Hear playback when editing"),
156 : TranslatableString("playback", "Toggle hear playback when editing"),
157 : InputSchema(),
158 : Decoration(IconCode::Code::AUDIO, rcommand::Checkable::Yes)
159 : },
160 : CommandInfo{
161 : PAN_TOGGLE_COMMAND,
162 : TranslatableString("playback", "Pan score automatically"),
163 : TranslatableString("playback", "Toggle pan score automatically during playback"),
164 : InputSchema(),
165 : Decoration(IconCode::Code::PAN_SCORE, rcommand::Checkable::Yes)
166 : },
167 : CommandInfo{
168 : COUNTIN_TOGGLE_COMMAND,
169 : TranslatableString("playback", "Count-in when playing"),
170 : TranslatableString("playback", "Toggle count-in when playing"),
171 : InputSchema(),
172 : Decoration(IconCode::Code::COUNT_IN, rcommand::Checkable::Yes)
173 : },
174 : CommandInfo{
175 : CLEAR_ONLINESOUNDS_CACHE_COMMAND,
176 : TranslatableString("playback", "Clear online sounds cache"),
177 : TranslatableString("playback", "Clear online sounds cache"),
178 : InputSchema(),
179 : Decoration(IconCode::Code::NONE)
180 : },
181 : CommandInfo{
182 : PROCESS_ONLINESOUNDS_COMMAND,
183 : TranslatableString("playback", "Process online sounds"),
184 : TranslatableString("playback", "Process online sounds"),
185 : InputSchema(),
186 : Decoration(IconCode::Code::NONE)
187 : },
188 : CommandInfo{
189 : RELOAD_PLAYBACK_CACHE_COMMAND,
190 : TranslatableString("playback", "Reload playback cache"),
191 : TranslatableString("playback", "Reload playback cache"),
192 : InputSchema(),
193 : Decoration(IconCode::Code::NONE)
194 : },
195 :
196 : CommandInfo{
197 : TOGGLE_MIXER_SECTION_COMMAND,
198 : TranslatableString("playback", "Toggle mixer section"),
199 : TranslatableString("playback", "Toggle mixer section"),
200 : InputSchema({
201 : { "section",
202 : Arg(DataType::String, u"Mixer section (labels, sound, audio-fx, balance, volume, fader, mute-and-solo, title)") } }),
203 : Decoration()
204 : },
205 : CommandInfo{
206 : TOGGLE_AUX_SEND_COMMAND,
207 : TranslatableString("playback", "Toggle aux send"),
208 : TranslatableString("playback", "Toggle aux send"),
209 : InputSchema({ { "auxsend-index", Arg(DataType::Int, u"Aux send index") } }),
210 : Decoration()
211 : },
212 : CommandInfo{
213 : TOGGLE_AUX_CHANNEL_COMMAND,
214 : TranslatableString("playback", "Toggle aux channel"),
215 : TranslatableString("playback", "Toggle aux channel"),
216 : InputSchema({ { "auxchannel-index", Arg(DataType::Int, u"Aux channel index") } }),
217 : Decoration()
218 : }
219 : };
220 :
221 0 : std::string PlaybackCommandsRegister::moduleName() const
222 : {
223 0 : return "playback";
224 : }
225 :
226 0 : const std::vector<muse::rcommand::Command>& PlaybackCommandsRegister::commandList() const
227 : {
228 0 : static std::vector<muse::rcommand::Command> commands;
229 0 : if (commands.empty()) {
230 0 : commands.reserve(s_commandInfos.size());
231 0 : for (const auto& info : s_commandInfos) {
232 0 : commands.push_back(info.command);
233 : }
234 : }
235 0 : return commands;
236 : }
237 :
238 0 : const std::vector<CommandInfo>& PlaybackCommandsRegister::commandInfoList() const
239 : {
240 0 : return s_commandInfos;
241 : }
|