Deluge Firmware
Loading...
Searching...
No Matches
instrument.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 INSTRUMENT_H
19#define INSTRUMENT_H
20
21#include <ClipInstanceVector.h>
22#include "definitions.h"
23#include "DString.h"
24#include "Output.h"
25
26class StereoSample;
27class ModControllable;
28class InstrumentClip;
30class Song;
32class Kit;
33class Sound;
34class TimelineCounter;
35class NoteRow;
38
39
40/*
41 * An Instrument is the “Output” of a Clip - the thing which turns the sequence or notes into sound (or MIDI or CV output).
42 * Instruments include Kit, MIDIInstrument, and CVInsttrument. And then there’s SoundInstrument, which is basically a synth.
43 */
44
45class Instrument : public Output {
46public:
47 Instrument(int newType);
48 virtual char const* getFilePrefix() {}
49 String dirPath; // This needs to be initialized / defaulted to "SYNTHS" or "KITS" (for those Instrument types). The constructor does not do this, partly because
50 // I don't want it doing memory allocation, and also because in many cases, the function creating the object hard-sets this anyway.
51
54
55 virtual bool doAnySoundsUseCC(uint8_t channel, uint8_t ccNumber, uint8_t value) { return false; }
56 virtual void beenEdited(bool shouldMoveToEmptySlot = true);
57 virtual void setupPatching(ModelStackWithTimelineCounter* modelStack) {} // You must call this when an Instrument comes into existence or something... for every Clip, not just for the activeClip
59
60 //virtual void writeInstrumentDataToFile(bool savingSong, char const* slotName = "presetSlot", char const* subSlotName = "presetSubSlot");
61 bool writeDataToFile(Clip* clipForSavingOutputOnly, Song* song);
62 bool readTagFromFile(char const* tagName);
63
66
67 char const* getNameXMLTag() { return "presetName"; }
68 virtual char const* getSlotXMLTag() { return "presetSlot"; }
69 virtual char const* getSubSlotXMLTag() { return "presetSubSlot"; }
70
71 virtual bool isAnyAuditioningHappening() = 0;
72
74
75protected:
78
79};
80
81#endif // INSTRUMENT_H
Definition: Arpeggiator.h:28
Definition: Clip.h:41
Definition: InstrumentClip.h:54
Definition: instrument.h:45
String dirPath
Definition: instrument.h:49
bool existsOnCard
Definition: instrument.h:53
char const * getNameXMLTag()
Definition: instrument.h:67
virtual void beenEdited(bool shouldMoveToEmptySlot=true)
Definition: instrument.cpp:53
bool editedByUser
Definition: instrument.h:52
virtual char const * getSlotXMLTag()
Definition: instrument.h:68
virtual char const * getSubSlotXMLTag()
Definition: instrument.h:69
Clip * createNewClipForArrangementRecording(ModelStack *modelStack) final
Definition: instrument.cpp:135
int setupDefaultAudioFileDir()
Definition: instrument.cpp:173
virtual bool isNoteRowStillAuditioningAsLinearRecordingEnded(NoteRow *noteRow)=0
virtual void setupPatching(ModelStackWithTimelineCounter *modelStack)
Definition: instrument.h:57
virtual bool doAnySoundsUseCC(uint8_t channel, uint8_t ccNumber, uint8_t value)
Definition: instrument.h:55
virtual char const * getFilePrefix()
Definition: instrument.h:48
virtual void compensateInstrumentVolumeForResonance(ModelStackWithThreeMainThings *modelStack)
Definition: instrument.h:64
virtual bool isAnyAuditioningHappening()=0
void deleteAnyInstancesOfClip(InstrumentClip *clip)
Definition: instrument.cpp:57
bool readTagFromFile(char const *tagName)
Definition: instrument.cpp:96
bool writeDataToFile(Clip *clipForSavingOutputOnly, Song *song)
Definition: instrument.cpp:69
uint8_t defaultVelocity
Definition: instrument.h:73
Definition: kit.h:35
Definition: ModControllable.h:39
Definition: ModelStack.h:123
Definition: ModelStack.h:243
Definition: ModelStack.h:130
Definition: NoteRow.h:72
Definition: Output.h:42
Definition: ParamManager.h:166
Definition: song.h:72
Definition: sound.h:66
Definition: AudioSample.h:25
Definition: DString.h:25
Definition: TimelineCounter.h:29