Deluge Firmware 1.3.0
Build date: 2025.04.16
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
26class Clip;
27class Kit;
28class ModControllable;
32class ParamManager;
34class 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
44class Drum : public virtual Voiced {
45public:
46 Drum(DrumType newType);
47 ~Drum() override = default;
48
49 Kit* kit;
50
51 const DrumType type;
52 bool noteRowAssignedTemp;
53 uint8_t earlyNoteVelocity; // If 0, then there's none
54 bool earlyNoteStillActive;
55
56 bool auditioned;
57 uint8_t lastMIDIChannelAuditioned; // Primarily for MPE purposes
58
59 int8_t lastExpressionInputsReceived[2][kNumExpressionDimensions];
60
61 Drum* next;
62
63 LearnedMIDI midiInput;
64 LearnedMIDI muteMIDICommand;
65
66 ArpeggiatorForDrum arpeggiator;
67 ArpeggiatorSettings arpSettings;
68
69 virtual void noteOn(ModelStackWithThreeMainThings* modelStack, uint8_t velocity, int16_t const* mpeValues,
70 int32_t fromMIDIChannel = MIDI_CHANNEL_NONE, uint32_t sampleSyncLength = 0,
71 int32_t ticksLate = 0, uint32_t samplesLate = 0) = 0;
72 virtual void noteOff(ModelStackWithThreeMainThings* modelStack, int32_t velocity = kDefaultLiftValue) = 0;
73
74 virtual Error loadAllSamples(bool mayActuallyReadFiles) { return Error::NONE; }
75 virtual void prepareDrumToHaveNoActiveClip() {}
76
77 virtual void writeToFile(Serializer& writer, bool savingSong, ParamManager* paramManager) = 0;
78 virtual Error readFromFile(Deserializer& reader, Song* song, Clip* clip, int32_t readAutomationUpToPos) = 0;
79 virtual void drumWontBeRenderedForAWhile();
80
81 virtual void getName(char* buffer) = 0; // May return up to 5 actual characters, so supply at least a char[6]
82 virtual void choke(ModelStackWithSoundFlags* modelStack) {} // modelStack can be NULL if you really insist
83 void writeMIDICommandsToFile(Serializer& writer);
84 bool readDrumTagFromFile(Deserializer& reader, char const* tagName);
85 void recordNoteOnEarly(int32_t velocity, bool noteTailsAllowed);
86 void expressionEventPossiblyToRecord(ModelStackWithTimelineCounter* modelStack, int16_t newValue,
87 int32_t expressionDimension, int32_t level);
88 virtual void expressionEvent(int32_t newValue, int32_t expressionDimension) {}
89 void getCombinedExpressionInputs(int16_t* combined);
90
91 virtual ModControllable* toModControllable() { return nullptr; }
92};
Definition arpeggiator.h:292
Definition arpeggiator.h:46
Definition clip.h:46
Definition storage_manager.h:185
Definition kit.h:34
Definition learned_midi.h:30
Definition mod_controllable.h:40
Definition model_stack.h:287
Definition model_stack.h:231
Definition model_stack.h:129
Definition param_manager.h:174
Definition param_manager.h:45
Definition storage_manager.h:119
Definition song.h:104
Definition voiced.h:21