Struct rytm_rs::RytmProject

source ·
pub struct RytmProject { /* private fields */ }
Expand description

RytmProject represents the state of the analog rytm.

It contains all structures scoped to an Analog Rytm MKII FW 1.70 project.

Implementations§

source§

impl RytmProject

source

pub fn update_from_sysex_response( &mut self, response: &[u8] ) -> Result<(), RytmError>

Updates the Rytm struct from a sysex response.

All encoding/decoding is done in RytmProject, so this is the only method that needs to be called to update the struct when a sysex response is received.

Important

This method will act as a no-op if the given slice does not contain a valid sysex message. The check is performed by checking the first and last byte of the slice. This behaviour is preferred to returning an error, as it is expected to be called in a midi callback which receives not just sysex messages.

Errors

This method will return an error

  • If the sysex message is invalid in the context of Rytm
  • If the sysex message is valid, but the object type is not supported or implemented yet. Example: [crate::error::RytmError::SysexConversionError::Unimplemented] variant.
  • If the sysex message is incomplete, this sometimes happens in the initial parts of the transmission and is a behaviour of Rytm. You may check for the error [crate::error::RytmError::SysexConversionError::ShortRead] and ignore it.
  • If the sysex message is valid, but the size of the expected object does not match the size of the received object. This may happen if the firmware version of Rytm is different than the one this library supports which is currently FW 1.70 only. Never happened to me in practice but a cut transmission may also cause this in theory.
  • All other [crate::error::RytmError::SysexConversionError] variants are possible which are inherited from libanalogrytm.
source

pub fn patterns(&self) -> &[Pattern]

Get all patterns.

Total of 128 patterns.

source

pub fn kits(&self) -> &[Kit]

Get all kits.

Total of 128 kits.

source

pub const fn pool_sounds(&self) -> &[Sound]

Get all sounds in the pool.

Total of 128 sounds.

source

pub const fn globals(&self) -> &[Global]

Get all global slots.

Total of 4 global slots.

source

pub const fn settings(&self) -> &Settings

Get the settings.

source

pub fn patterns_mut(&mut self) -> &mut [Pattern]

Get all patterns mutably.

Total of 128 patterns.

source

pub fn kits_mut(&mut self) -> &mut [Kit]

Get all kits mutably.

Total of 128 kits.

source

pub fn pool_sounds_mut(&mut self) -> &mut [Sound]

Get all sounds in the pool mutably.

Total of 128 sounds.

source

pub fn globals_mut(&mut self) -> &mut [Global]

Get all global slots mutably.

Total of 4 global slots.

source

pub fn settings_mut(&mut self) -> &mut Settings

Get the settings mutably.

source

pub const fn work_buffer(&self) -> &RytmProjectWorkBuffer

Get the work buffer structures.

source

pub fn work_buffer_mut(&mut self) -> &mut RytmProjectWorkBuffer

Get the work buffer structures mutably.

Trait Implementations§

source§

impl Clone for RytmProject

source§

fn clone(&self) -> RytmProject

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for RytmProject

source§

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

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

impl Default for RytmProject

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for RytmProject

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RytmProject

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

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> 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,

§

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

§

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>,

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,