Fix the sound frequency to 10512Hz

This commit is contained in:
Gwilym Kuiper 2021-06-06 11:19:45 +01:00
parent 8d980697bb
commit df7a72d618
3 changed files with 5 additions and 3 deletions

View file

@ -15,7 +15,7 @@ pub fn main() -> ! {
let mixer = gba.mixer;
mixer.enable();
mixer.play_sound_starting_at(&I_WILL_NOT_LET_YOU_LET_ME_DOWN[0], 8000);
mixer.play_sound_starting_at(&I_WILL_NOT_LET_YOU_LET_ME_DOWN[0]);
loop {}
}

View file

@ -12,12 +12,14 @@ impl Mixer {
set_sound_control_register_for_mixer();
}
pub fn play_sound_starting_at(&self, sound_memory: *const u8, frequency: i32) {
set_timer_counter_for_frequency_and_enable(frequency);
pub fn play_sound_starting_at(&self, sound_memory: *const u8) {
set_timer_counter_for_frequency_and_enable(SOUND_FREQUENCY);
enable_dma1_for_sound(sound_memory);
}
}
const SOUND_FREQUENCY: i32 = 10512;
// Once we have proper DMA support, we should use that rather than hard coding these here too
const DMA1_SOURCE_ADDR: MemoryMapped<u32> = unsafe { MemoryMapped::new(0x0400_00bc) };
const DMA1_DEST_ADDR: MemoryMapped<u32> = unsafe { MemoryMapped::new(0x0400_00c0) };