moa/emulator/core/src/host/audio.rs
transistor 527f65c69b Refactored audio to use ClockedQueue
It now actually checks the clock and tries to mix the audio in sync
relative to the clock, but the cpal output doesn't yet try to sync
to the StreamInstant time.  Sound seems a lot better on chrome in
wasm, but and kind of better on firefox despite frame skipping not
being supported yet, but it's way slower for some reason (12fps)
2023-05-07 10:03:25 -07:00

26 lines
441 B
Rust

#[derive(Copy, Clone, Default)]
pub struct Sample(pub f32, pub f32);
impl Sample {
pub fn new(left: f32, right: f32) -> Self {
Self(left, right)
}
}
#[derive(Clone, Default)]
pub struct AudioFrame {
pub sample_rate: usize,
pub data: Vec<Sample>,
}
impl AudioFrame {
pub fn new(sample_rate: usize, data: Vec<Sample>) -> Self {
AudioFrame {
sample_rate,
data,
}
}
}