Struct rytm_rs::object::sound::Sound

source ·
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

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.

source

pub const fn sound_type(&self) -> SoundType

Returns the type of the sound.

source

pub const fn is_pool_sound(&self) -> bool

Returns if the sound is coming from the sound pool.

source

pub const fn is_work_buffer_sound(&self) -> bool

Returns if the sound is coming from the work buffer and assigned to a track.

source

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.

source

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.

source

pub fn set_accent_level(&mut self, accent_level: usize) -> Result<(), RytmError>

Sets the accent level of the sound.

Range: 0..=127

source

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

source

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

source

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

source

pub const fn accent_level(&self) -> usize

Returns the accent level of the sound.

Range: 0..=127

source

pub fn name(&self) -> &str

Returns the name of the sound.

source

pub const fn sample(&self) -> &Sample

Returns the sample page parameters of the sound.

source

pub const fn filter(&self) -> &Filter

Returns the filter page parameters of the sound.

source

pub const fn amplitude(&self) -> &Amplitude

Returns the amplitude page parameters of the sound.

source

pub const fn lfo(&self) -> &Lfo

Returns the LFO page parameters of the sound.

source

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

Returns sound settings of the sound.

source

pub const fn machine_parameters(&self) -> &MachineParameters

Returns the machine parameters of the sound.

source

pub fn sample_mut(&mut self) -> &mut Sample

Returns the sample page parameters of the sound mutably.

source

pub fn filter_mut(&mut self) -> &mut Filter

Returns the filter page parameters of the sound mutably.

source

pub fn amplitude_mut(&mut self) -> &mut Amplitude

Returns the amplitude page parameters of the sound mutably.

source

pub fn lfo_mut(&mut self) -> &mut Lfo

Returns the LFO page parameters of the sound mutably.

source

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

Returns sound settings of the sound mutably.

source

pub fn machine_parameters_mut(&mut self) -> &mut MachineParameters

Returns the machine parameters of the sound mutably.

source

pub const fn structure_version(&self) -> u32

Returns the version of the sound structure.

source

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

source

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

source

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

source

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.

source

pub const fn machine_type(&self) -> MachineType

Returns the machine type of the sound.

source

pub const fn index(&self) -> usize

Returns the index of the sound.

Trait Implementations§

source§

impl Clone for Sound

source§

fn clone(&self) -> Sound

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 Sound

source§

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

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

impl<'de> Deserialize<'de> for Sound

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 From<&Sound> for ar_sound_t

source§

fn from(sound: &Sound) -> Self

Converts to this type from the input type.
source§

impl Serialize for Sound

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

impl SysexCompatible for Sound

source§

fn as_sysex(&self) -> Result<Vec<u8>, RytmError>

Serializes the object to a sysex message. Read more
source§

fn sysex_type(&self) -> AnySysexType

Returns the sysex type of the object.

Auto Trait Implementations§

§

impl RefUnwindSafe for Sound

§

impl Send for Sound

§

impl Sync for Sound

§

impl Unpin for Sound

§

impl UnwindSafe for Sound

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