pub struct Sid { /* private fields */ }Implementations§
Source§impl Sid
impl Sid
pub fn new(chip_model: ChipModel) -> Self
pub fn set_sampling_parameters( &mut self, method: SamplingMethod, clock_freq: u32, sample_freq: u32, )
pub fn clock(&mut self)
pub fn clock_delta(&mut self, delta: u32)
pub fn enable_external_filter(&mut self, enabled: bool)
pub fn enable_filter(&mut self, enabled: bool)
pub fn input(&mut self, sample: i32)
pub fn output(&self) -> i16
pub fn reset(&mut self)
Sourcepub fn sample(
&mut self,
delta: u32,
buffer: &mut [i16],
interleave: usize,
) -> (usize, u32)
pub fn sample( &mut self, delta: u32, buffer: &mut [i16], interleave: usize, ) -> (usize, u32)
SID clocking with audio sampling. Fixpoint arithmetics is used.
The example below shows how to clock the SID a specified amount of cycles while producing audio output:
ⓘ
let mut buffer = [0i16; 8192];
while delta > 0 {
let (samples, next_delta) = self.resid.sample(delta, &mut buffer[..], 1);
let mut output = self.sound_buffer.lock().unwrap();
for i in 0..samples {
output.write(buffer[i]);
}
delta = next_delta;
}pub fn read(&self, reg: u8) -> u8
pub fn write(&mut self, reg: u8, value: u8)
pub fn read_state(&self) -> State
pub fn write_state(&mut self, state: &State)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sid
impl RefUnwindSafe for Sid
impl Send for Sid
impl Sync for Sid
impl Unpin for Sid
impl UnwindSafe for Sid
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