pub struct Psg {
pub switches: PsgSwitches,
pub channels: [Channel; 6],
pub select: u8,
pub balance: u8,
pub lfo_frequency: u8,
pub lfo_control: u8,
pub step: i64,
pub rate_hz: f64,
pub gain: f64,
/* private fields */
}Fields§
§switches: PsgSwitchesSwitches, not state: a loaded state keeps the system’s own.
channels: [Channel; 6]§select: u8§balance: u8R1
lfo_frequency: u8R8
lfo_control: u8R9
step: i64steps run so far
rate_hz: f64§gain: f64Implementations§
Source§impl Psg
impl Psg
pub fn new(rate_hz: f64, switches: PsgSwitches) -> Psg
Sourcepub fn attenuation(&self, ch: usize, side: usize) -> usize
pub fn attenuation(&self, ch: usize, side: usize) -> usize
Units of 1.5 dB below the maximum for a channel on one side (0 left, 1 right): R1 and R5 step 3 dB, R4 1.5 dB [mfr 2.1.2, 2.1.5, 2.1.6, 2.3]. 30 or more is silent.
pub fn write(&mut self, offset: u32, value: u8, mclk: i64)
Sourcepub fn state(&self) -> [(i32, usize, usize); 6]
pub fn state(&self) -> [(i32, usize, usize); 6]
Per channel (sample, units left, units right) for the step about to run; sample is -1 for a channel that is off (it contributes nothing).
Sourcepub fn advance_to(&mut self, target: i64)
pub fn advance_to(&mut self, target: i64)
Run the steps up to (not including) step target.
Trait Implementations§
Source§impl AudioSource for Psg
impl AudioSource for Psg
Source§impl<'de> Deserialize<'de> for Psg
impl<'de> Deserialize<'de> for Psg
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
Source§impl DeviceState for Psg
impl DeviceState for Psg
Source§fn load_state(&mut self, data: &[u8]) -> Result<(), String>
fn load_state(&mut self, data: &[u8]) -> Result<(), String>
Put the device in a saved state. A device without state accepts only an empty one.
Source§fn state_identity(&self) -> String
fn state_identity(&self) -> String
What the device is and which media it holds (a card’s ROM by its SHA-1, a disc by its
table of contents): a state is refused by a system whose device answers otherwise.
impl StructuralPartialEq for Psg
Auto Trait Implementations§
impl Freeze for Psg
impl RefUnwindSafe for Psg
impl Send for Psg
impl Sync for Psg
impl Unpin for Psg
impl UnwindSafe for Psg
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