Deluge Firmware
1.3.0
Build date: 2026.08.23
Toggle main menu visibility
Loading...
Searching...
No Matches
drum.h
1
/*
2
* Copyright © 2014-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 "io/midi/learned_midi.h"
22
#include "model/voiced.h"
23
#include "modulation/arpeggiator.h"
24
#include <cstdint>
25
26
class
Clip
;
27
class
Kit
;
28
class
ModControllable
;
29
class
ModelStackWithSoundFlags
;
30
class
ModelStackWithThreeMainThings
;
31
class
ModelStackWithTimelineCounter
;
32
class
ParamManager
;
33
class
ParamManagerForTimeline
;
34
class
Song
;
35
36
/*
37
* Kits are made up of multiple Drums. Even when they are not drum sounds, the class is called Drum, for better or
38
* worse. In most instructional material for users, Synthstrom has referred to them often as “items within kits”, or
39
* sometimes “rows” or “sounds” where applicable.
40
*
41
* Types of Drum are MIDIDrum, GateDrum, and SoundDrum (most often a sample).
42
*/
43
44
class
Drum :
public
virtual
Voiced
{
45
public
:
46
Drum(DrumType newType);
47
~Drum()
override
=
default
;
48
49
std::string drumName;
50
Kit
* kit;
51
52
const
DrumType type;
53
bool
noteRowAssignedTemp;
54
uint8_t earlyNoteVelocity;
// If 0, then there's none
55
bool
earlyNoteStillActive;
56
57
bool
auditioned;
58
uint8_t lastMIDIChannelAuditioned;
// Primarily for MPE purposes
59
60
int8_t lastExpressionInputsReceived[2][kNumExpressionDimensions];
61
62
Drum* next;
63
64
LearnedMIDI
midiInput;
65
LearnedMIDI
muteMIDICommand;
66
67
ArpeggiatorForDrum
arpeggiator;
68
ArpeggiatorSettings
arpSettings;
69
70
virtual
void
noteOn(
ModelStackWithThreeMainThings
* modelStack, uint8_t velocity, int16_t
const
* mpeValues,
71
int32_t fromMIDIChannel = MIDI_CHANNEL_NONE, uint32_t sampleSyncLength = 0,
72
int32_t ticksLate = 0, uint32_t samplesLate = 0) = 0;
73
virtual
void
noteOff(
ModelStackWithThreeMainThings
* modelStack, int32_t velocity = kDefaultLiftValue) = 0;
74
75
virtual
Error loadAllSamples(
bool
mayActuallyReadFiles) {
return
Error::NONE; }
76
virtual
void
prepareDrumToHaveNoActiveClip() {}
77
78
virtual
void
writeToFile(
Serializer
& writer,
bool
savingSong,
ParamManager
* paramManager) = 0;
79
virtual
Error readFromFile(
Deserializer
& reader,
Song
* song,
Clip
* clip, int32_t readAutomationUpToPos) = 0;
80
virtual
void
drumWontBeRenderedForAWhile();
81
virtual
std::string getDrumName() = 0;
82
virtual
void
choke(
ModelStackWithSoundFlags
* modelStack) {}
// modelStack can be NULL if you really insist
83
84
void
writeMIDICommandsToFile(
Serializer
& writer);
85
void
writeDrumTagsToFile(
Serializer
& writer);
86
bool
readDrumTagFromFile(
Deserializer
& reader,
char
const
* tagName);
87
void
recordNoteOnEarly(int32_t velocity,
bool
noteTailsAllowed);
88
void
expressionEventPossiblyToRecord(
ModelStackWithTimelineCounter
* modelStack, int16_t newValue,
89
int32_t expressionDimension, int32_t level);
90
virtual
void
expressionEvent(int32_t newValue, int32_t expressionDimension) {}
91
void
getCombinedExpressionInputs(int16_t* combined);
92
93
virtual
ModControllable
* toModControllable() {
return
nullptr
; }
94
};
ArpeggiatorForDrum
Definition
arpeggiator.h:345
ArpeggiatorSettings
Definition
arpeggiator.h:48
Clip
Definition
clip.h:46
Deserializer
Definition
storage_manager.h:185
Kit
Definition
kit.h:34
LearnedMIDI
Definition
learned_midi.h:30
ModControllable
Definition
mod_controllable.h:40
ModelStackWithSoundFlags
Definition
model_stack.h:287
ModelStackWithThreeMainThings
Definition
model_stack.h:231
ModelStackWithTimelineCounter
Definition
model_stack.h:129
ParamManagerForTimeline
Definition
param_manager.h:174
ParamManager
Definition
param_manager.h:45
Serializer
Definition
storage_manager.h:119
Song
Definition
song.h:103
Voiced
Definition
voiced.h:21