diff --git a/agb/src/sound/mixer/mod.rs b/agb/src/sound/mixer/mod.rs index 3f43d7b5..ca2a36ab 100644 --- a/agb/src/sound/mixer/mod.rs +++ b/agb/src/sound/mixer/mod.rs @@ -114,7 +114,7 @@ impl MixerController { } /// Get a [`Mixer`] in order to start producing sounds. - pub fn mixer(&mut self, frequency: Frequency) -> Mixer { + pub fn mixer(&mut self, frequency: Frequency) -> Mixer<'_> { Mixer::new(frequency) } } diff --git a/agb/src/sound/mixer/sw_mixer.rs b/agb/src/sound/mixer/sw_mixer.rs index 505f3fc5..4f32e786 100644 --- a/agb/src/sound/mixer/sw_mixer.rs +++ b/agb/src/sound/mixer/sw_mixer.rs @@ -1,4 +1,5 @@ use core::cell::RefCell; +use core::marker::PhantomData; use core::pin::Pin; use alloc::boxed::Box; @@ -78,7 +79,7 @@ extern "C" { /// } /// # } /// ``` -pub struct Mixer { +pub struct Mixer<'gba> { interrupt_timer: Timer, // SAFETY: Has to go before buffer because it holds a reference to it _interrupt_handler: InterruptHandler<'static>, @@ -91,6 +92,8 @@ pub struct Mixer { working_buffer: Box<[Num], InternalAllocator>, fifo_timer: Timer, + + phantom: PhantomData<&'gba ()>, } /// A pointer to a currently playing channel. @@ -116,7 +119,7 @@ pub struct Mixer { /// ``` pub struct ChannelId(usize, i32); -impl Mixer { +impl Mixer<'_> { pub(super) fn new(frequency: Frequency) -> Self { let buffer = Box::pin_in(MixerBuffer::new(frequency), InternalAllocator); @@ -158,6 +161,8 @@ impl Mixer { working_buffer: working_buffer.into_boxed_slice(), fifo_timer, + + phantom: PhantomData, } }