Skip to main content

Device

Struct Device 

Source
pub struct Device { /* private fields */ }
Expand description

Handle to the engine thread. Cheap methods; nothing blocks except the recv* calls.

Implementations§

Source§

impl Device

Source

pub fn spawn(config: Config) -> Device

Start the engine with no wake-up callback (poll or block on recv).

Source

pub fn spawn_with_waker( config: Config, wake: impl Fn() + Send + Sync + 'static, ) -> Device

Start the engine; wake runs after every batch of updates (e.g. to repaint a GUI).

Source

pub fn command(&self, c: Command)

Source

pub fn try_recv(&self) -> Result<Update, TryRecvError>

Source

pub fn recv(&self) -> Result<Update, RecvError>

Source

pub fn recv_timeout( &self, timeout: Duration, ) -> Result<Update, RecvTimeoutError>

Source

pub fn drain(&self) -> impl Iterator<Item = Update> + '_

Every update available right now, without blocking.

Source

pub fn connect(&self, port: impl Into<String>)

Source

pub fn disconnect(&self)

Source

pub fn resync(&self)

Source

pub fn set_sync(&self, on: bool)

Source

pub fn replay(&self, path: impl Into<PathBuf>, speed: f32)

Source

pub fn stop_replay(&self)

Source

pub fn send(&self, bytes: Vec<u8>)

Send a live message (CC/PC) now.

Source

pub fn write(&self, msgs: Vec<Vec<u8>>)

Queue messages behind any pending SysEx (writes wait for their ack).

Source

pub fn select_preset(&self, index: u8)

Select preset index (0-based, P01 = 0).

Source

pub fn set_head(&self, m: Module, model: u8, on: bool)

Set a module’s model and on/off. Ignored for LOOP/DRUM (no head CC).

Source

pub fn set_param(&self, m: Module, slot: usize, value: u8)

Set a module parameter by slot (app display order). Ignored for slots the module lacks.

Source

pub fn set_volume(&self, value: u8)

Source

pub fn show_page(&self, m: Module)

Make the pedal display jump to a module’s page.

Source

pub fn looper_button(&self, button: u8)

Press a looper button (host::LOOP_*).

Source

pub fn save_preset(&self, source_slot: u8, preset: &Preset)

Store preset in slot preset.index (with its name) and select it, using the official app’s sequence. source_slot is the active preset the edits were made on.

Source

pub fn import_user_amp( &self, slot: u8, name: &str, data: &[f32], factor: f32, ) -> Result<(), UploadError>

Import converted NAM data into user AMP slot (0–9) the way the official app does: select the slot’s amp model, write the slot-info record (name, factor), then the 2048 floats. Converting a .nam file into those floats is not implemented yet (docs/05).

Source

pub fn import_nam_file( &self, slot: u8, path: impl AsRef<Path>, ) -> Result<Converted, Box<dyn Error + Send + Sync>>

Convert a .nam file with the best conversion, Measure::Optimised (closer to the model on hardware than the official app’s) at a normalised level (crate::nam::convert::normalise_level), and import it into user AMP slot (0–9), named after the file like the official app does. Never reads the official app (see crate::nam::convert::official_excitation to opt in). The conversion runs on the calling thread and takes about a minute (optimised build); Device::import_nam_file_with with Measure::App gives the official algorithm in a few seconds. Returns the conversion.

Source

pub fn import_nam_file_with( &self, slot: u8, path: impl AsRef<Path>, measure: Measure, ) -> Result<Converted, Box<dyn Error + Send + Sync>>

Device::import_nam_file with a choice of conversion (Measure): Optimised (the default, about a minute), App (the official algorithm, a few seconds) or Clean. Keeps the model’s own level, as the official app does; Device::import_nam_file_as can normalise it.

Source

pub fn import_nam_file_as( &self, slot: u8, path: impl AsRef<Path>, measure: Measure, normalise: bool, ) -> Result<Converted, Box<dyn Error + Send + Sync>>

Device::import_nam_file_with, optionally normalising the output level (crate::nam::convert::normalise_level: every model plays at the same level, like NAM plugins do; a pure volume change).

Source

pub fn delete_user_amp(&self, slot: u8) -> Result<(), UploadError>

Delete user AMP slot and re-read its info, like the official app.

Source

pub fn rename_user_amp(&self, slot: u8, name: &str) -> Result<(), UploadError>

Rename user AMP slot (0–9) without touching its sound: write only the slot-info record (the import’s first step, factor 1.0 like every import) with the new name, then re-read it. The official app has no rename; this was confirmed on the pedal (the slot’s response is unchanged within 0.1 dB, docs/05). Names are cut to 31 characters.

Source

pub fn import_user_ir( &self, slot: u8, name: &str, data: &[f32], ) -> Result<(), UploadError>

Import IR data into user IR slot (0–9) the way the official app does: show the CAB page, select the slot’s cab model, write the 2048 floats, then the name. Only slot 0 has been captured; other slots are assumed to work the same way.

Source

pub fn rename_user_ir(&self, slot: u8, name: &str) -> Result<(), UploadError>

Rename user IR slot (0–9) without touching its sound: write only the 0x09 name record (the import’s last step), then re-read it. Confirmed on the pedal like Device::rename_user_amp. Names are cut to 31 characters; the official app’s imports use at most 16 (crate::ir::slot_name).

Source

pub fn import_ir_file( &self, slot: u8, path: impl AsRef<Path>, ) -> Result<ConvertedIr, Box<dyn Error + Send + Sync>>

Convert an IR audio file (WAV, any sample rate) with the best conversion, crate::ir::convert_optimised (a 384-tap filter fitted to the whole IR: the pedal only plays 384 taps, so this is much closer to the real IR than the official app’s), and import it into user IR slot (0–9), named after the file like the official app does (first 16 characters). Device::import_ir_file_with with Method::App gives exactly the official conversion. Returns the conversion.

Source

pub fn import_ir_file_with( &self, slot: u8, path: impl AsRef<Path>, method: Method, ) -> Result<ConvertedIr, Box<dyn Error + Send + Sync>>

Device::import_ir_file with a choice of conversion (crate::ir::Method).

Source

pub fn write_settings(&self, settings: &Settings)

Write the global settings (read-modify-write: start from the pedal’s current record).

Trait Implementations§

Source§

impl Drop for Device

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Device

§

impl !Sync for Device

§

impl !UnwindSafe for Device

§

impl Freeze for Device

§

impl Send for Device

§

impl Unpin for Device

§

impl UnsafeUnpin for Device

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.