yay! macro!

This commit is contained in:
Ponj 2024-07-07 08:53:56 +02:00
parent 0194f60ca3
commit 1dec7aad56
Signed by: p6nj
GPG key ID: CEAB625B75A836B2

View file

@ -3,7 +3,7 @@ use std::{
ops::{BitOr, Shl},
};
use dasp_sample::{FromSample, Sample, U24};
use dasp_sample::{FromSample, Sample, U24, U48};
use fundsp::Real;
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
}