mirror of
https://github.com/transistorfet/moa.git
synced 2024-05-28 13:41:30 +00:00
527f65c69b
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)
26 lines
441 B
Rust
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,
|
|
}
|
|
}
|
|
}
|
|
|