Vital
Loading...
Searching...
No Matches
random_lfo_module.cpp
Go to the documentation of this file.
1#include "random_lfo_module.h"
2#include "random_lfo.h"
3
4namespace vital {
5
12 RandomLfoModule::RandomLfoModule(const std::string& prefix, const Output* beats_per_second) :
13 SynthModule(kNumInputs, 1), prefix_(prefix), beats_per_second_(beats_per_second) {
14 lfo_ = new RandomLfo();
16 }
17
28 Output* free_frequency = createPolyModControl(prefix_ + "_frequency");
29 Value* style = createBaseControl(prefix_ + "_style");
30 Value* stereo = createBaseControl(prefix_ + "_stereo");
31 Value* sync_type = createBaseControl(prefix_ + "_sync_type");
32
33 Output* frequency = createTempoSyncSwitch(prefix_, free_frequency->owner, beats_per_second_, true, input(kMidi));
36 lfo_->plug(frequency, RandomLfo::kFrequency);
39 lfo_->plug(sync_type, RandomLfo::kSync);
40 }
41
47 void RandomLfoModule::correctToTime(double seconds) {
48 lfo_->correctToTime(seconds);
49 }
50} // namespace vital
void useOutput(Output *output)
Uses an existing Output object as this Processor's first output.
Definition processor.cpp:138
force_inline Input * input(unsigned int index=0) const
Retrieves the Input pointer at a given index.
Definition processor.h:587
void useInput(Input *input)
Uses an existing Input object as this Processor's first input.
Definition processor.cpp:126
void plug(const Output *source)
Connects an external Output to this Processor's first input.
Definition processor.cpp:79
force_inline Output * output(unsigned int index=0) const
Retrieves the Output pointer at a given index.
Definition processor.h:616
virtual void addProcessor(Processor *processor)
Adds a Processor to be managed by this router.
Definition processor_router.cpp:121
A Low-Frequency Oscillator (LFO) that generates random modulation signals.
Definition random_lfo.h:16
void correctToTime(double seconds)
Adjusts the LFO to match a specific time reference (in seconds), for synchronization.
Definition random_lfo.cpp:283
@ kStereo
Definition random_lfo.h:60
@ kReset
Definition random_lfo.h:56
@ kStyle
Definition random_lfo.h:58
@ kFrequency
Definition random_lfo.h:54
@ kSync
Definition random_lfo.h:57
const Output * beats_per_second_
Definition random_lfo_module.h:67
RandomLfoModule(const std::string &prefix, const Output *beats_per_second)
Constructs a RandomLfoModule with a given prefix and a beats-per-second reference.
Definition random_lfo_module.cpp:12
RandomLfo * lfo_
Definition random_lfo_module.h:66
void correctToTime(double seconds) override
Adjusts the LFO to a given time position.
Definition random_lfo_module.cpp:47
std::string prefix_
Definition random_lfo_module.h:65
void init() override
Initializes the RandomLfoModule by creating and connecting control parameters to the internal RandomL...
Definition random_lfo_module.cpp:27
@ kNoteTrigger
Definition random_lfo_module.h:23
@ kMidi
Definition random_lfo_module.h:24
A ProcessorRouter that encapsulates a cohesive unit of functionality in the synthesizer.
Definition synth_module.h:129
Output * createPolyModControl(std::string name, bool audio_rate=false, bool smooth_value=false, Output *internal_modulation=nullptr, Input *reset=nullptr)
Creates a polyphonic mod control, including applying parameter scaling.
Definition synth_module.cpp:173
Value * createBaseControl(std::string name, bool audio_rate=false, bool smooth_value=false)
Creates a simple control processor for a given parameter name.
Definition synth_module.cpp:22
Output * createTempoSyncSwitch(std::string name, Processor *frequency, const Output *beats_per_second, bool poly, Input *midi=nullptr)
Creates a tempo sync switch that toggles between tempo-based frequency and free-running frequency.
Definition synth_module.cpp:289
A Processor that maintains and outputs a constant poly_float value.
Definition value.h:24
Contains classes and functions used within the Vital synthesizer framework.
Holds and manages a buffer of samples (poly_float) for a Processor's output.
Definition processor.h:35
Processor * owner
Owning processor.
Definition processor.h:112