audio 🤤

This commit is contained in:
Alex Janka 2023-02-19 19:22:56 +11:00
parent f2e08c2c1c
commit 052bf829a5

View file

@ -29,10 +29,10 @@ const fn reg(a: Address) -> usize {
} }
impl DacSample { impl DacSample {
fn mixed(&self, mixer: &Mixer) -> [f32; 2] { fn mixed(&self, mixer: &Mixer) -> Vec<f32> {
let left = (self.one * mixer.ch1.left.scale()) + (self.two * mixer.ch2.left.scale()); let left = (self.one * mixer.ch1.left.scale()) + (self.two * mixer.ch2.left.scale());
let right = (self.one * mixer.ch1.right.scale()) + (self.two * mixer.ch2.right.scale()); let right = (self.one * mixer.ch1.right.scale()) + (self.two * mixer.ch2.right.scale());
[ vec![
self.mix_channel(left, mixer.vol_left), self.mix_channel(left, mixer.vol_left),
self.mix_channel(right, mixer.vol_right), self.mix_channel(right, mixer.vol_right),
] ]
@ -75,7 +75,7 @@ impl Default for Apu {
.with_max_sample_rate(); .with_max_sample_rate();
let converter = Samplerate::new( let converter = Samplerate::new(
ConverterType::SincBestQuality, ConverterType::ZeroOrderHold,
CLOCK_SPEED as u32, CLOCK_SPEED as u32,
config.sample_rate().0, config.sample_rate().0,
config.channels().into(), config.channels().into(),