diff --git a/bingus/src/snd/raw.rs b/bingus/src/snd/raw.rs index fa7a8c5..b4309d3 100644 --- a/bingus/src/snd/raw.rs +++ b/bingus/src/snd/raw.rs @@ -4,6 +4,7 @@ use num::{ traits::{FromBytes, ToBytes}, Zero, }; +use rayon::iter::{IntoParallelRefMutIterator, ParallelIterator}; use crate::{Bendable, IntoDataBytes, TryFromDataBytes}; @@ -65,12 +66,13 @@ where impl Bendable for RawSamples where - T: Sample + FromBytes + ToBytes + Zero, + T: Sample + FromBytes + ToBytes + Zero + Send, ::Bytes: Sized + for<'a> TryFrom<&'a [u8]>, + for<'a> Vec: IntoParallelRefMutIterator<'a, Item = &'a mut T>, { type Unit = T; fn map Self::Unit + Sync>(mut self, f: F) -> Self { - self.0.iter_mut().for_each(|e| *e = f(e)); + self.0.par_iter_mut().for_each(|e| *e = f(e)); self } fn format() -> crate::dynamic::Format {