yay! macro!
This commit is contained in:
parent
0194f60ca3
commit
1dec7aad56
1 changed files with 18 additions and 2 deletions
|
@ -3,7 +3,7 @@ use std::{
|
||||||
ops::{BitOr, Shl},
|
ops::{BitOr, Shl},
|
||||||
};
|
};
|
||||||
|
|
||||||
use dasp_sample::{FromSample, Sample, U24};
|
use dasp_sample::{FromSample, Sample, U24, U48};
|
||||||
use fundsp::Real;
|
use fundsp::Real;
|
||||||
|
|
||||||
pub type Byte = u8;
|
pub type Byte = u8;
|
||||||
|
@ -32,4 +32,20 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BytesToSample<U24, Byte, array::IntoIter<Byte, 3>> for [Byte; 3] {}
|
macro_rules! impl_bts_for_array_of {
|
||||||
|
($($N:expr, $Ir:ty);*) =>
|
||||||
|
{
|
||||||
|
$(
|
||||||
|
impl BytesToSample<$Ir, Byte, array::IntoIter<Byte, $N>> for [Byte; $N] {}
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_bts_for_array_of! {
|
||||||
|
1, u8;
|
||||||
|
2, u16;
|
||||||
|
3, U24;
|
||||||
|
4, u32;
|
||||||
|
6, U48;
|
||||||
|
8, u64
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue