[−][src]Module lv2_atom::scalar
Scalar, single-value atoms.
These atoms are the simplest of them all: They are simply represented by an internal type and their values can simply be copied. Due to this common behaviour, there is another trait called ScalarAtom
which provides this behaviour. Every type that implements ScalarAtom
also implements Atom
.
Unlike other atoms, scalars do not need to be written after the initialization. However, you still can modify the scalar after it was initialized.
Example
use lv2_core::prelude::*; use lv2_atom::prelude::*; #[derive(PortCollection)] struct MyPorts { input: InputPort<AtomPort>, output: OutputPort<AtomPort>, } /// Something like a plugin's run method. fn run(ports: &mut MyPorts, urids: &AtomURIDCollection) { // Scalar atoms don't need a reading parameter. let read_value: f32 = ports.input.read(urids.float, ()).unwrap(); // Writing is done with the value of the atom. // You can modify it afterwards. let written_value: &mut f32 = ports.output.init(urids.float, 17.0).unwrap(); }
Specification
Structs
AtomURID | A scalar atom containing a URID. |
Bool | A scalar atom representing a boolean. |
Double | A scalar atom containing a |
Float | A scalar atom containing a |
Int | A scalar atom containing a |
Long | A scalar atom containing a |
Traits
ScalarAtom | An atom that only contains a single, scalar value. |