pub struct Note {
pub pitch: u8,
pub wave: u8,
pub volume: u8,
pub effect: u8,
}Expand description
One step of an SFX: pitch (0..64, where 33 = A-4 = 440 Hz), waveform, volume (0..8, 0 = silent) and effect.
Fields§
§pitch: u8§wave: u8Timbre, packed like PICO-8’s SFX waveform nibble: bits 0-2 are the
index and bit 3 is the custom-instrument flag. With the flag clear,
the index (0..8) picks a built-in Waveform; with it set, the index
names another SFX slot (0..8) used as a custom instrument. Use
Note::instrument / Note::wave_index rather than reading the
raw bits.
volume: u8§effect: u8Implementations§
Source§impl Note
impl Note
Sourcepub fn wave_index(&self) -> u8
pub fn wave_index(&self) -> u8
The waveform/instrument index (0..8), with the custom-instrument flag stripped off.
Sourcepub fn instrument(&self) -> Option<u8>
pub fn instrument(&self) -> Option<u8>
Some(slot) when this note plays SFX slot (0..8) as a custom
instrument; None when it uses a built-in waveform.
Trait Implementations§
impl Copy for Note
Source§impl<'de> Deserialize<'de> for Note
impl<'de> Deserialize<'de> for Note
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Note
impl StructuralPartialEq for Note
Auto Trait Implementations§
impl Freeze for Note
impl RefUnwindSafe for Note
impl Send for Note
impl Sync for Note
impl Unpin for Note
impl UnsafeUnpin for Note
impl UnwindSafe for Note
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.