Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
command.h
1/*
2 * Copyright © 2017-2023 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "definitions_cxx.hpp"
21#include "gui/menu_item/menu_item.h"
22
23class MIDICable;
24
25namespace deluge::gui::menu_item::midi {
26
27class Command final : public MenuItem {
28public:
29 Command(l10n::String newName, GlobalMIDICommand newCommandNumber = GlobalMIDICommand::PLAYBACK_RESTART)
30 : MenuItem(newName), commandNumber(newCommandNumber) {}
31 void beginSession(MenuItem* navigatedBackwardFrom) override;
32 void drawValue() const;
33 void selectEncoderAction(int32_t offset) override;
34 bool allowsLearnMode() override { return true; }
35 bool shouldBlinkLearnLed() override { return true; }
36 void unlearnAction() override;
37 bool learnNoteOn(MIDICable& cable, int32_t channel, int32_t noteCode) override;
38 void learnProgramChange(MIDICable& cable, int32_t channel, int32_t programNumber) override;
39 void learnCC(MIDICable& cable, int32_t channel, int32_t ccNumber, int32_t value) override;
40
41 void drawPixelsForOled() override;
42
43 GlobalMIDICommand commandNumber;
44};
45} // namespace deluge::gui::menu_item::midi
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:94
bool learnNoteOn(MIDICable &cable, int32_t channel, int32_t noteCode) override
Attempt to bind this menu item to a note code.
Definition command.cpp:139
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition command.cpp:30
bool shouldBlinkLearnLed() override
Definition command.h:35
void unlearnAction() override
Unlearn the parameter controlled by this menu.
Definition command.cpp:115
void drawPixelsForOled() override
Paints the pixels below the standard title block.
Definition command.cpp:36
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition command.cpp:105
bool allowsLearnMode() override
Used by SoundEditor to determine if the current menu item can accept MIDI learning.
Definition command.h:34