mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Allow use of timer again after mixer is done
This commit is contained in:
parent
bfc02e0aa8
commit
f7a10677dd
|
@ -17,7 +17,7 @@ fn main() -> ! {
|
|||
let mut input = ButtonController::new();
|
||||
let vblank_provider = agb::interrupt::VBlank::get();
|
||||
|
||||
let mut mixer = gba.mixer.mixer(gba.timers.timer0);
|
||||
let mut mixer = gba.mixer.mixer(&mut gba.timers.timer0);
|
||||
mixer.enable();
|
||||
|
||||
let channel = SoundChannel::new(DEAD_CODE);
|
||||
|
|
|
@ -14,11 +14,11 @@ fn main() -> ! {
|
|||
let mut gba = Gba::new();
|
||||
let vblank_provider = agb::interrupt::VBlank::get();
|
||||
|
||||
let timer_controller = gba.timers;
|
||||
let mut timer_controller = gba.timers;
|
||||
let mut timer = timer_controller.timer1;
|
||||
timer.set_enabled(true);
|
||||
|
||||
let mut mixer = gba.mixer.mixer(timer_controller.timer0);
|
||||
let mut mixer = gba.mixer.mixer(&mut timer_controller.timer0);
|
||||
mixer.enable();
|
||||
|
||||
let mut channel = SoundChannel::new(LET_IT_IN);
|
||||
|
|
|
@ -15,7 +15,7 @@ impl MixerController {
|
|||
MixerController {}
|
||||
}
|
||||
|
||||
pub fn mixer(&mut self, timer: Timer) -> Mixer {
|
||||
pub fn mixer<'a>(&mut self, timer: &'a mut Timer) -> Mixer<'a> {
|
||||
Mixer::new(timer)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,18 +19,18 @@ extern "C" {
|
|||
fn agb_rs__mixer_collapse(sound_buffer: *mut i8, input_buffer: *const Num<i16, 4>);
|
||||
}
|
||||
|
||||
pub struct Mixer {
|
||||
pub struct Mixer<'a> {
|
||||
buffer: MixerBuffer,
|
||||
channels: [Option<SoundChannel>; 8],
|
||||
indices: [i32; 8],
|
||||
|
||||
timer: Timer,
|
||||
timer: &'a mut Timer,
|
||||
}
|
||||
|
||||
pub struct ChannelId(usize, i32);
|
||||
|
||||
impl Mixer {
|
||||
pub(super) fn new(timer: Timer) -> Self {
|
||||
impl<'a> Mixer<'a> {
|
||||
pub(super) fn new(timer: &'a mut Timer) -> Self {
|
||||
Mixer {
|
||||
buffer: MixerBuffer::new(),
|
||||
channels: Default::default(),
|
||||
|
|
Loading…
Reference in a new issue