Deluge Firmware
Loading...
Searching...
No Matches
soundinstrument.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 SOUNDINSTRUMENT_H
19#define SOUNDINSTRUMENT_H
20
21#include <sound.h>
22#include "MelodicInstrument.h"
23#include "Arpeggiator.h"
24
27class ModelStack;
29
30class SoundInstrument final : public Sound, public MelodicInstrument
31{
32public:
34 bool writeDataToFile(Clip* clipForSavingOutputOnly, Song* song);
35 int readFromFile(Song* song, Clip* clip, int32_t readAutomationUpToPos);
36 void cutAllSound();
37 bool noteIsOn(int noteCode);
38
39 void renderOutput(ModelStack* modelStack, StereoSample *startPos, StereoSample *endPos, int numSamples, int32_t* reverbBuffer, int32_t reverbAmountAdjust, int32_t sideChainHitPending, bool shouldLimitDelayFeedback, bool isClipActive);
40
41 // A timelineCounter is required
42 void offerReceivedCCToLearnedParams(MIDIDevice* fromDevice, uint8_t channel, uint8_t ccNumber, uint8_t value, ModelStackWithTimelineCounter* modelStack) {
43 Sound::offerReceivedCCToLearnedParams(fromDevice, channel, ccNumber, value, modelStack);
44 }
45 bool offerReceivedPitchBendToLearnedParams(MIDIDevice* fromDevice, uint8_t channel, uint8_t data1, uint8_t data2, ModelStackWithTimelineCounter* modelStack) {
46 return Sound::offerReceivedPitchBendToLearnedParams(fromDevice, channel, data1, data2, modelStack);
47 }
48
49
50 int loadAllAudioFiles(bool mayActuallyReadFiles);
51 void resyncLFOs();
53 bool setActiveClip(ModelStackWithTimelineCounter* modelStack, int maySendMIDIPGMs);
55 char const* getFilePrefix() { return "SYNT"; }
57
59 void polyphonicExpressionEventOnChannelOrNote(int newValue, int whichExpressionDimension, int channelOrNoteNumber, int whichCharacteristic);
60 void monophonicExpressionEvent(int newValue, int whichExpressionDimension);
61
62 void sendNote(ModelStackWithThreeMainThings* modelStack, bool isOn, int noteCode, int16_t const* mpeValues, int fromMIDIChannel, uint8_t velocity, uint32_t sampleSyncLength, int32_t ticksLate, uint32_t samplesLate);
63
65 bool readTagFromFile(char const* tagName);
66
71 void beenEdited(bool shouldMoveToEmptySlot = true);
72 int32_t doTickForwardForArp(ModelStack* modelStack, int32_t currentPos);
73 void setupWithoutActiveClip(ModelStack* modelStack);
74 void getThingWithMostReverb(Sound** soundWithMostReverb, ParamManager** paramManagerWithMostReverb, GlobalEffectableForClip** globalEffectableWithMostReverb,
75 int32_t* highestReverbAmountFound);
76 uint8_t* getModKnobMode() { return &modKnobMode; }
78 char const* getXMLTag() { return "sound"; }
79
81
82};
83
84#endif
Definition: Arpeggiator.h:73
Definition: Arpeggiator.h:28
Definition: Clip.h:41
Definition: GlobalEffectableForClip.h:33
Definition: InstrumentClip.h:54
Definition: MIDIDevice.h:74
Definition: MelodicInstrument.h:32
bool offerReceivedPitchBendToLearnedParams(MIDIDevice *fromDevice, uint8_t channel, uint8_t data1, uint8_t data2, ModelStackWithTimelineCounter *modelStack, int noteRowIndex=-1)
Definition: ModControllableAudio.cpp:1341
bool offerReceivedCCToLearnedParams(MIDIDevice *fromDevice, uint8_t channel, uint8_t ccNumber, uint8_t value, ModelStackWithTimelineCounter *modelStack, int noteRowIndex=-1)
Definition: ModControllableAudio.cpp:1276
Definition: ModControllable.h:39
Definition: ModelStack.h:123
Definition: ModelStack.h:243
Definition: ModelStack.h:130
uint8_t modKnobMode
Definition: Output.h:61
Definition: ParamManager.h:166
Definition: ParamManager.h:50
Definition: song.h:72
Definition: sound.h:66
bool skippingRendering
Definition: sound.h:117
Definition: soundinstrument.h:31
void setupWithoutActiveClip(ModelStack *modelStack)
Definition: soundinstrument.cpp:227
ArpeggiatorSettings * getArpSettings(InstrumentClip *clip=NULL)
Definition: soundinstrument.cpp:341
SoundInstrument()
Definition: soundinstrument.cpp:35
void setupPatchingForAllParamManagers(Song *song)
Definition: soundinstrument.cpp:251
bool isSkippingRendering()
Definition: soundinstrument.h:69
void renderOutput(ModelStack *modelStack, StereoSample *startPos, StereoSample *endPos, int numSamples, int32_t *reverbBuffer, int32_t reverbAmountAdjust, int32_t sideChainHitPending, bool shouldLimitDelayFeedback, bool isClipActive)
Definition: soundinstrument.cpp:82
void prepareForHibernationOrDeletion()
Definition: soundinstrument.cpp:246
void polyphonicExpressionEventOnChannelOrNote(int newValue, int whichExpressionDimension, int channelOrNoteNumber, int whichCharacteristic)
Definition: soundinstrument.cpp:273
void sendNote(ModelStackWithThreeMainThings *modelStack, bool isOn, int noteCode, int16_t const *mpeValues, int fromMIDIChannel, uint8_t velocity, uint32_t sampleSyncLength, int32_t ticksLate, uint32_t samplesLate)
Definition: soundinstrument.cpp:313
ModControllable * toModControllable()
Definition: soundinstrument.cpp:174
bool writeDataToFile(Clip *clipForSavingOutputOnly, Song *song)
Definition: soundinstrument.cpp:41
void deleteBackedUpParamManagers(Song *song)
Definition: soundinstrument.cpp:256
bool setActiveClip(ModelStackWithTimelineCounter *modelStack, int maySendMIDIPGMs)
Definition: soundinstrument.cpp:201
ArpeggiatorBase * getArp()
Definition: soundinstrument.cpp:402
void cutAllSound()
Definition: soundinstrument.cpp:77
char const * getFilePrefix()
Definition: soundinstrument.h:55
void getThingWithMostReverb(Sound **soundWithMostReverb, ParamManager **paramManagerWithMostReverb, GlobalEffectableForClip **globalEffectableWithMostReverb, int32_t *highestReverbAmountFound)
Definition: soundinstrument.cpp:396
int32_t doTickForwardForArp(ModelStack *modelStack, int32_t currentPos)
Definition: soundinstrument.cpp:366
void compensateInstrumentVolumeForResonance(ModelStackWithThreeMainThings *modelStack)
Definition: soundinstrument.cpp:349
ArpeggiatorSettings defaultArpSettings
Definition: soundinstrument.h:80
bool readTagFromFile(char const *tagName)
Definition: soundinstrument.cpp:345
void beenEdited(bool shouldMoveToEmptySlot=true)
Definition: soundinstrument.cpp:359
void resyncLFOs()
Definition: soundinstrument.cpp:170
uint8_t * getModKnobMode()
Definition: soundinstrument.h:76
bool noteIsOn(int noteCode)
Definition: soundinstrument.cpp:406
void loadCrucialAudioFilesOnly()
Definition: soundinstrument.cpp:354
char const * getXMLTag()
Definition: soundinstrument.h:78
int readFromFile(Song *song, Clip *clip, int32_t readAutomationUpToPos)
Definition: soundinstrument.cpp:69
void setupPatching(ModelStackWithTimelineCounter *modelStack)
Definition: soundinstrument.cpp:178
void monophonicExpressionEvent(int newValue, int whichExpressionDimension)
Definition: soundinstrument.cpp:264
void offerReceivedCCToLearnedParams(MIDIDevice *fromDevice, uint8_t channel, uint8_t ccNumber, uint8_t value, ModelStackWithTimelineCounter *modelStack)
Definition: soundinstrument.h:42
bool offerReceivedPitchBendToLearnedParams(MIDIDevice *fromDevice, uint8_t channel, uint8_t data1, uint8_t data2, ModelStackWithTimelineCounter *modelStack)
Definition: soundinstrument.h:45
int loadAllAudioFiles(bool mayActuallyReadFiles)
Definition: soundinstrument.cpp:152
Definition: AudioSample.h:25