SoundFontInfoLib
2.21.6
Library for parsing and rendering SF2 files
|
Render-side modulator that understands how to fetch source values that will be used to modulate voice state. More...
#include <Modulator.hpp>
Public Member Functions | |
Modulator (size_t index, const Entity::Modulator::Modulator &configuration, const Voice::State &state) | |
Construct new modulator. More... | |
double | value () const |
const Entity::Modulator::Modulator & | configuration () const |
size_t | index () const |
void | flagInvalid () |
bool | isValid () const |
void | setSource (const Modulator &modulator) |
Resolve the linking between two modulators. More... | |
std::string | description () const |
Render-side modulator that understands how to fetch source values that will be used to modulate voice state.
Per the SF2 spec, a modulator does the following:
The Sv and Av transformations are done in the Transform class.
The Modulator instances operate in a 'pull' fashion: a call to their value()
method fetches source values, which may themselves be modulator instances. In this way, the value()
method will always return the most up-to-date values.
Modulator::Modulator | ( | size_t | index, |
const Entity::Modulator::Modulator & | configuration, | ||
const Voice::State & | state | ||
) |
Construct new modulator.
index | the index of the entity in the zone |
configuration | the entity configuration that defines the modulator |
state | the voice state that can be used as a source for modulators |
References configuration(), SF2::Logger::debug(), SF2::Entity::Modulator::Modulator::description(), and index().
|
inline |
Referenced by description(), and Modulator().
std::string Modulator::description | ( | ) | const |
References configuration(), and SF2::Entity::Modulator::Modulator::description().
|
inline |
|
inline |
Referenced by Modulator().
|
inline |
Referenced by value().
|
inline |
Resolve the linking between two modulators.
Configures this modulator to invoke the value()
method of another to obtain an Sv value. Per spec, linking is NOT allowed for Av values. Also per spec, source values fall in range 0-127 and are transformed into unipolar or bipolar ranges depending on their definition. This makes linking a bit strange: the 'source' modulator generates a unipolar or bipolar value per its definition, but unipolar is only useful in the linked case, and its amount
must be 127 or 128 in order to get back a value that is reasonable to use as a source value for another modulator.
modulator | provider for an Sv to use for this modulator |
References value().
|
inline |
References isValid(), and SF2::MIDI::ValueTransformer::value().
Referenced by setSource().