chore(snd): implement shift amount for channel 3 volume
This commit is contained in:
parent
67e2a6ad79
commit
278953ab78
|
@ -238,7 +238,7 @@ impl BusIo for Bus {
|
||||||
0x24 => self.snd.ctrl.channel.into(),
|
0x24 => self.snd.ctrl.channel.into(),
|
||||||
0x25 => self.snd.ctrl.output.into(),
|
0x25 => self.snd.ctrl.output.into(),
|
||||||
0x26 => self.snd.ctrl.status.into(),
|
0x26 => self.snd.ctrl.status.into(),
|
||||||
0x30..=0x3F => self.snd.ch3.ram[addr as usize - 0xFF30],
|
0x30..=0x3F => self.snd.ch3.wave_ram[addr as usize - 0xFF30],
|
||||||
0x40 => self.ppu.ctrl.into(),
|
0x40 => self.ppu.ctrl.into(),
|
||||||
0x41 => self.ppu.stat.into(),
|
0x41 => self.ppu.stat.into(),
|
||||||
0x42 => self.ppu.pos.scroll_y,
|
0x42 => self.ppu.pos.scroll_y,
|
||||||
|
@ -355,7 +355,7 @@ impl BusIo for Bus {
|
||||||
0x24 => self.snd.ctrl.channel = byte.into(),
|
0x24 => self.snd.ctrl.channel = byte.into(),
|
||||||
0x25 => self.snd.ctrl.output = byte.into(),
|
0x25 => self.snd.ctrl.output = byte.into(),
|
||||||
0x26 => self.snd.ctrl.status = byte.into(), // FIXME: Should we control which bytes are written to here?
|
0x26 => self.snd.ctrl.status = byte.into(), // FIXME: Should we control which bytes are written to here?
|
||||||
0x30..=0x3F => self.snd.ch3.ram[addr as usize - 0xFF30] = byte,
|
0x30..=0x3F => self.snd.ch3.wave_ram[addr as usize - 0xFF30] = byte,
|
||||||
0x40 => self.ppu.ctrl = byte.into(),
|
0x40 => self.ppu.ctrl = byte.into(),
|
||||||
0x41 => self.ppu.stat.update(byte),
|
0x41 => self.ppu.stat.update(byte),
|
||||||
0x42 => self.ppu.pos.scroll_y = byte,
|
0x42 => self.ppu.pos.scroll_y = byte,
|
||||||
|
|
15
src/sound.rs
15
src/sound.rs
|
@ -645,7 +645,7 @@ pub(crate) struct Channel3 {
|
||||||
pub(crate) freq_lo: u8,
|
pub(crate) freq_lo: u8,
|
||||||
/// 0xFF1E | NR34 - Channel 3 Frequency high
|
/// 0xFF1E | NR34 - Channel 3 Frequency high
|
||||||
freq_hi: FrequencyHigh,
|
freq_hi: FrequencyHigh,
|
||||||
pub(crate) ram: [u8; WAVE_PATTERN_RAM_LEN],
|
pub(crate) wave_ram: [u8; WAVE_PATTERN_RAM_LEN],
|
||||||
|
|
||||||
// Length Functionality
|
// Length Functionality
|
||||||
length_timer: u16,
|
length_timer: u16,
|
||||||
|
@ -713,6 +713,19 @@ enum Channel3Volume {
|
||||||
Quarter = 3,
|
Quarter = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Channel3Volume {
|
||||||
|
pub fn shift_count(&self) -> u8 {
|
||||||
|
use Channel3Volume::*;
|
||||||
|
|
||||||
|
match *self {
|
||||||
|
Mute => 4,
|
||||||
|
Full => 0,
|
||||||
|
Half => 1,
|
||||||
|
Quarter => 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for Channel3Volume {
|
impl Default for Channel3Volume {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::Mute
|
Self::Mute
|
||||||
|
|
Loading…
Reference in New Issue