Deluge Firmware
1.3.0
Build date: 2026.08.29
Toggle main menu visibility
Loading...
Searching...
No Matches
usb_hosted.h
1
/*
2
* Copyright © 2024 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 "deluge/io/midi/cable_types/usb_common.h"
21
22
class
MIDICableUSBHosted :
public
MIDICableUSB {
23
public
:
24
virtual
~MIDICableUSBHosted() =
default
;
25
MIDICableUSBHosted() =
default
;
26
27
void
writeReferenceAttributesToFile(
Serializer
& writer)
override
;
28
void
writeToFlash(uint8_t* memory)
override
;
29
char
const
* getDisplayName()
override
;
30
33
34
// Add new hooks to the below list.
35
36
// Gets called once for each freshly connected hosted device.
37
virtual
void
hookOnConnected() {};
38
39
// Gets called when something happens that changes the root note
40
virtual
void
hookOnChangeRootNote() {};
41
42
// Gets called when something happens that changes the scale/mode
43
virtual
void
hookOnChangeScale() {};
44
45
// Gets called when entering Scale Mode in a clip
46
virtual
void
hookOnEnterScaleMode() {};
47
48
// Gets called when exiting Scale Mode in a clip
49
virtual
void
hookOnExitScaleMode() {};
50
51
// Gets called when learning/unlearning a midi device to a clip
52
virtual
void
hookOnMIDILearn() {};
53
54
// Gets called when recalculating colour in clip mode
55
virtual
void
hookOnRecalculateColour() {};
56
57
// Gets called when transitioning to ArrangerView
58
virtual
void
hookOnTransitionToArrangerView() {};
59
60
// Gets called when transitioning to ClipView
61
virtual
void
hookOnTransitionToClipView() {};
62
63
// Gets called when transitioning to SessionView
64
virtual
void
hookOnTransitionToSessionView() {};
65
66
// Gets called when hosted device info is saved to XML (usually after changing settings)
67
virtual
void
hookOnWriteHostedDeviceToFile() {};
68
69
// Add an entry to this enum if adding new virtual hook functions above
70
enum class
Hook {
71
HOOK_ON_CONNECTED = 0,
72
HOOK_ON_CHANGE_ROOT_NOTE,
73
HOOK_ON_CHANGE_SCALE,
74
HOOK_ON_ENTER_SCALE_MODE,
75
HOOK_ON_EXIT_SCALE_MODE,
76
HOOK_ON_MIDI_LEARN,
77
HOOK_ON_RECALCULATE_COLOUR,
78
HOOK_ON_TRANSITION_TO_ARRANGER_VIEW,
79
HOOK_ON_TRANSITION_TO_CLIP_VIEW,
80
HOOK_ON_TRANSITION_TO_SESSION_VIEW,
81
HOOK_ON_WRITE_HOSTED_DEVICE_TO_FILE
82
};
83
85
86
// Ensure to add a case to this function in midi_device.cpp when adding new hooks
87
void
callHook(Hook hook);
88
89
uint16_t vendorId{};
90
uint16_t productId{};
91
92
bool
freshly_connected =
true
;
// Used to trigger hookOnConnected from the input loop
93
94
String
name;
95
};
Serializer
Definition
storage_manager.h:119
String
Definition
d_string.h:41