pub struct Pulse {
pub channel: PulseChannel,
pub real_period: u64,
pub timer: Timer,
pub duty: u8,
pub duty_cycle: u8,
pub length: LengthCounter,
pub envelope: Envelope,
pub sweep: Sweep,
pub force_silent: bool,
pub output_freq: OutputFreq,
}
Expand description
APU Pulse Channel provides square wave generation.
Fields§
§channel: PulseChannel
§real_period: u64
§timer: Timer
§duty: u8
§duty_cycle: u8
§length: LengthCounter
§envelope: Envelope
§sweep: Sweep
§force_silent: bool
§output_freq: OutputFreq
Implementations§
Source§impl Pulse
impl Pulse
pub const fn new(channel: PulseChannel, output_freq: OutputFreq) -> Self
pub fn is_muted(&self) -> bool
pub const fn silent(&self) -> bool
pub const fn set_silent(&mut self, silent: bool)
pub fn clock_quarter_frame(&mut self)
pub fn clock_half_frame(&mut self)
Sourcepub const fn write_ctrl(&mut self, val: u8)
pub const fn write_ctrl(&mut self, val: u8)
$4000/$4004 Pulse control
Sourcepub const fn write_sweep(&mut self, val: u8)
pub const fn write_sweep(&mut self, val: u8)
$4001/$4005 Pulse sweep
Sourcepub fn write_timer_lo(&mut self, val: u8)
pub fn write_timer_lo(&mut self, val: u8)
$4002/$4006 Pulse timer lo
Sourcepub fn write_timer_hi(&mut self, val: u8)
pub fn write_timer_hi(&mut self, val: u8)
$4003/$4007 Pulse timer hi
pub const fn set_enabled(&mut self, enabled: bool)
pub const fn volume(&self) -> u8
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pulse
impl<'de> Deserialize<'de> for Pulse
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
Auto Trait Implementations§
impl Freeze for Pulse
impl RefUnwindSafe for Pulse
impl Send for Pulse
impl Sync for Pulse
impl Unpin for Pulse
impl UnwindSafe for Pulse
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