Skip to content
Open
46 changes: 12 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ standalone = ["dep:baseview", "dep:clap", "dep:cpal", "dep:jack", "dep:midir", "
# Enables the `nih_export_vst3!()` macro. Enabled by default. This feature
# exists mostly for GPL-compliance reasons, since even if you don't use the VST3
# wrapper you might otherwise still include a couple (unused) symbols from the
# `vst3-sys` crate.
vst3 = ["dep:vst3-sys"]
# `vst3` crate.
vst3 = ["dep:vst3"]
# Add adapters to the Buffer object for reading the channel data to and from
# `std::simd` vectors. Requires a nightly compiler.
simd = []
Expand Down Expand Up @@ -112,7 +112,7 @@ midir = { version = "0.9.1", optional = true }
rtrb = { version = "0.2.2", optional = true }

# Used for the `vst3` feature
vst3-sys = { git = "https://github.com/robbert-vdh/vst3-sys.git", branch = "fix/drop-box-from-raw", optional = true }
vst3 = { version = "0.3.0", optional = true }

# Used for the `zstd` feature
zstd = { version = "0.12.3", optional = true }
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,7 @@ examples.
## Licensing

The framework, its libraries, and the example plugins in `plugins/examples/` are
all licensed under the [ISC license](https://www.isc.org/licenses/). However,
the [VST3 bindings](https://github.com/RustAudio/vst3-sys) used by
`nih_export_vst3!()` are licensed under the GPLv3 license. This means that
unless you replace these bindings with your own bindings made from scratch, any
VST3 plugins built with NIH-plug need to be able to comply with the terms of the
GPLv3 license.
all licensed under the [ISC license](https://www.isc.org/licenses/).

The other plugins in the `plugins/` directory may be licensed under the GPLv3
license. Check the plugin's `Cargo.toml` file for more information.
21 changes: 5 additions & 16 deletions src/buffer/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::marker::PhantomData;

#[cfg(feature = "simd")]
use std::simd::{LaneCount, Simd, SupportedLaneCount};
use std::simd::Simd;

use super::SamplesIter;

Expand Down Expand Up @@ -226,10 +226,7 @@ impl<'slice, 'sample> Block<'slice, 'sample> {
pub fn to_channel_simd<const LANES: usize>(
&self,
sample_index: usize,
) -> Option<Simd<f32, LANES>>
where
LaneCount<LANES>: SupportedLaneCount,
{
) -> Option<Simd<f32, LANES>> {
if sample_index > self.samples() {
return None;
}
Expand Down Expand Up @@ -258,10 +255,7 @@ impl<'slice, 'sample> Block<'slice, 'sample> {
pub unsafe fn to_channel_simd_unchecked<const LANES: usize>(
&self,
sample_index: usize,
) -> Simd<f32, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
) -> Simd<f32, LANES> {
let mut values = [0.0; LANES];
for (channel_idx, value) in values.iter_mut().enumerate() {
*value = *(&(*self.buffers))
Expand All @@ -284,10 +278,7 @@ impl<'slice, 'sample> Block<'slice, 'sample> {
&mut self,
sample_index: usize,
vector: Simd<f32, LANES>,
) -> bool
where
LaneCount<LANES>: SupportedLaneCount,
{
) -> bool {
if sample_index > self.samples() {
return false;
}
Expand Down Expand Up @@ -319,9 +310,7 @@ impl<'slice, 'sample> Block<'slice, 'sample> {
&mut self,
sample_index: usize,
vector: Simd<f32, LANES>,
) where
LaneCount<LANES>: SupportedLaneCount,
{
) {
let values = vector.to_array();
for (channel_idx, value) in values.into_iter().enumerate() {
*(&mut (*self.buffers))
Expand Down
22 changes: 5 additions & 17 deletions src/buffer/samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::marker::PhantomData;

#[cfg(feature = "simd")]
use std::simd::{LaneCount, Simd, SupportedLaneCount};
use std::simd::Simd;

/// An iterator over all samples in a buffer or block, yielding iterators over each channel for
/// every sample. This iteration order offers good cache locality for per-sample access.
Expand Down Expand Up @@ -168,10 +168,7 @@ impl<'slice, 'sample> ChannelSamples<'slice, 'sample> {
/// all values.
#[cfg(feature = "simd")]
#[inline]
pub fn to_simd<const LANES: usize>(&self) -> Simd<f32, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
pub fn to_simd<const LANES: usize>(&self) -> Simd<f32, LANES> {
let used_lanes = self.len().max(LANES);
let mut values = [0.0; LANES];
for (channel_idx, value) in values.iter_mut().enumerate().take(used_lanes) {
Expand All @@ -193,10 +190,7 @@ impl<'slice, 'sample> ChannelSamples<'slice, 'sample> {
/// Undefined behavior if `LANES > channels.len()`.
#[cfg(feature = "simd")]
#[inline]
pub unsafe fn to_simd_unchecked<const LANES: usize>(&self) -> Simd<f32, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
pub unsafe fn to_simd_unchecked<const LANES: usize>(&self) -> Simd<f32, LANES> {
let mut values = [0.0; LANES];
for (channel_idx, value) in values.iter_mut().enumerate() {
*value = *(&(*self.buffers))
Expand All @@ -212,10 +206,7 @@ impl<'slice, 'sample> ChannelSamples<'slice, 'sample> {
#[cfg(feature = "simd")]
#[allow(clippy::wrong_self_convention)]
#[inline]
pub fn from_simd<const LANES: usize>(&mut self, vector: Simd<f32, LANES>)
where
LaneCount<LANES>: SupportedLaneCount,
{
pub fn from_simd<const LANES: usize>(&mut self, vector: Simd<f32, LANES>) {
let used_lanes = self.len().max(LANES);
let values = vector.to_array();
for (channel_idx, value) in values.into_iter().enumerate().take(used_lanes) {
Expand All @@ -236,10 +227,7 @@ impl<'slice, 'sample> ChannelSamples<'slice, 'sample> {
#[cfg(feature = "simd")]
#[allow(clippy::wrong_self_convention)]
#[inline]
pub unsafe fn from_simd_unchecked<const LANES: usize>(&mut self, vector: Simd<f32, LANES>)
where
LaneCount<LANES>: SupportedLaneCount,
{
pub unsafe fn from_simd_unchecked<const LANES: usize>(&mut self, vector: Simd<f32, LANES>) {
let values = vector.to_array();
for (channel_idx, value) in values.into_iter().enumerate() {
*(&mut (*self.buffers))
Expand Down
Loading