Vital
Loading...
Searching...
No Matches
effects_modulation_handler.h
Go to the documentation of this file.
1#pragma once
2
3#include "synth_module.h"
4#include "producers_module.h"
5#include "voice_handler.h"
6#include "wavetable.h"
7#include "synth_types.h"
8#include "line_generator.h"
9
10#include <vector>
11
12namespace vital {
13
14 // Forward declarations
15 class AudioRateEnvelope;
16 class FiltersModule;
17 class LegatoFilter;
18 class LineMap;
19 class LfoModule;
20 class EnvelopeModule;
21 class RandomLfoModule;
22 class TriggerRandom;
23
34 public:
40 EffectsModulationHandler(Output* beats_per_second);
41
44
49 virtual Processor* clone() const override { VITAL_ASSERT(false); return nullptr; }
50
57 void init() override;
58
62 void prepareDestroy();
63
72 void process(int num_samples) override;
73
82 void noteOn(int note, mono_float velocity, int sample, int channel) override;
83
92 void noteOff(int note, mono_float lift, int sample, int channel) override;
93
102 bool shouldAccumulate(Output* output) override { return false; }
103
111 void correctToTime(double seconds) override;
112
119
125 void disableModSource(const std::string& source);
126
132 output_map& getPolyModulations() override;
133
139 ModulationConnectionBank& getModulationBank() { return modulation_bank_; }
140
147 LineGenerator* getLfoSource(int index) { return &lfo_sources_[index]; }
148
154 Output* getDirectOutput() { return getAccumulatedOutput(sub_direct_output_->output()); }
155
161 Output* note_retrigger() { return &note_retriggered_; }
162
168 Output* midi_offset_output() { return midi_offset_output_; }
169
170 private:
174 void createArticulation();
175
179 void createModulators();
180
186 void createFilters(Output* keytrack);
187
191 void setupPolyModulationReadouts();
192
196 ModulationConnectionBank modulation_bank_;
197
201 Output* beats_per_second_;
202
206 Processor* note_from_reference_;
207
211 Output* midi_offset_output_;
212
216 Processor* bent_midi_;
217
221 Processor* current_midi_note_;
222
226 FiltersModule* filters_module_;
227
231 LfoModule* lfos_[kNumLfos];
232
236 EnvelopeModule* envelopes_[kNumEnvelopes];
237
241 Output note_retriggered_;
242
246 LineGenerator lfo_sources_[kNumLfos];
247
251 TriggerRandom* random_;
252
256 RandomLfoModule* random_lfos_[kNumRandomLfos];
257
261 LineMap* note_mapping_;
262 LineMap* velocity_mapping_;
263 LineMap* aftertouch_mapping_;
264 LineMap* slide_mapping_;
265 LineMap* lift_mapping_;
266 LineMap* mod_wheel_mapping_;
267 LineMap* pitch_wheel_mapping_;
268
272 cr::Value* stereo_;
273
277 cr::Multiply* note_percentage_;
278
282 Multiply* output_;
283 Multiply* sub_direct_output_;
284
288 output_map poly_readouts_;
289
290 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EffectsModulationHandler)
291 };
292} // namespace vital
A class for generating and storing a line shape, defined by a series of points and associated powers.
Definition line_generator.h:20
A VoiceHandler extension managing various modulation sources for effects processing.
Definition effects_modulation_handler.h:33
LineGenerator * getLfoSource(int index)
Retrieves a pointer to one of the internal LFO line generators.
Definition effects_modulation_handler.h:147
ModulationConnectionBank & getModulationBank()
Returns a reference to the modulation connection bank.
Definition effects_modulation_handler.h:139
void correctToTime(double seconds) override
Synchronizes internal modulator phases to a given absolute time.
Definition effects_modulation_handler.cpp:362
void disableUnnecessaryModSources()
Disables all modulation sources that are not strictly necessary.
Definition effects_modulation_handler.cpp:370
void prepareDestroy()
Prepares the object for destruction by removing all modulation processors.
Definition effects_modulation_handler.cpp:130
output_map & getPolyModulations() override
Returns a reference to the polyphonic modulation output map.
Definition effects_modulation_handler.cpp:404
virtual ~EffectsModulationHandler()
Default destructor. Cleans up allocated resources.
Definition effects_modulation_handler.h:43
Output * getDirectOutput()
Retrieves the direct output used for sub-mixing signals.
Definition effects_modulation_handler.h:154
virtual Processor * clone() const override
Creates a clone of this Processor. (Not implemented for EffectsModulationHandler).
Definition effects_modulation_handler.h:49
void disableModSource(const std::string &source)
Disables a specific modulation source by name.
Definition effects_modulation_handler.cpp:385
void init() override
Initializes internal processors and modulation sources.
Definition effects_modulation_handler.cpp:56
bool shouldAccumulate(Output *output) override
Indicates whether an Output should accumulate (sum) multiple voices.
Definition effects_modulation_handler.h:102
Output * midi_offset_output()
Returns a pointer to the MIDI offset output used in pitch computations.
Definition effects_modulation_handler.h:168
EffectsModulationHandler(Output *beats_per_second)
Constructs an EffectsModulationHandler given a beats-per-second output reference.
Definition effects_modulation_handler.cpp:23
void noteOff(int note, mono_float lift, int sample, int channel) override
Handles note-off events, ending envelopes and other modulation if needed.
Definition effects_modulation_handler.cpp:350
Output * note_retrigger()
Provides access to a note-retriggered output, triggered on each note-on event.
Definition effects_modulation_handler.h:161
void noteOn(int note, mono_float velocity, int sample, int channel) override
Handles note-on events, triggering envelopes and other modulation if needed.
Definition effects_modulation_handler.cpp:333
void process(int num_samples) override
Processes audio/midi data for a block of samples.
Definition effects_modulation_handler.cpp:293
A module that generates an envelope signal (ADSR-like) controlled by various parameters.
Definition envelope_module.h:17
A module that manages two filter modules and provides multiple routing configurations.
Definition filters_module.h:16
A module that generates a Low-Frequency Oscillation (LFO) signal from a LineGenerator source.
Definition lfo_module.h:18
A processor that maps a phase input through a line generator, producing a value and phase output.
Definition line_map.h:16
A container managing a fixed number of ModulationConnections.
Definition synth_types.h:87
Multiplies two input buffers sample-by-sample.
Definition operators.h:318
Base class for all signal-processing units in Vital.
Definition processor.h:212
force_inline Output * output(unsigned int index=0) const
Retrieves the Output pointer at a given index.
Definition processor.h:616
A module that produces random low-frequency oscillations (LFOs) for modulation purposes.
Definition random_lfo_module.h:16
A processor that outputs a random value on a trigger event.
Definition trigger_random.h:15
A SynthModule and NoteHandler that manages a pool of polyphonic voices, handles note-on/off logic,...
Definition voice_handler.h:380
force_inline Output * velocity()
Returns a pointer to velocity, the note-on velocity.
Definition voice_handler.h:634
force_inline Output * note()
Returns a pointer to the note Output, giving the current tuned note frequency or pitch.
Definition voice_handler.h:616
force_inline Output * channel()
Returns a pointer to channel, indicating the MIDI channel of the voice.
Definition voice_handler.h:631
force_inline Output * getAccumulatedOutput(Output *output)
Retrieves the accumulated Output associated with a given output pointer.
Definition voice_handler.h:665
force_inline Output * lift()
Returns a pointer to lift, the note-off velocity or release velocity.
Definition voice_handler.h:637
Control-rate multiplication of two values.
Definition operators.h:719
A control-rate variant of the Value processor.
Definition value.h:82
#define VITAL_ASSERT(x)
Definition common.h:11
Contains classes and functions used within the Vital synthesizer framework.
std::map< std::string, Output * > output_map
Maps parameter names to Output pointers, representing output signals from various modules.
Definition synth_types.h:229
constexpr int kNumRandomLfos
Number of random LFO sources (random modulation generators).
Definition synth_constants.h:25
constexpr int kNumEnvelopes
Number of envelope generators in Vital.
Definition synth_constants.h:22
constexpr int kNumLfos
Number of LFO sources available in the Vital synthesizer.
Definition synth_constants.h:13
float mono_float
Definition common.h:33
Holds and manages a buffer of samples (poly_float) for a Processor's output.
Definition processor.h:35
Defines the SynthModule class which extends ProcessorRouter to form a building block of the Vital syn...
Declares classes and data structures to handle polyphonic voices in Vital, including voice assignment...