Skip to content

Commit

Permalink
Some missed ones
Browse files Browse the repository at this point in the history
  • Loading branch information
AldaronLau committed Oct 14, 2024
1 parent ab34575 commit cea643c
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 146 deletions.
22 changes: 11 additions & 11 deletions examples/mix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use fon::{
};

#[derive(Debug)]
pub struct Mixer<'a, Samp: Sample, const CH: usize> {
pub struct Mixer<'a, Samp: Sample, const N: usize> {
index: usize,
audio: &'a mut Audio<Samp, CH>,
audio: &'a mut Audio<Samp, N>,
}

#[allow(single_use_lifetimes)]
impl<'a, Samp: Sample, const CH: usize> Mixer<'a, Samp, CH> {
impl<'a, Samp: Sample, const N: usize> Mixer<'a, Samp, N> {
#[inline(always)]
fn new(audio: &'a mut Audio<Samp, CH>) -> Self {
fn new(audio: &'a mut Audio<Samp, N>) -> Self {
let index = 0;

Mixer { index, audio }
Expand All @@ -25,8 +25,8 @@ impl<'a, Samp: Sample, const CH: usize> Mixer<'a, Samp, CH> {

// Using '_ results in reserved lifetime error.
#[allow(single_use_lifetimes)]
impl<'a, Samp: Sample, const CH: usize> Sink<Samp, CH>
for Mixer<'a, Samp, CH>
impl<'a, Samp: Sample, const N: usize> Sink<Samp, N>
for Mixer<'a, Samp, N>
{
#[inline(always)]
fn sample_rate(&self) -> NonZeroU32 {
Expand All @@ -39,14 +39,14 @@ impl<'a, Samp: Sample, const CH: usize> Sink<Samp, CH>
}

#[inline(always)]
fn sink_with(&mut self, iter: &mut dyn Iterator<Item = Frame<Samp, CH>>) {
fn sink_with(&mut self, iter: &mut dyn Iterator<Item = Frame<Samp, N>>) {
let mut this = self;
Sink::<Samp, CH>::sink_with(&mut this, iter)
Sink::<Samp, N>::sink_with(&mut this, iter)
}
}

impl<Samp: Sample, const CH: usize> Sink<Samp, CH>
for &mut Mixer<'_, Samp, CH>
impl<Samp: Sample, const N: usize> Sink<Samp, N>
for &mut Mixer<'_, Samp, N>
{
#[inline(always)]
fn sample_rate(&self) -> NonZeroU32 {
Expand All @@ -59,7 +59,7 @@ impl<Samp: Sample, const CH: usize> Sink<Samp, CH>
}

#[inline(always)]
fn sink_with(&mut self, iter: &mut dyn Iterator<Item = Frame<Samp, CH>>) {
fn sink_with(&mut self, iter: &mut dyn Iterator<Item = Frame<Samp, N>>) {
for frame in self.audio.iter_mut().skip(self.index) {
if let Some(other) = iter.next() {
for (channel, chan) in
Expand Down
Loading

0 comments on commit cea643c

Please sign in to comment.