Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
sound_instrument.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 "model/instrument/melodic_instrument.h"
22#include "modulation/arpeggiator.h"
23#include "processing/sound/sound.h"
24
27class ModelStack;
29
30class SoundInstrument final : public Sound, public MelodicInstrument {
31public:
32 SoundInstrument();
33 bool writeDataToFile(Serializer& writer, Clip* clipForSavingOutputOnly, Song* song) override;
34 Error readFromFile(Deserializer& reader, Song* song, Clip* clip, int32_t readAutomationUpToPos) override;
35 void cutAllSound() override;
36 bool noteIsOn(int32_t noteCode, bool resetTimeEntered);
37
38 void renderOutput(ModelStack* modelStack, std::span<StereoSample> buffer, int32_t* reverbBuffer,
39 int32_t reverbAmountAdjust, int32_t sideChainHitPending, bool shouldLimitDelayFeedback,
40 bool isClipActive) override;
41
42 // A timelineCounter is required
43 void offerReceivedCCToLearnedParams(MIDICable& cable, uint8_t channel, uint8_t ccNumber, uint8_t value,
44 ModelStackWithTimelineCounter* modelStack) override {
45 Sound::offerReceivedCCToLearnedParamsForClip(cable, channel, ccNumber, value, modelStack);
46 }
47 bool offerReceivedPitchBendToLearnedParams(MIDICable& cable, uint8_t channel, uint8_t data1, uint8_t data2,
48 ModelStackWithTimelineCounter* modelStack) override {
49 return Sound::offerReceivedPitchBendToLearnedParams(cable, channel, data1, data2, modelStack);
50 }
51
52 Error loadAllAudioFiles(bool mayActuallyReadFiles) override;
53 void resyncLFOs() override;
54 ModControllable* toModControllable() override;
55 bool setActiveClip(ModelStackWithTimelineCounter* modelStack, PgmChangeSend maySendMIDIPGMs) override;
56 void setupPatchingForAllParamManagers(Song* song) override;
57 void setupPatching(ModelStackWithTimelineCounter* modelStack) override;
58
59 void deleteBackedUpParamManagers(Song* song) override;
60 void polyphonicExpressionEventOnChannelOrNote(int32_t newValue, int32_t expressionDimension,
61 int32_t channelOrNoteNumber,
62 MIDICharacteristic whichCharacteristic) override;
63 void monophonicExpressionEvent(int32_t newValue, int32_t expressionDimension) override;
64
65 void sendNote(ModelStackWithThreeMainThings* modelStack, bool isOn, int32_t noteCode, int16_t const* mpeValues,
66 int32_t fromMIDIChannel, uint8_t velocity, uint32_t sampleSyncLength, int32_t ticksLate,
67 uint32_t samplesLate) override;
68
69 ArpeggiatorSettings* getArpSettings(InstrumentClip* clip = nullptr) override;
70 bool readTagFromFile(Deserializer& reader, char const* tagName) override;
71
72 void prepareForHibernationOrDeletion() override;
73 void compensateInstrumentVolumeForResonance(ModelStackWithThreeMainThings* modelStack) override;
74 bool isSkippingRendering() override { return skippingRendering; }
75 void loadCrucialAudioFilesOnly() override;
76 void beenEdited(bool shouldMoveToEmptySlot = true) override;
77 int32_t doTickForwardForArp(ModelStack* modelStack, int32_t currentPos) override;
78 void setupWithoutActiveClip(ModelStack* modelStack) override;
79 void getThingWithMostReverb(Sound** soundWithMostReverb, ParamManager** paramManagerWithMostReverb,
80 GlobalEffectableForClip** globalEffectableWithMostReverb,
81 int32_t* highestReverbAmountFound) override;
82 uint8_t* getModKnobMode() override { return &modKnobMode; }
83 ArpeggiatorBase* getArp() override;
84 char const* getXMLTag() override { return "sound"; }
85 ArpeggiatorSettings defaultArpSettings;
86};
Definition arpeggiator.h:46
Definition clip.h:46
Definition storage_manager.h:185
Definition instrument_clip.h:48
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:94
Definition mod_controllable.h:40
Definition model_stack.h:231
Definition model_stack.h:129
Definition model_stack.h:123
Definition param_manager.h:174
Definition storage_manager.h:119
Definition song.h:104
bool offerReceivedPitchBendToLearnedParams(MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, ModelStackWithTimelineCounter *modelStack) override
Pitch bend is available in the mod matrix as X and shouldn't be learned to params anymore (post 4....
Definition sound_instrument.h:47