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

Merge branch 'master' into joamag/audio-ch4

parents 5ad5a3a7 fde32fb9
No related branches found
No related tags found
1 merge request!21Initial working version of Audio CH4
Pipeline #2447 passed
...@@ -404,6 +404,18 @@ impl Apu { ...@@ -404,6 +404,18 @@ impl Apu {
self.ch1_output + self.ch2_output + self.ch3_output + self.ch4_output self.ch1_output + self.ch2_output + self.ch3_output + self.ch4_output
} }
pub fn ch1_output(&self) -> u8 {
self.ch1_output
}
pub fn ch2_output(&self) -> u8 {
self.ch2_output
}
pub fn ch3_output(&self) -> u8 {
self.ch3_output
}
pub fn audio_buffer(&self) -> &VecDeque<u8> { pub fn audio_buffer(&self) -> &VecDeque<u8> {
&self.audio_buffer &self.audio_buffer
} }
...@@ -582,7 +594,7 @@ impl Apu { ...@@ -582,7 +594,7 @@ impl Apu {
return; return;
} }
if self.ch3_enabled { if self.ch3_enabled && self.ch3_dac {
let wave_index = self.ch3_position >> 1; let wave_index = self.ch3_position >> 1;
let mut output = self.wave_ram[wave_index as usize]; let mut output = self.wave_ram[wave_index as usize];
output = if (self.ch3_position & 0x01) == 0x01 { output = if (self.ch3_position & 0x01) == 0x01 {
......
...@@ -189,6 +189,31 @@ impl GameBoy { ...@@ -189,6 +189,31 @@ impl GameBoy {
buffer buffer
} }
pub fn audio_output(&self) -> u8 {
self.apu_i().output()
}
pub fn audio_all_output(&self) -> Vec<u8> {
vec![
self.audio_output(),
self.audio_ch1_output(),
self.audio_ch2_output(),
self.audio_ch3_output(),
]
}
pub fn audio_ch1_output(&self) -> u8 {
self.apu_i().ch1_output()
}
pub fn audio_ch2_output(&self) -> u8 {
self.apu_i().ch2_output()
}
pub fn audio_ch3_output(&self) -> u8 {
self.apu_i().ch3_output()
}
pub fn cartridge_eager(&mut self) -> Cartridge { pub fn cartridge_eager(&mut self) -> Cartridge {
self.mmu().rom().clone() self.mmu().rom().clone()
} }
......
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