1
0
Fork 0

Use the new SIMD helpers in Diopser

This commit is contained in:
Robbert van der Helm 2022-03-01 21:40:21 +01:00
parent 33905e5bc2
commit 161d86ab49
2 changed files with 3 additions and 7 deletions

View file

@ -11,7 +11,7 @@ crate-type = ["cdylib"]
[features]
default = ["simd"]
# Make it go fast, vroom. Requires a nightly compiler.
simd = []
simd = ["nih_plug/simd"]
[dependencies]
nih_plug = { path = "../../", features = ["assert_process_allocs"] }

View file

@ -284,10 +284,7 @@ impl Plugin for Diopser {
// supports steroo audio.
#[cfg(feature = "simd")]
{
let mut samples = f32x2::from_array([
*unsafe { channel_samples.get_unchecked_mut(0) },
*unsafe { channel_samples.get_unchecked_mut(1) },
]);
let mut samples = unsafe { channel_samples.to_simd_unchecked() };
for filter in self
.filters
@ -297,8 +294,7 @@ impl Plugin for Diopser {
samples = filter.process(samples);
}
*unsafe { channel_samples.get_unchecked_mut(0) } = samples.as_array()[0];
*unsafe { channel_samples.get_unchecked_mut(1) } = samples.as_array()[1];
unsafe { channel_samples.from_simd_unchecked(samples) };
}
#[cfg(not(feature = "simd"))]