Modulators

typedef std::map<modulator_id_t, modulator_t> knm::sf::modulator_map_t

Represents a list of modulators.

struct modulator_id_t

An unique identifier for a modulator.

In SoundFont, a modulator is uniquely identified by the combination of its source, its destination and its amount source.

Public Functions

inline bool operator<(const modulator_id_t &other) const

Comparison operator for use in maps.

Public Members

modulator_source_t src

Source of the modulator.

generator_type_t dest

Destination generator.

modulator_source_t amount_src

The degree to which the source modulates the destination is to be controlled by this modulation source

struct modulator_t

Data attached a modulator (minus its ID)

Public Members

int16_t amount

Indicates the degree to which the source modulates the destination

modulator_transform_t transform

A transform of the specified type will be applied to the modulation source before application to the modulator

struct modulator_source_t

Represents a modulator source.

Public Functions

inline bool operator<(const modulator_source_t &other) const

Comparison operator for use in maps.

inline bool operator==(const modulator_source_t &other) const

Comparison operator for use in maps.

Public Members

modulator_source_type_t type

Type of the source (linear, convex, …)

modulator_source_direction_t direction

Direction (min to max, max to min)

modulator_source_polarity_t polarity

Polarity (unipolar, bipolar)

modulator_controller_type_t controller_type

The controller type (general or MIDI)

modulator_controller_source_t source

The source of the modulator (if general controller)

uint8_t midi

The MIDI controller number (if MIDI controller)

enum knm::sf::modulator_source_type_t

The different modulator source types.

Values:

enumerator MOD_SRC_TYPE_LINEAR

The SoundFont modulator controller moves linearly from the minimum to the maximum value in the direction and with the polarity specified.

enumerator MOD_SRC_TYPE_CONCAVE

The SoundFont modulator controller moves in a concave fashion from the minimum to the maximum value in the direction and with the polarity specified. The negative unipolar concave characteristic follows variations of the mathematical equation: output = -20/96 * log((value^2)/(range^2)) where value = input value - min value range = max value – min value.

enumerator MOD_SRC_TYPE_CONVEX

The SoundFont modulator controller moves in a convex fashion from the minimum to the maximum value in the direction and with the polarity specified. The convex curve is the same curve as the concave curve, except the start and end points are reversed.

enumerator MOD_SRC_TYPE_SWITCH

The SoundFont modulator controller output is at a minimum value while the controller input moves from the minimum to half of the maximum, after which the controller output is at a maximum. This occurs in the direction and with the polarity specified.

enum knm::sf::modulator_source_direction_t

The different modulator source directions.

Values:

enumerator MOD_SRC_DIR_MIN_TO_MAX

The direction of the controller should be from the minimum value to the maximum value.

enumerator MOD_SRC_DIR_MAX_TO_MIN

The direction of the controller should be from the maximum value to the minimum value.

enum knm::sf::modulator_source_polarity_t

The different modulator source polarities.

Values:

enumerator MOD_SRC_POL_UNIPOLAR

The controller should be mapped with a minimum value of 0 and a maximum value of 1.

enumerator MOD_SRC_POL_BIPOLAR

The controller should be mapped with a minimum value of -1 and a maximum value of 1.

enum knm::sf::modulator_controller_type_t

The different types of modulator controller.

Values:

enumerator MOD_CTRL_TYPE_SRC

The General Controller palette of controllers is selected. The ‘source’ field value corresponds to one of the controller sources.

enumerator MOD_CTRL_TYPE_MIDI

the MIDI Controller Palette is selected. The ‘source’ field value corresponds to one of the 128 MIDI Continuous Controller messages as defined in the MIDI specification.

enum knm::sf::modulator_controller_source_t

The different modulator source types (for General Controller modulator sources)

Values:

enumerator MOD_CTRL_SRC_NONE

No controller is to be used. The output of this controller module should be treated as if its value were set to ‘1’. It should not be a means to turn off a modulator.

enumerator MOD_CTRL_SRC_NOTE_ON_VELOCITY

The controller source to be used is the velocity value which is sent from the MIDI note-on command which generated the given sound.

enumerator MOD_CTRL_SRC_NOTE_ON_KEY_NUMBER

The controller source to be used is the key number value which was sent from the MIDI note-on command which generated the given sound.

enumerator MOD_CTRL_SRC_POLY_PRESSURE

The controller source to be used is the poly-pressure amount that is sent from the MIDI poly-pressure command.

enumerator MOD_CTRL_SRC_CHANNEL_PRESSURE

The controller source to be used is the channel pressure amount that is sent from the MIDI channel-pressure command.

enumerator MOD_CTRL_SRC_PITCH_WHEEL

The controller source to be used is the pitch wheel amount which is sent from the MIDI pitch wheel command.

enumerator MOD_CTRL_SRC_PITCH_WHEEL_SENSITIVITY

The controller source to be used is the pitch wheel sensitivity amount which is sent from the MIDI RPN 0 pitch wheel sensitivity command.

enum knm::sf::modulator_transform_t

The different types of modulator transforms.

The SoundFont v2.1 specification only defines one transform.

Values:

enumerator MOD_TRANSFORM_LINEAR