pub struct Sfx {
pub notes: [Note; 32],
pub speed: u8,
pub loop_start: u8,
pub loop_end: u8,
pub noiz: bool,
pub buzz: bool,
pub detune: u8,
pub reverb: u8,
pub dampen: u8,
pub custom_wave: Option<CustomWave>,
}Expand description
One sound effect: 32 steps played at a configurable speed.
Fields§
§notes: [Note; 32]§speed: u8Duration of one step in 1/128ths of a second (1..=255).
loop_start: u8Loop start step. Looping is active when loop_end > loop_start.
loop_end: u8Loop end step (exclusive).
noiz: boolPer-SFX filter switches, matching PICO-8’s: replace the noise voice with pure white noise.
buzz: boolBuzzier, harmonically richer timbre.
detune: u8Detune a second voice against the first. 0 off; 1 a slight,
flange-like detune; 2 an octave-ish second voice.
reverb: u8Echo with a short delay. 0 off; 1/2 are the two delay lengths.
dampen: u8Low-pass softening. 0 off; 1/2 are the two strengths.
custom_wave: Option<CustomWave>Some only for slots 0..8 that are drawn-waveform instruments.
Implementations§
Source§impl Sfx
impl Sfx
Sourcepub fn set_filters(&mut self, byte: u8)
pub fn set_filters(&mut self, byte: u8)
Set the filter switches from PICO-8’s packed filter byte (the 65th byte of an on-cart SFX): bit 1 noiz, bit 2 buzz, then base-3 digits for detune (÷8), reverb (÷24) and dampen (÷72). Bit 0 is PICO-8’s editor mode and carries no sound, so it is ignored.
Sourcepub fn filters_byte(&self) -> u8
pub fn filters_byte(&self) -> u8
PICO-8’s packed filter byte — the inverse of Sfx::set_filters: bit 1
noiz, bit 2 buzz, then base-3 digits for detune (x8), reverb (x24) and
dampen (x72). Bit 0 (PICO-8’s editor mode) is always left clear.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Sfx
impl<'de> Deserialize<'de> for Sfx
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Sfx
impl StructuralPartialEq for Sfx
Auto Trait Implementations§
impl Freeze for Sfx
impl RefUnwindSafe for Sfx
impl Send for Sfx
impl Sync for Sfx
impl Unpin for Sfx
impl UnsafeUnpin for Sfx
impl UnwindSafe for Sfx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.