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
impl RytmProject
sourcepub fn update_from_sysex_response(
&mut self,
response: &[u8]
) -> Result<(), RytmError>
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.
sourcepub const fn pool_sounds(&self) -> &[Sound]
pub const fn pool_sounds(&self) -> &[Sound]
Get all sounds in the pool.
Total of 128 sounds.
sourcepub fn patterns_mut(&mut self) -> &mut [Pattern]
pub fn patterns_mut(&mut self) -> &mut [Pattern]
Get all patterns mutably.
Total of 128 patterns.
sourcepub fn pool_sounds_mut(&mut self) -> &mut [Sound]
pub fn pool_sounds_mut(&mut self) -> &mut [Sound]
Get all sounds in the pool mutably.
Total of 128 sounds.
sourcepub fn globals_mut(&mut self) -> &mut [Global]
pub fn globals_mut(&mut self) -> &mut [Global]
Get all global slots mutably.
Total of 4 global slots.
sourcepub fn settings_mut(&mut self) -> &mut Settings
pub fn settings_mut(&mut self) -> &mut Settings
Get the settings mutably.
sourcepub const fn work_buffer(&self) -> &RytmProjectWorkBuffer
pub const fn work_buffer(&self) -> &RytmProjectWorkBuffer
Get the work buffer structures.
sourcepub fn work_buffer_mut(&mut self) -> &mut RytmProjectWorkBuffer
pub fn work_buffer_mut(&mut self) -> &mut RytmProjectWorkBuffer
Get the work buffer structures mutably.
Trait Implementations§
source§impl Clone for RytmProject
impl Clone for RytmProject
source§fn clone(&self) -> RytmProject
fn clone(&self) -> RytmProject
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more