Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
midi_param_collection.h
1/*
2 * Copyright © 2017-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/midi_engine.h"
22#include "modulation/params/param_collection.h"
23#include "util/containers.h"
24
25class Clip;
27class Serializer;
28class Deserializer;
29
30class MIDIParamCollection final : public ParamCollection {
31public:
32 MIDIParamCollection(ParamCollectionSummary* summary);
33 ~MIDIParamCollection() override;
36 void tickTicks(int32_t numSamples, ModelStackWithParamCollection* modelStack) override;
37
38 void tickSamples(int32_t numSamples, ModelStackWithParamCollection* modelStack) override {};
39 void setPlayPos(uint32_t pos, ModelStackWithParamCollection* modelStack, bool reversed) override;
40 void playbackHasEnded(ModelStackWithParamCollection* modelStack) override {}
41 void generateRepeats(ModelStackWithParamCollection* modelStack, uint32_t oldLength, uint32_t newLength,
42 bool shouldPingpong) override;
43 void appendParamCollection(ModelStackWithParamCollection* modelStack,
44 ModelStackWithParamCollection* otherModelStack, int32_t oldLength,
45 int32_t reverseThisRepeatWithLength, bool pingpongingGenerally) override;
46 void trimToLength(uint32_t newLength, ModelStackWithParamCollection* modelStack, Action* action,
47 bool maySetupPatching) override;
48 void shiftHorizontally(ModelStackWithParamCollection* modelStack, int32_t amount, int32_t effectiveLength) override;
49 void processCurrentPos(ModelStackWithParamCollection* modelStack, int32_t ticksSkipped, bool reversed,
50 bool didPingpong, bool mayInterpolate) override;
51 void remotelySwapParamState(AutoParamState* state, ModelStackWithParamId* modelStack) override;
52 void deleteAllAutomation(Action* action, ModelStackWithParamCollection* modelStack) override;
53 Error makeInterpolatedCCsGoodAgain(int32_t clipLength);
54 void grabValuesFromPos(uint32_t pos, ModelStackWithParamCollection* modelStack) override;
55 void nudgeNonInterpolatingNodesAtPos(int32_t pos, int32_t offset, int32_t lengthBeforeLoop, Action* action,
56 ModelStackWithParamCollection* modelStack) override;
57 ModelStackWithAutoParam* getAutoParamFromId(ModelStackWithParamId* modelStack, bool allowCreation = true) override;
58 static int32_t autoparamValueToCC(int32_t newValue);
59
60 void cloneFrom(ParamCollection* otherParamSet, bool copyAutomation);
61 void beenCloned(bool copyAutomation, int32_t reverseDirectionWithLength) override;
62 void sendMIDI(MIDISource source, int32_t channel, int32_t cc, int32_t newValue, int32_t midiOutputFilter);
63 void notifyParamModifiedInSomeWay(ModelStackWithAutoParam const* modelStack, int32_t oldValue,
64 bool automationChanged, bool automatedBefore, bool automatedNow) override;
65 bool mayParamInterpolate(int32_t paramId) override;
66 int32_t knobPosToParamValue(int32_t knobPos, ModelStackWithAutoParam* modelStack) override;
67 void notifyPingpongOccurred(ModelStackWithParamCollection* modelStack) override;
68
69 void writeToFile(Serializer& writer);
70 int32_t moveAutomationToDifferentCC(int32_t oldCC, int32_t newCC, ModelStackWithParamCollection* modelStack);
71
73
75 deluge::fast_map<uint8_t, AutoParam> params;
76
77 std::expected<typename decltype(params)::iterator, Error> getOrCreateParamFromCC(int32_t cc);
78
79private:
80 void deleteAllParams(Action* action = nullptr);
81};
Definition action.h:75
Definition clip.h:46
Definition storage_manager.h:185
void tickSamples(int32_t numSamples, ModelStackWithParamCollection *modelStack) override
tick interpolation by a number of ticks
Definition midi_param_collection.h:38
void tickTicks(int32_t numSamples, ModelStackWithParamCollection *modelStack) override
Definition midi_param_collection.cpp:46
Definition model_stack.h:251
Definition param_collection_summary.h:24
Definition storage_manager.h:119
Definition param.cpp:27
Kind
Definition param.h:42
@ MIDI
Internal representation for MIDI CCs.
Definition param.h:54