Skip to main content

Algorithm

Struct Algorithm 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: &'static str

Name 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 str

Name written out, such as Room Reverb.

§category: &'static str

The 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

Source

pub fn all() -> &'static [Self; 35]

Every algorithm, in the order the newest firmware numbers them.

Source

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.

Source

pub fn by_name(name: &str) -> Option<&'static Self>

Returns the algorithm of this name, as the display writes it.

Source

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.

Source

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”.

Source

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]);
Source

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);
Source

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));
Source

pub fn has(&self, character: Character) -> bool

Returns whether this effect has character.

Source

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());
Source

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.

Source

pub fn slot_of( &self, engine: Engine, parameter: ParamId, ) -> Option<&'static FxSlot>

Returns the slot an engine’s parameter is, under this algorithm.

None when the parameter is not one of that engine’s twelve, and when it is one the algorithm leaves unused.

Trait Implementations§

Source§

impl Clone for Algorithm

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Algorithm

Source§

impl Debug for Algorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Algorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Algorithm

Source§

impl Hash for Algorithm

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Algorithm

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Algorithm

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Algorithm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.