pub struct Noise { /* private fields */ }Expand description
Channel 4’s settings.
The pitch is a clock divider and shift rather than a note, since what comes out is noise and is chosen by ear.
Implementations§
Source§impl Noise
impl Noise
Sourcepub const fn new(volume: u8, divider: u8, shift: u8) -> Self
pub const fn new(volume: u8, divider: u8, shift: u8) -> Self
Noise at volume, out of 15, clocked at 262144 / (divider << shift)
hertz, where a divider of 0 counts as a half.
A volume of 0 is not a quiet sound but a stopped channel: it turns the DAC off, and a channel whose DAC is off will not start.
A shift of 14 or 15 stops the clock, and neither is reachable here.
Sourcepub const fn short_lfsr(self) -> Self
pub const fn short_lfsr(self) -> Self
Run the shift register seven bits wide, which repeats often enough to carry a pitch.
Sourcepub const fn envelope(self, pace: u8, increase: bool) -> Self
pub const fn envelope(self, pace: u8, increase: bool) -> Self
Step the volume every pace ticks of a 64 Hz count, up or down.
A pace of 0 holds the volume where Noise::new put it.
Trait Implementations§
impl Copy for Noise
impl Eq for Noise
impl StructuralPartialEq for Noise
Auto Trait Implementations§
impl BankSafe for Noise
impl Freeze for Noise
impl RefUnwindSafe for Noise
impl Send for Noise
impl Sync for Noise
impl Unpin for Noise
impl UnsafeUnpin for Noise
impl UnwindSafe for Noise
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