Deluge Firmware
Loading...
Searching...
No Matches
drum.h
Go to the documentation of this file.
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#ifndef DRUM_H
19#define DRUM_H
20
21#include "definitions.h"
22#include "r_typedefs.h"
23#include "LearnedMIDI.h"
24
25class Kit;
27class Song;
28class ModControllable;
29class Clip;
33class MIDIDevice;
34class ParamManager;
35
36
37/*
38 * Kits are made up of multiple Drums. Even when they are not drum sounds, the class is called Drum, for better or worse.
39 * In most instructional material for users, Synthstrom has referred to them often as
40 * “items within kits”, or sometimes “rows” or “sounds” where applicable.
41 *
42 * Types of Drum are MIDIDrum, GateDrum, and SoundDrum (most often a sample).
43 */
44
45class Drum {
46public:
47 Drum(int newType);
48 virtual ~Drum() {}
49
51
52 const uint8_t type;
54 uint8_t earlyNoteVelocity; // If 0, then there's none
56
58 uint8_t lastMIDIChannelAuditioned; // Primarily for MPE purposes
59
61
63
66
67 virtual void noteOn(ModelStackWithThreeMainThings* modelStack, uint8_t velocity, Kit* kit, int16_t const* mpeValues, int fromMIDIChannel = MIDI_CHANNEL_NONE, uint32_t sampleSyncLength = 0, int32_t ticksLate = 0, uint32_t samplesLate = 0) = 0;
68 virtual void noteOff(ModelStackWithThreeMainThings* modelStack, int velocity = DEFAULT_LIFT_VALUE) = 0;
69 virtual bool allowNoteTails(ModelStackWithSoundFlags* modelStack, bool disregardSampleLoop = false) = 0;
70 virtual bool anyNoteIsOn() = 0;
71 virtual bool hasAnyVoices() = 0;
72 virtual void unassignAllVoices() = 0;
73
74 virtual int loadAllSamples(bool mayActuallyReadFiles) { return NO_ERROR; }
75 virtual void prepareForHibernation() {}
77
78 virtual void writeToFile(bool savingSong, ParamManager* paramManager) = 0;
79 virtual int readFromFile(Song* song, Clip* clip, int32_t readAutomationUpToPos) = 0;
80 virtual void drumWontBeRenderedForAWhile();
81
82 virtual void getName(char* buffer) = 0; // May return up to 5 actual characters, so supply at least a char[6]
83 virtual void choke(ModelStackWithSoundFlags* modelStack) {} // modelStack can be NULL if you really insist
85 bool readDrumTagFromFile(char const* tagName);
86 void recordNoteOnEarly(int velocity, bool noteTailsAllowed);
87 void expressionEventPossiblyToRecord(ModelStackWithTimelineCounter* modelStack, int16_t newValue, int whichExpressionimension, int level);
88 virtual void expressionEvent(int newValue, int whichExpressionimension) {}
89 void getCombinedExpressionInputs(int16_t* combined);
90
91 virtual ModControllable* toModControllable() { return NULL; }
92};
93
94#endif // DRUM_H
Definition: Clip.h:41
Definition: drum.h:45
bool auditioned
Definition: drum.h:57
uint8_t lastMIDIChannelAuditioned
Definition: drum.h:58
void writeMIDICommandsToFile()
Definition: drum.cpp:49
Drum * next
Definition: drum.h:62
virtual void noteOn(ModelStackWithThreeMainThings *modelStack, uint8_t velocity, Kit *kit, int16_t const *mpeValues, int fromMIDIChannel=MIDI_CHANNEL_NONE, uint32_t sampleSyncLength=0, int32_t ticksLate=0, uint32_t samplesLate=0)=0
virtual bool hasAnyVoices()=0
bool readDrumTagFromFile(char const *tagName)
Definition: drum.cpp:55
virtual void prepareDrumToHaveNoActiveClip()
Definition: drum.h:76
virtual ~Drum()
Definition: drum.h:48
void getCombinedExpressionInputs(int16_t *combined)
Definition: drum.cpp:83
LearnedMIDI midiInput
Definition: drum.h:64
virtual void getName(char *buffer)=0
virtual void unassignAllVoices()=0
bool noteRowAssignedTemp
Definition: drum.h:53
bool earlyNoteStillActive
Definition: drum.h:55
virtual ModControllable * toModControllable()
Definition: drum.h:91
virtual int readFromFile(Song *song, Clip *clip, int32_t readAutomationUpToPos)=0
LearnedMIDI muteMIDICommand
Definition: drum.h:65
const uint8_t type
Definition: drum.h:52
uint8_t earlyNoteVelocity
Definition: drum.h:54
virtual void expressionEvent(int newValue, int whichExpressionimension)
Definition: drum.h:88
void expressionEventPossiblyToRecord(ModelStackWithTimelineCounter *modelStack, int16_t newValue, int whichExpressionimension, int level)
Definition: drum.cpp:90
void recordNoteOnEarly(int velocity, bool noteTailsAllowed)
Definition: drum.cpp:72
virtual void noteOff(ModelStackWithThreeMainThings *modelStack, int velocity=DEFAULT_LIFT_VALUE)=0
virtual void prepareForHibernation()
Definition: drum.h:75
virtual int loadAllSamples(bool mayActuallyReadFiles)
Definition: drum.h:74
Kit * kit
Definition: drum.h:50
virtual void drumWontBeRenderedForAWhile()
Definition: drum.cpp:77
virtual void choke(ModelStackWithSoundFlags *modelStack)
Definition: drum.h:83
int8_t lastExpressionInputsReceived[2][NUM_EXPRESSION_DIMENSIONS]
Definition: drum.h:60
virtual void writeToFile(bool savingSong, ParamManager *paramManager)=0
virtual bool allowNoteTails(ModelStackWithSoundFlags *modelStack, bool disregardSampleLoop=false)=0
virtual bool anyNoteIsOn()=0
Definition: kit.h:35
Definition: LearnedMIDI.h:30
Definition: MIDIDevice.h:74
Definition: ModControllable.h:39
Definition: ModelStack.h:295
Definition: ModelStack.h:243
Definition: ModelStack.h:130
Definition: ParamManager.h:166
Definition: ParamManager.h:50
Definition: song.h:72
#define NO_ERROR
Definition: definitions.h:563
#define DEFAULT_LIFT_VALUE
Definition: definitions.h:693
#define NUM_EXPRESSION_DIMENSIONS
Definition: definitions.h:919
#define MIDI_CHANNEL_NONE
Definition: definitions.h:927