CddaPlayer

Struct CddaPlayer 

Source
pub struct CddaPlayer {
Show 16 fields pub disc: Option<Rc<Disc>>, pub good_status_due: u32, pub status: Status, pub start: i64, pub end: i64, pub end_mode: EndMode, pub anchor_clock: i64, pub anchor_sample: i64, pub event_at: Option<i64>, pub now: i64, pub taken: i64, pub take_origin: Option<i64>, pub fader: Rc<Cell<Fader>>, pub gain: f64, pub paused_after_seek: bool, pub subq_status: [u8; 4], /* private fields */
}

Fields§

§disc: Option<Rc<Disc>>§good_status_due: u32

The bus owes this many good_status() (the reference’s on_good_status callback).

§status: Status§start: i64§end: i64§end_mode: EndMode§anchor_clock: i64§anchor_sample: i64

absolute sample number (sector * 588 + offset) at the anchor

§event_at: Option<i64>

seek done, or the end of the range

§now: i64§taken: i64

samples handed out so far, in absolute stream time

§take_origin: Option<i64>§fader: Rc<Cell<Fader>>§gain: f64

AudioSource socket: the mixer’s gain for this source

§paused_after_seek: bool§subq_status: [u8; 4]

[emu: Mednafen DoNEC_PCE_READSUBQ, tier 5] the audio-status byte of READ SUBQ, for playing, paused, stopped, seeking (the reference’s SUBQ_STATUS)

Implementations§

Source§

impl CddaPlayer

Source

pub fn new() -> CddaPlayer

Source

pub fn active(&self) -> bool

Source

pub fn status_code(&self) -> u8

Source

pub fn position(&self) -> i64

The sector under the head at the last time the bus ran (now).

Source

pub fn play(&mut self, start: i64, paused: bool, seek_clocks: i64)

AUDIO START: seek to start, then play to the end of its track (or wait for an AUDIO END if paused). The bus holds BUSY until the seek is done.

Source

pub fn set_end(&mut self, end: i64, mode: u8)

AUDIO END (modes 1-3): play (or resume) up to sector end inclusive.

Source

pub fn pause(&mut self)

Source

pub fn stop(&mut self)

Source

pub fn idle(&mut self)

A data read took the head: audio stops.

Source

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

Source

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

Fire the seek-done and end-of-range events due at or before mclk.

Source

pub fn latest_sample(&mut self) -> (i16, i16)

The sample being played at the last time run ($1805/$1806): zeros unless playing.

Source

pub fn fade_gain(&self, mclk: i64, adpcm: bool) -> f64

The fader’s gain (the reference’s fade_gain).

Source

pub fn fade_register(&self) -> u8

Source

pub fn write_fade(&mut self, value: u8, mclk: i64)

$180F [hw: pcetech 8]: bit 3 fades, bit 2 chooses the fast fade, bit 1 aims it at ADPCM. Rewriting the same value changes nothing; a new value restarts the timer (the finer cases in pcetech, a cancelled fade whose timer still runs, are U9).

Trait Implementations§

Source§

impl AudioSource for CddaPlayer

Source§

fn rate_hz(&self) -> f64

AudioSource attributes (socket 9): a fixed rate; the mixer applies gain

Source§

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

Stereo samples since the last call, one per 1/44100 s of master-clock time (zeros when not playing, so a mixer keeps its place). The fader’s gain is applied.

Source§

fn gain(&self) -> f64

§

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 Default for CddaPlayer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CddaPlayer

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 CddaPlayer

§

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 CddaPlayer

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§

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>,