#[non_exhaustive]pub struct Algorithm {
pub name: &'static str,
pub full_name: &'static str,
pub category: &'static str,
pub slots: &'static [FxSlot],
/* private fields */
}Expand description
One of the algorithms an effect engine can run.
Reached through Algorithm::for_value, which takes the byte FX n Type
holds and the firmware that byte is to be read against.
§Every value is an effect
There is no Off, None or Thru, and no engine that is running nothing.
Section 7.2.4 of the manual — “To load an effect into a slot … select
from one of the following effects” — lists these 35 and stops, and the
effects table in section 9.1 gives the same 35. FX n Type is declared
0..=34 to match, so there is no value outside the table either.
What takes effects out of circuit is the Bypass Mode, and that is the whole
block of four rather than one engine. Three algorithms carry their own
bypass in one of their twelve bytes instead, which is
FxSlot::is_enable.
A host looking for the parameter that silences one engine will not find one.
FX n Output Gain is not it: the manual defines a slot’s level as the level
of an effect that is in parallel or last before the output stage, so on six
of the ten Routings an engine at zero gain still feeds the next engine.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: &'static strName as the synthesizer’s display writes it, such as RoomRev.
The same name the FX Type value table gives, which is what joins the
two across a firmware renumbering.
full_name: &'static strName written out, such as Room Reverb.
category: &'static strThe family the manual groups it with: Reverb, Delay, Processing
or Creative.
The manual’s own table of contents. Algorithm::family is what an
effect does to a signal, which is the finer question and the one a mark
is chosen by.
slots: &'static [FxSlot]The slots it uses, in slot order.
Shorter than SLOTS_PER_ENGINE where the algorithm has fewer
parameters, which is how a host learns not to draw controls that do
nothing.
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn all() -> &'static [Self; 35]
pub fn all() -> &'static [Self; 35]
Every algorithm, in the order the newest firmware numbers them.
Sourcepub fn for_value(value: u8, firmware: Version) -> Option<&'static Self>
pub fn for_value(value: u8, firmware: Version) -> Option<&'static Self>
Returns the algorithm a FX n Type value of value selects on
firmware.
Goes through the FX Type value table rather than indexing this list,
because firmware 1.1 inserted an algorithm rather than appending one:
33 is Rotary Speaker on 1.0 and Vintage Pitch on 1.1.
None for a byte the firmware’s table does not list.
Sourcepub fn by_name(name: &str) -> Option<&'static Self>
pub fn by_name(name: &str) -> Option<&'static Self>
Returns the algorithm of this name, as the display writes it.
Sourcepub fn value_for(&self, firmware: Version) -> Option<u8>
pub fn value_for(&self, firmware: Version) -> Option<u8>
Returns the FX n Type value that selects this algorithm on firmware.
None where that firmware does not offer it, which is Vintage Pitch on
1.0 and is the reason this is not a field.
Sourcepub fn slot(&self, slot: u8) -> Option<&'static FxSlot>
pub fn slot(&self, slot: u8) -> Option<&'static FxSlot>
Returns one of its slots, counting from 1.
None for a slot this algorithm does not use, which is the same answer
as “draw nothing here”.
Sourcepub fn panel(&self) -> &'static Panel
pub fn panel(&self) -> &'static Panel
Returns what this algorithm’s own editor panel is made of.
Measured off the figure the manual prints beside each algorithm’s FX page in section 9.3. A Room Reverb and a Phaser are drawn differently there, so this says which.
use deepmind_midi::effect::{Algorithm, Control};
use deepmind_midi::param::DEFAULT_FIRMWARE;
let room = Algorithm::for_value(2, DEFAULT_FIRMWARE).expect("a Room Reverb");
assert_eq!(room.panel().control(), Control::Fader);
assert_eq!(room.panel().cap().to_rgb(), [0x98, 0x93, 0x88]);Sourcepub const fn family(&self) -> Family
pub const fn family(&self) -> Family
Returns what this effect does to a signal.
category is the four buckets the manual’s table of
contents uses, and Creative holds the phaser, the pitch shifter and
the rotary speaker, which do three unrelated things. This is the same
kind of published fact at the resolution a symbol needs.
use deepmind_midi::effect::{Algorithm, Family};
let phaser = Algorithm::by_name("Phaser").expect("a Phaser");
assert_eq!(phaser.category, "Creative");
assert_eq!(phaser.family(), Family::Modulation);
let rotary = Algorithm::by_name("RotarySpkr").expect("a Rotary Speaker");
assert_eq!(rotary.category, "Creative");
assert_eq!(rotary.family(), Family::Rotary);Sourcepub const fn characters(&self) -> &'static [Character]
pub const fn characters(&self) -> &'static [Character]
Returns what kind of thing this effect is, beside what it does.
Any number of Characters, in the order the specification declares
them, and empty for an algorithm with nothing to say beyond its
family: the plain reverbs and the noise gate. A host
reads these to draw a vintage unit as one, a stereo pair as a pair, two
effects in one engine as two, and it reads them here rather than
matching on Vintage in a name.
use deepmind_midi::effect::{Algorithm, Character};
let tel_ray = Algorithm::by_name("T-RayDelay").expect("a Tel-Ray Delay");
assert!(tel_ray.characters().contains(&Character::Vintage));
assert!(tel_ray.characters().contains(&Character::LoFi));
let hall = Algorithm::by_name("HallRev").expect("a Hall Reverb");
assert!(!hall.characters().contains(&Character::Vintage));
assert!(hall.has(Character::Modulated));Sourcepub fn mark(&self) -> &'static Mark
pub fn mark(&self) -> &'static Mark
Returns the mark to draw for this effect.
Its own where it has one, and its
family’s otherwise: a plate reverb is drawn as a plate
with wavefronts leaving it, a hall as wavefronts far from their source,
and an ambient reverb, which is a reverb and nothing a symbol can add
to, as the family’s source and two wavefronts. Either way it is the
same language, so the four engines read as one set whichever marks
they land on.
use deepmind_midi::effect::{Algorithm, Family};
let plate = Algorithm::by_name("PlateRev").expect("a Plate Reverb");
let ambient = Algorithm::by_name("AmbVerb").expect("an Ambient Reverb");
assert!(plate.own_mark().is_some());
assert!(ambient.own_mark().is_none());
assert_eq!(ambient.mark(), Family::Reverb.mark());
assert_ne!(plate.mark(), Family::Reverb.mark());Sourcepub fn own_mark(&self) -> Option<&'static Mark>
pub fn own_mark(&self) -> Option<&'static Mark>
Returns the mark drawn for this effect’s kind, where its kind is something a symbol can carry.
None for an algorithm whose family says everything a symbol can: a
host that wants to know whether the mark it is about to draw is the
family’s or finer asks here. spec/marks.toml says which kinds are
drawn and why.