pub struct Sound { /* private fields */ }
Expand description
Represents a sound in the analog rytm.
This structure does not map identically to the relevant structure in the firmware.
Implementations§
source§impl Sound
impl Sound
sourcepub fn link_parameter_lock_pool(
&mut self,
parameter_lock_pool: &Arc<Mutex<ParameterLockPool>>
) -> Result<(), RytmError>
pub fn link_parameter_lock_pool( &mut self, parameter_lock_pool: &Arc<Mutex<ParameterLockPool>> ) -> Result<(), RytmError>
Links a pattern’s parameter lock pool to this sound.
This way, one can set parameter locks for trigs for the machine assigned to this sound.
Errors
Sound must be a track sound. This is necessary because the pattern’s parameter lock pool belongs to a pattern but sounds are not. Sounds are received with different query compared to patterns.
Calling this method on a pool sound will result in an error.
sourcepub const fn sound_type(&self) -> SoundType
pub const fn sound_type(&self) -> SoundType
Returns the type of the sound.
sourcepub const fn is_pool_sound(&self) -> bool
pub const fn is_pool_sound(&self) -> bool
Returns if the sound is coming from the sound pool.
sourcepub const fn is_work_buffer_sound(&self) -> bool
pub const fn is_work_buffer_sound(&self) -> bool
Returns if the sound is coming from the work buffer and assigned to a track.
sourcepub const fn is_part_of_a_kit_query(&self) -> bool
pub const fn is_part_of_a_kit_query(&self) -> bool
Returns if the sound is coming from a kit query and loaded as a part of a kit.
sourcepub fn set_name(&mut self, name: &str) -> Result<(), RytmError>
pub fn set_name(&mut self, name: &str) -> Result<(), RytmError>
Sets the name of the sound.
Errors
The name must be ASCII and have a length of 15 characters or less. Other cases will result in an error.
sourcepub fn set_accent_level(&mut self, accent_level: usize) -> Result<(), RytmError>
pub fn set_accent_level(&mut self, accent_level: usize) -> Result<(), RytmError>
Sets the accent level of the sound.
Range: 0..=127
sourcepub const fn assigned_track(&self) -> Option<usize>
pub const fn assigned_track(&self) -> Option<usize>
Returns the assigned track if this is a track sound.
Returns None
if this is not a track sound.
Range: 0..=11
sourcepub const fn kit_number(&self) -> Option<usize>
pub const fn kit_number(&self) -> Option<usize>
Returns the kit number if this sound is a part of a kit.
Returns None
if this is not a kit sound.
Range: 0..=127
sourcepub const fn pool_index(&self) -> Option<usize>
pub const fn pool_index(&self) -> Option<usize>
Returns the kit number if this sound is a part of a kit.
Returns None
if this is not a kit sound.
Range: 0..=127
sourcepub const fn accent_level(&self) -> usize
pub const fn accent_level(&self) -> usize
Returns the accent level of the sound.
Range: 0..=127
sourcepub const fn amplitude(&self) -> &Amplitude
pub const fn amplitude(&self) -> &Amplitude
Returns the amplitude page parameters of the sound.
sourcepub const fn settings(&self) -> &SoundSettings
pub const fn settings(&self) -> &SoundSettings
Returns sound settings of the sound.
sourcepub const fn machine_parameters(&self) -> &MachineParameters
pub const fn machine_parameters(&self) -> &MachineParameters
Returns the machine parameters of the sound.
sourcepub fn sample_mut(&mut self) -> &mut Sample
pub fn sample_mut(&mut self) -> &mut Sample
Returns the sample page parameters of the sound mutably.
sourcepub fn filter_mut(&mut self) -> &mut Filter
pub fn filter_mut(&mut self) -> &mut Filter
Returns the filter page parameters of the sound mutably.
sourcepub fn amplitude_mut(&mut self) -> &mut Amplitude
pub fn amplitude_mut(&mut self) -> &mut Amplitude
Returns the amplitude page parameters of the sound mutably.
sourcepub fn settings_mut(&mut self) -> &mut SoundSettings
pub fn settings_mut(&mut self) -> &mut SoundSettings
Returns sound settings of the sound mutably.
sourcepub fn machine_parameters_mut(&mut self) -> &mut MachineParameters
pub fn machine_parameters_mut(&mut self) -> &mut MachineParameters
Returns the machine parameters of the sound mutably.
sourcepub const fn structure_version(&self) -> u32
pub const fn structure_version(&self) -> u32
Returns the version of the sound structure.
sourcepub fn try_default(sound_index: usize) -> Result<Self, RytmError>
pub fn try_default(sound_index: usize) -> Result<Self, RytmError>
Makes a new pool sound with the given index complying to project defaults.
Range: 0..=127
sourcepub fn try_kit_default(
track_index: usize,
kit_index: usize,
sysex_meta: SysexMeta
) -> Result<Self, RytmError>
pub fn try_kit_default( track_index: usize, kit_index: usize, sysex_meta: SysexMeta ) -> Result<Self, RytmError>
Makes a new sound with the given index complying to project defaults as if it comes from a part of a kit.
Track index range: 0..=11
Kit index range: 0..=127
sourcepub fn try_work_buffer_default(track_index: usize) -> Result<Self, RytmError>
pub fn try_work_buffer_default(track_index: usize) -> Result<Self, RytmError>
Makes a new sound with the given index complying to project defaults as if it comes from the work buffer.
Track index range: 0..=11
sourcepub fn set_machine_type(
&mut self,
machine_type: MachineType
) -> Result<(), RytmError>
pub fn set_machine_type( &mut self, machine_type: MachineType ) -> Result<(), RytmError>
Sets the machine type of the sound.
Errors
Not every machine type could be set for every sound if they’re assigned to a track.
For the sounds which are assigned to a track, the machine type must be compatible with the track or an error will be returned.
For pool sounds this function will always succeed.
sourcepub const fn machine_type(&self) -> MachineType
pub const fn machine_type(&self) -> MachineType
Returns the machine type of the sound.