Skip to content
Snippets Groups Projects
Verified Commit 23ce1a11 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new output level control per channel

parent 4185b9d3
No related branches found
No related tags found
No related merge requests found
Pipeline #2457 passed
......@@ -80,6 +80,10 @@ pub struct Apu {
right_enabled: bool,
left_enabled: bool,
ch1_out_enabled: bool,
ch2_out_enabled: bool,
ch3_out_enabled: bool,
ch4_out_enabled: bool,
wave_ram: [u8; 16],
......@@ -155,6 +159,10 @@ impl Apu {
left_enabled: true,
right_enabled: true,
ch1_out_enabled: false,
ch2_out_enabled: false,
ch3_out_enabled: true,
ch4_out_enabled: false,
/// The RAM that is used to sore the wave information
/// to be used in channel 3 audio
......@@ -458,23 +466,43 @@ impl Apu {
}
pub fn output(&self) -> u8 {
self.ch1_output + self.ch2_output + self.ch3_output + self.ch4_output
self.ch1_output() + self.ch2_output() + self.ch3_output() + self.ch4_output()
}
#[inline(always)]
pub fn ch1_output(&self) -> u8 {
self.ch1_output
if self.ch1_out_enabled {
self.ch1_output
} else {
0
}
}
#[inline(always)]
pub fn ch2_output(&self) -> u8 {
self.ch2_output
if self.ch2_out_enabled {
self.ch2_output
} else {
0
}
}
#[inline(always)]
pub fn ch3_output(&self) -> u8 {
self.ch3_output
if self.ch3_out_enabled {
self.ch3_output
} else {
0
}
}
#[inline(always)]
pub fn ch4_output(&self) -> u8 {
self.ch4_output
if self.ch4_out_enabled {
self.ch4_output
} else {
0
}
}
pub fn audio_buffer(&self) -> &VecDeque<u8> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment