Adpcm

Struct Adpcm 

Source
pub struct Adpcm {
Show 32 fields pub switches: AdpcmSwitches, pub irq_changes: Vec<(u8, bool)>, pub fader: Rc<Cell<Fader>>, pub ram: Vec<u8>, pub latch: u16, pub read_ptr: u16, pub write_ptr: u16, pub read_buffer: u8, pub control: u8, pub dma: u8, pub rate: u8, pub length: u32, pub half: bool, pub end: bool, pub playing: bool, pub play_request: bool, pub high_nibble_next: bool, pub signal: i32, pub index: i32, pub read_due: Option<i64>, pub write_due: Option<i64>, pub write_value: u8, pub sample_at: i64, pub record: bool, pub events: Vec<(i64, i32)>, pub last_output: i32, pub sample_count: u64, pub end_count: u64, pub origin: Option<i64>, pub taken: i64, pub held: i32, pub gain: f64,
}
Expand description

RAM, pointers, flags and the decoder. Time comes from the unit (run(mclk) and the now of each register access); the unit calls run for every event from next_event.

Fields§

§switches: AdpcmSwitches§irq_changes: Vec<(u8, bool)>§fader: Rc<Cell<Fader>>§ram: Vec<u8>§latch: u16§read_ptr: u16§write_ptr: u16§read_buffer: u8§control: u8§dma: u8§rate: u8§length: u32§half: bool§end: bool§playing: bool§play_request: bool§high_nibble_next: bool

the next sample is the high nibble of the byte at read_ptr

§signal: i32§index: i32§read_due: Option<i64>§write_due: Option<i64>§write_value: u8§sample_at: i64

16.16 fixed-point master clocks

§record: bool

the audio source wants (time, output) events

§events: Vec<(i64, i32)>§last_output: i32§sample_count: u64

decoded samples (statistics)

§end_count: u64

times the end flag was raised (statistics)

§origin: Option<i64>§taken: i64§held: i32§gain: f64

AudioSource socket: the mixer’s gain for this source

Implementations§

Source§

impl Adpcm

Source

pub fn new(fader: Rc<Cell<Fader>>) -> Adpcm

Source

pub fn write_busy(&self) -> bool

Source

pub fn read_busy(&self) -> bool

Source

pub fn period_fixed(&self) -> i64

Master clocks per sample, 16.16 fixed point.

Source

pub fn reset(&mut self)

Power-on and the $180D bit 7 reset (the latter keeps the read buffer).

Source

pub fn power_on(&mut self, at: i64)

Power-on at master clock at (the output goes idle then, the reference’s issue 0001 item 3).

Source

pub fn write(&mut self, reg: u8, value: u8, now: i64)

Source

pub fn read(&mut self, reg: u8, now: i64) -> u8

Source

pub fn dma_write(&mut self, value: u8, now: i64) -> bool

One byte from the CD-to-ADPCM DMA, through the same write path as $180A. False if the previous write is still in progress (the DMA retries).

Source

pub fn next_event(&self) -> Option<i64>

Source

pub fn run(&mut self, mclk: i64)

Do every event due at or before mclk, in time order.

Trait Implementations§

Source§

impl AudioSource for Adpcm

The ADPCM audio for the board’s mixer (socket 9): the decoder output held, sampled at 44.1 kHz at exact master-clock times, with the $180F fader when it is aimed at ADPCM.

Source§

fn rate_hz(&self) -> f64

Source§

fn gain(&self) -> f64

Source§

fn take_samples(&mut self, mclk: i64) -> Vec<(i32, i32)>

Stereo samples produced up to mclk since the last call.
§

fn applies_gain(&self) -> bool

True when the source’s samples already carry its gain (the PSG): the mixer must not apply it a second time.
Source§

impl<'de> Deserialize<'de> for Adpcm

Source§

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 Adpcm

§

fn save_state(&self) -> Vec<u8> ⓘ

Everything of the device that changes as the console runs.
§

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.
§

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.
Source§

impl Serialize for Adpcm

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Adpcm

§

impl !RefUnwindSafe for Adpcm

§

impl !Send for Adpcm

§

impl !Sync for Adpcm

§

impl Unpin for Adpcm

§

impl !UnwindSafe for Adpcm

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,