Vital
Loading...
Searching...
No Matches
producers_module.h
Go to the documentation of this file.
1#pragma once
2
3#include "synth_module.h"
4#include "oscillator_module.h"
5#include "sample_module.h"
6
7namespace vital {
8
18 public:
23 enum {
30 };
31
36 enum {
42 };
43
50 static force_inline int getFirstModulationIndex(int index) {
51 return index == 0 ? 1 : 0;
52 }
53
60 static force_inline int getSecondModulationIndex(int index) {
61 return index == 1 ? 2 : (getFirstModulationIndex(index) + 1);
62 }
63
70
74 virtual ~ProducersModule() { }
75
84 void process(int num_samples) override;
85
92 void init() override;
93
99 virtual Processor* clone() const override { return new ProducersModule(*this); }
100
108 return oscillators_[index]->getWavetable();
109 }
110
117
124
130 void setFilter1On(const Value* on) { filter1_on_ = on; }
131
137 void setFilter2On(const Value* on) { filter2_on_ = on; }
138
139 protected:
145 bool isFilter1On() { return filter1_on_ == nullptr || filter1_on_->value() != 0.0f; }
146
152 bool isFilter2On() { return filter2_on_ == nullptr || filter2_on_->value() != 0.0f; }
153
158
165
170
175
180
185
186 JUCE_LEAK_DETECTOR(ProducersModule)
187 };
188} // namespace vital
A synthesis module that represents an oscillator within the Vital synthesizer.
Definition oscillator_module.h:16
Wavetable * getWavetable()
Returns the associated Wavetable object.
Definition oscillator_module.h:80
Base class for all signal-processing units in Vital.
Definition processor.h:212
A module that manages multiple audio producers (oscillators and sampler) and routes their outputs.
Definition producers_module.h:17
ProducersModule()
Constructs a ProducersModule.
Definition producers_module.cpp:10
bool isFilter1On()
Checks if Filter 1 is on.
Definition producers_module.h:145
bool isFilter2On()
Checks if Filter 2 is on.
Definition producers_module.h:152
void setFilter2On(const Value *on)
Sets a Value that determines if Filter 2 is on.
Definition producers_module.h:137
const Value * filter2_on_
A Value controlling the state of Filter 2.
Definition producers_module.h:184
@ kActiveVoices
Definition producers_module.h:27
@ kReset
Definition producers_module.h:24
@ kMidi
Definition producers_module.h:26
@ kNoteCount
Definition producers_module.h:28
@ kNumInputs
Definition producers_module.h:29
@ kRetrigger
Definition producers_module.h:25
static force_inline int getFirstModulationIndex(int index)
Helper function to determine the first modulation index for a given oscillator index.
Definition producers_module.h:50
SampleModule * sampler_
The sampler module that provides sampled audio.
Definition producers_module.h:174
const Value * filter1_on_
A Value controlling the state of Filter 1.
Definition producers_module.h:179
Value * oscillator_destinations_[kNumOscillators]
An array of Values determining the destination for each oscillator.
Definition producers_module.h:164
void setFilter1On(const Value *on)
Sets a Value that determines if Filter 1 is on.
Definition producers_module.h:130
void init() override
Initializes the module and sets up parameter connections.
Definition producers_module.cpp:35
virtual Processor * clone() const override
Clones this ProducersModule.
Definition producers_module.h:99
Value * sample_destination_
A Value determining the output destination for the sample.
Definition producers_module.h:169
@ kRawOut
Definition producers_module.h:39
@ kToFilter1
Definition producers_module.h:37
@ kNumOutputs
Definition producers_module.h:41
@ kDirectOut
Definition producers_module.h:40
@ kToFilter2
Definition producers_module.h:38
Wavetable * getWavetable(int index)
Retrieves the Wavetable associated with a specified oscillator.
Definition producers_module.h:107
void process(int num_samples) override
Processes the audio for a given number of samples.
Definition producers_module.cpp:71
Output * samplePhaseOutput()
Gets the output phase of the sampler.
Definition producers_module.h:123
Sample * getSample()
Retrieves the current Sample used by the sampler.
Definition producers_module.h:116
OscillatorModule * oscillators_[kNumOscillators]
An array of oscillator modules managed by this ProducersModule.
Definition producers_module.h:157
static force_inline int getSecondModulationIndex(int index)
Helper function to determine the second modulation index for a given oscillator index.
Definition producers_module.h:60
virtual ~ProducersModule()
Destructor.
Definition producers_module.h:74
Holds and manages a single sampled waveform, including stereo or mono data and multiple band-limited ...
Definition sample_source.h:25
A module that plays back a sample (audio file) as part of the synthesis pipeline.
Definition sample_module.h:16
force_inline Output * getPhaseOutput() const
Retrieves the phase output of the sampler.
Definition sample_module.h:85
Sample * getSample()
Gets the Sample object used by the sampler.
Definition sample_module.h:78
A ProcessorRouter that encapsulates a cohesive unit of functionality in the synthesizer.
Definition synth_module.h:129
A Processor that maintains and outputs a constant poly_float value.
Definition value.h:24
force_inline mono_float value() const
Returns the current mono_float value of the first lane.
Definition value.h:60
A class representing a wavetable, holding multiple frames of waveforms and their frequency-domain rep...
Definition wavetable.h:20
#define force_inline
Definition common.h:23
Contains classes and functions used within the Vital synthesizer framework.
constexpr int kNumOscillators
Number of oscillators available in Vital.
Definition synth_constants.h:16
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...