Vital
Loading...
Searching...
No Matches
formant_manager.cpp
Go to the documentation of this file.
1#include "formant_manager.h"
2
3#include "digital_svf.h"
4#include "operators.h"
5
6namespace vital {
7
9 for (int i = 0; i < num_formants; ++i) {
10 DigitalSvf* formant = new DigitalSvf();
12 formants_.push_back(formant);
13 addProcessor(formant);
14 }
15 }
16
18 int num_formants = static_cast<int>(formants_.size());
19 VariableAdd* total = new VariableAdd(num_formants);
20 for (DigitalSvf* formant : formants_)
21 total->plugNext(formant);
22
23 addProcessor(total);
24 total->useOutput(output(0), 0);
25
27 }
28
30 for (DigitalSvf* formant : formants_)
31 getLocalProcessor(formant)->reset(reset_mask);
32 }
33
35 for (DigitalSvf* formant : formants_)
36 getLocalProcessor(formant)->hardReset();
37 }
38} // namespace vital
A state-variable filter (SVF) implementation, supporting multiple filter types (12/24 dB,...
Definition digital_svf.h:17
void setResonanceBounds(mono_float min, mono_float max)
Sets the minimum and maximum resonance for the filter (used in resonance interpolation).
Definition digital_svf.cpp:332
static constexpr mono_float kMinResonance
Minimum allowed resonance for each DigitalSvf in this manager.
Definition formant_manager.h:23
void reset(poly_mask reset_mask) override
Resets stateful data (e.g., filter history) in each DigitalSvf for voices indicated by the reset_mask...
Definition formant_manager.cpp:29
static constexpr mono_float kMaxResonance
Maximum allowed resonance for each DigitalSvf in this manager.
Definition formant_manager.h:28
void hardReset() override
Fully resets all formants (for all voices).
Definition formant_manager.cpp:34
virtual void init() override
Initializes the internal routing of formant filters, creating the summing processor.
Definition formant_manager.cpp:17
FormantManager(int num_formants=4)
Constructs a FormantManager to hold a given number of DigitalSvf formants.
Definition formant_manager.cpp:8
std::vector< DigitalSvf * > formants_
A list of DigitalSvf pointers, each representing a vowel formant or similar resonant filter.
Definition formant_manager.h:87
void plugNext(const Output *source)
Connects an external Output to the first available (unplugged) input.
Definition processor.cpp:104
void useOutput(Output *output)
Uses an existing Output object as this Processor's first output.
Definition processor.cpp:138
virtual void hardReset()
Called to perform a "hard" reset for all voices.
Definition processor.h:272
force_inline Output * output(unsigned int index=0) const
Retrieves the Output pointer at a given index.
Definition processor.h:616
virtual void reset(poly_mask reset_mask)
Called to reset the Processor's per-voice state (e.g., on note-on).
Definition processor.h:267
A specialized Processor that manages a directed graph of Processors and ensures correct processing or...
Definition processor_router.h:34
virtual void init() override
Initializes the ProcessorRouter and all its Processors.
Definition processor_router.cpp:84
Processor * getLocalProcessor(const Processor *global_processor)
Retrieves the local instance of a globally defined Processor.
Definition processor_router.cpp:376
virtual void addProcessor(Processor *processor)
Adds a Processor to be managed by this router.
Definition processor_router.cpp:121
Adds together an arbitrary number of inputs.
Definition operators.h:228
Contains classes and functions used within the Vital synthesizer framework.
Represents a vector of integer values using SIMD instructions.
Definition poly_values.h:56