Fix typos in comments
This commit is contained in:
parent
f4995abf88
commit
0caef90b1a
|
@ -80,7 +80,7 @@ impl Default for GainParams {
|
||||||
// `.with_step_size(0.1)` function to get internal rounding.
|
// `.with_step_size(0.1)` function to get internal rounding.
|
||||||
.with_value_to_string(formatters::v2s_f32_gain_to_db(2))
|
.with_value_to_string(formatters::v2s_f32_gain_to_db(2))
|
||||||
.with_string_to_value(formatters::s2v_f32_gain_to_db()),
|
.with_string_to_value(formatters::s2v_f32_gain_to_db()),
|
||||||
// Persisted fields can be intialized like any other fields, and they'll keep their
|
// Persisted fields can be initialized like any other fields, and they'll keep their
|
||||||
// values when restoring the plugin's state.
|
// values when restoring the plugin's state.
|
||||||
random_data: RwLock::new(Vec::new()),
|
random_data: RwLock::new(Vec::new()),
|
||||||
sub_params: SubParams {
|
sub_params: SubParams {
|
||||||
|
|
|
@ -21,7 +21,7 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use crate::SpectralCompressorParams;
|
use crate::SpectralCompressorParams;
|
||||||
|
|
||||||
// These are the parameter ID prefixes used for the downwards and upwards cmpression parameters.
|
// These are the parameter ID prefixes used for the downwards and upwards compression parameters.
|
||||||
const DOWNWARDS_NAME_PREFIX: &str = "downwards_";
|
const DOWNWARDS_NAME_PREFIX: &str = "downwards_";
|
||||||
const UPWARDS_NAME_PREFIX: &str = "upwards_";
|
const UPWARDS_NAME_PREFIX: &str = "upwards_";
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ where
|
||||||
Self {
|
Self {
|
||||||
executor: executor.clone(),
|
executor: executor.clone(),
|
||||||
main_thread_id: thread::current().id(),
|
main_thread_id: thread::current().id(),
|
||||||
// With our drop implementation we guarentee that this thread never outlives this struct
|
// With our drop implementation we guarantee that this thread never outlives this struct
|
||||||
worker_thread: Some(
|
worker_thread: Some(
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name(String::from("worker"))
|
.name(String::from("worker"))
|
||||||
|
@ -88,7 +88,7 @@ where
|
||||||
|
|
||||||
fn is_main_thread(&self) -> bool {
|
fn is_main_thread(&self) -> bool {
|
||||||
// FIXME: `thread::current()` may allocate the first time it's called, is there a safe
|
// FIXME: `thread::current()` may allocate the first time it's called, is there a safe
|
||||||
// nonallocating version of this without using huge OS-specific libraries?
|
// non-allocating version of this without using huge OS-specific libraries?
|
||||||
permit_alloc(|| thread::current().id() == self.main_thread_id)
|
permit_alloc(|| thread::current().id() == self.main_thread_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,8 @@ where
|
||||||
HWND(0),
|
HWND(0),
|
||||||
HMENU(0),
|
HMENU(0),
|
||||||
HINSTANCE(0),
|
HINSTANCE(0),
|
||||||
// NOTE: We're boxing a box here. As mentioend in [PollCallback], we c an't directly
|
// NOTE: We're boxing a box here. As mentioned in [PollCallback], we can't directly
|
||||||
// pass around fat poitners, so we need a normal pointer to a fat pointer to
|
// pass around fat pointers, so we need a normal pointer to a fat pointer to
|
||||||
// be able to call this and deallocate it later
|
// be able to call this and deallocate it later
|
||||||
Box::into_raw(Box::new(callback)) as *const c_void,
|
Box::into_raw(Box::new(callback)) as *const c_void,
|
||||||
)
|
)
|
||||||
|
@ -164,7 +164,7 @@ where
|
||||||
|
|
||||||
fn is_main_thread(&self) -> bool {
|
fn is_main_thread(&self) -> bool {
|
||||||
// FIXME: `thread::current()` may allocate the first time it's called, is there a safe
|
// FIXME: `thread::current()` may allocate the first time it's called, is there a safe
|
||||||
// nonallocating version of this without using huge OS-specific libraries?
|
// non-allocating version of this without using huge OS-specific libraries?
|
||||||
permit_alloc(|| thread::current().id() == self.main_thread_id)
|
permit_alloc(|| thread::current().id() == self.main_thread_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ impl ParamMut for BoolParam {
|
||||||
fn set_normalized_value(&self, normalized: f32) {
|
fn set_normalized_value(&self, normalized: f32) {
|
||||||
// NOTE: The double conversion here is to make sure the state is reproducible. State is
|
// NOTE: The double conversion here is to make sure the state is reproducible. State is
|
||||||
// saved and restored using plain values, and the new normalized value will be
|
// saved and restored using plain values, and the new normalized value will be
|
||||||
// different from `normalized`. This is not necesasry for the modulation as these
|
// different from `normalized`. This is not necessary for the modulation as these
|
||||||
// values are never shown to the host.
|
// values are never shown to the host.
|
||||||
self.set_plain_value(self.preview_plain(normalized))
|
self.set_plain_value(self.preview_plain(normalized))
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ impl ParamMut for FloatParam {
|
||||||
fn set_normalized_value(&self, normalized: f32) {
|
fn set_normalized_value(&self, normalized: f32) {
|
||||||
// NOTE: The double conversion here is to make sure the state is reproducible. State is
|
// NOTE: The double conversion here is to make sure the state is reproducible. State is
|
||||||
// saved and restored using plain values, and the new normalized value will be
|
// saved and restored using plain values, and the new normalized value will be
|
||||||
// different from `normalized`. This is not necesasry for the modulation as these
|
// different from `normalized`. This is not necessary for the modulation as these
|
||||||
// values are never shown to the host.
|
// values are never shown to the host.
|
||||||
self.set_plain_value(self.preview_plain(normalized))
|
self.set_plain_value(self.preview_plain(normalized))
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ impl FloatParam {
|
||||||
/// clicks and zipper noises.
|
/// clicks and zipper noises.
|
||||||
pub fn with_smoother(mut self, style: SmoothingStyle) -> Self {
|
pub fn with_smoother(mut self, style: SmoothingStyle) -> Self {
|
||||||
// Logarithmic smoothing will cause problems if the range goes through zero since then you
|
// Logarithmic smoothing will cause problems if the range goes through zero since then you
|
||||||
// end up multplying by zero
|
// end up multiplying by zero
|
||||||
let goes_through_zero = match (&style, &self.range) {
|
let goes_through_zero = match (&style, &self.range) {
|
||||||
(
|
(
|
||||||
SmoothingStyle::Logarithmic(_),
|
SmoothingStyle::Logarithmic(_),
|
||||||
|
|
|
@ -198,7 +198,7 @@ impl ParamMut for IntParam {
|
||||||
fn set_normalized_value(&self, normalized: f32) {
|
fn set_normalized_value(&self, normalized: f32) {
|
||||||
// NOTE: The double conversion here is to make sure the state is reproducible. State is
|
// NOTE: The double conversion here is to make sure the state is reproducible. State is
|
||||||
// saved and restored using plain values, and the new normalized value will be
|
// saved and restored using plain values, and the new normalized value will be
|
||||||
// different from `normalized`. This is not necesasry for the modulation as these
|
// different from `normalized`. This is not necessary for the modulation as these
|
||||||
// values are never shown to the host.
|
// values are never shown to the host.
|
||||||
self.set_plain_value(self.preview_plain(normalized))
|
self.set_plain_value(self.preview_plain(normalized))
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ impl IntParam {
|
||||||
/// clicks and zipper noises.
|
/// clicks and zipper noises.
|
||||||
pub fn with_smoother(mut self, style: SmoothingStyle) -> Self {
|
pub fn with_smoother(mut self, style: SmoothingStyle) -> Self {
|
||||||
// Logarithmic smoothing will cause problems if the range goes through zero since then you
|
// Logarithmic smoothing will cause problems if the range goes through zero since then you
|
||||||
// end up multplying by zero
|
// end up multiplying by zero
|
||||||
let goes_through_zero = match (&style, &self.range) {
|
let goes_through_zero = match (&style, &self.range) {
|
||||||
(SmoothingStyle::Logarithmic(_), IntRange::Linear { min, max }) => {
|
(SmoothingStyle::Logarithmic(_), IntRange::Linear { min, max }) => {
|
||||||
*min == 0 || *max == 0 || min.signum() != max.signum()
|
*min == 0 || *max == 0 || min.signum() != max.signum()
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl FloatRange {
|
||||||
(scaled_proportion.powf(*factor) * 0.5) + 0.5
|
(scaled_proportion.powf(*factor) * 0.5) + 0.5
|
||||||
} else {
|
} else {
|
||||||
// The part below the center gets scaled, inverted (so the range is [0, 1] where
|
// The part below the center gets scaled, inverted (so the range is [0, 1] where
|
||||||
// 0 corresponds to the center proportion and 1 corresponds to the orignal
|
// 0 corresponds to the center proportion and 1 corresponds to the original
|
||||||
// normalized 0 value), skewed, inverted back again, and then scaled back to the
|
// normalized 0 value), skewed, inverted back again, and then scaled back to the
|
||||||
// original range
|
// original range
|
||||||
let inverted_scaled_proportion =
|
let inverted_scaled_proportion =
|
||||||
|
@ -137,7 +137,7 @@ impl FloatRange {
|
||||||
// range up into 100 segments, but if `self.step_size` is set then we'll use that. Ideally
|
// range up into 100 segments, but if `self.step_size` is set then we'll use that. Ideally
|
||||||
// we might want to split the range up into at most 100 segments, falling back to the step
|
// we might want to split the range up into at most 100 segments, falling back to the step
|
||||||
// size if the total number of steps would be smaller than that, but since ranges can be
|
// size if the total number of steps would be smaller than that, but since ranges can be
|
||||||
// nonlienar that's a bit difficult to pull off.
|
// nonlinear that's a bit difficult to pull off.
|
||||||
// TODO: At some point, implement the above mentioned step size quantization
|
// TODO: At some point, implement the above mentioned step size quantization
|
||||||
match self {
|
match self {
|
||||||
FloatRange::Linear { min, max }
|
FloatRange::Linear { min, max }
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl SmoothingStyle {
|
||||||
((target / start) as f64).powf((num_steps as f64).recip()) as f32
|
((target / start) as f64).powf((num_steps as f64).recip()) as f32
|
||||||
}
|
}
|
||||||
// In this case the step size value is the coefficient the current value will be
|
// In this case the step size value is the coefficient the current value will be
|
||||||
// multiplied by, while the target value is multipled by one minus the coefficient. This
|
// multiplied by, while the target value is multiplied by one minus the coefficient. This
|
||||||
// reaches 99.99% of the target value after `num_steps`. The smoother will snap to the
|
// reaches 99.99% of the target value after `num_steps`. The smoother will snap to the
|
||||||
// target value after that point.
|
// target value after that point.
|
||||||
SmoothingStyle::Exponential(_) => 0.0001f64.powf((num_steps as f64).recip()) as f32,
|
SmoothingStyle::Exponential(_) => 0.0001f64.powf((num_steps as f64).recip()) as f32,
|
||||||
|
@ -361,7 +361,7 @@ impl<T: Smoothable> Smoother<T> {
|
||||||
let target = T::atomic_load(&self.target);
|
let target = T::atomic_load(&self.target);
|
||||||
|
|
||||||
// `self.next()` will yield the current value if the parameter is no longer smoothing, but
|
// `self.next()` will yield the current value if the parameter is no longer smoothing, but
|
||||||
// it's a bit of a waste to continuesly call that if only the first couple or none of the
|
// it's a bit of a waste to continuously call that if only the first couple or none of the
|
||||||
// values in `block_values` would require smoothing and the rest don't. Instead, we'll just
|
// values in `block_values` would require smoothing and the rest don't. Instead, we'll just
|
||||||
// smooth the values as necessary, and then reuse the target value for the rest of the
|
// smooth the values as necessary, and then reuse the target value for the rest of the
|
||||||
// block.
|
// block.
|
||||||
|
|
|
@ -264,7 +264,7 @@ pub trait Editor: Send + Sync {
|
||||||
// callback that deos involve actual GUI operations will still be spooled to the IRunLoop
|
// callback that deos involve actual GUI operations will still be spooled to the IRunLoop
|
||||||
// instance.
|
// instance.
|
||||||
// TODO: This function should return an `Option` instead. Right now window opening failures are
|
// TODO: This function should return an `Option` instead. Right now window opening failures are
|
||||||
// always fatal. This would need to be fixed in basevie first.
|
// always fatal. This would need to be fixed in baseview first.
|
||||||
fn spawn(
|
fn spawn(
|
||||||
&self,
|
&self,
|
||||||
parent: ParentWindowHandle,
|
parent: ParentWindowHandle,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Re-export the macros, derive macros are already re-exported ferom their respectivem odules
|
// Re-export the macros, derive macros are already re-exported from their respective modules
|
||||||
pub use crate::debug::*;
|
pub use crate::debug::*;
|
||||||
|
|
||||||
pub use crate::nih_export_clap;
|
pub use crate::nih_export_clap;
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub fn hann_in_place(window: &mut [f32]) {
|
||||||
let size = window.len();
|
let size = window.len();
|
||||||
|
|
||||||
// We want to scale `[0, size - 1]` to `[0, pi]`.
|
// We want to scale `[0, size - 1]` to `[0, pi]`.
|
||||||
// XXX: The `sin^2()` version results in weird rounding errors that cause spectral leakeage
|
// XXX: The `sin^2()` version results in weird rounding errors that cause spectral leakage
|
||||||
let scale = (size as f32 - 1.0).recip() * f32::consts::TAU;
|
let scale = (size as f32 - 1.0).recip() * f32::consts::TAU;
|
||||||
for (i, sample) in window.iter_mut().enumerate() {
|
for (i, sample) in window.iter_mut().enumerate() {
|
||||||
let cos = (i as f32 * scale).cos();
|
let cos = (i as f32 * scale).cos();
|
||||||
|
|
|
@ -14,7 +14,7 @@ macro_rules! check_null_ptr {
|
||||||
/// The same as [`check_null_ptr!`], but with a custom message.
|
/// The same as [`check_null_ptr!`], but with a custom message.
|
||||||
macro_rules! check_null_ptr_msg {
|
macro_rules! check_null_ptr_msg {
|
||||||
($msg:expr, $ret:expr, $ptr:expr $(, $ptrs:expr)* $(, )?) => {
|
($msg:expr, $ret:expr, $ptr:expr $(, $ptrs:expr)* $(, )?) => {
|
||||||
// Clippy doesn't understand it when we use a unit in our `check_null_ptr!()` maccro, even
|
// Clippy doesn't understand it when we use a unit in our `check_null_ptr!()` macro, even
|
||||||
// if we explicitly pattern match on that unit
|
// if we explicitly pattern match on that unit
|
||||||
#[allow(clippy::unused_unit)]
|
#[allow(clippy::unused_unit)]
|
||||||
if $ptr.is_null() $(|| $ptrs.is_null())* {
|
if $ptr.is_null() $(|| $ptrs.is_null())* {
|
||||||
|
|
|
@ -203,7 +203,7 @@ pub struct Wrapper<P: ClapPlugin> {
|
||||||
|
|
||||||
clap_plugin_params: clap_plugin_params,
|
clap_plugin_params: clap_plugin_params,
|
||||||
host_params: AtomicRefCell<Option<ClapPtr<clap_host_params>>>,
|
host_params: AtomicRefCell<Option<ClapPtr<clap_host_params>>>,
|
||||||
// These fiels are exactly the same as their VST3 wrapper counterparts.
|
// These fields are exactly the same as their VST3 wrapper counterparts.
|
||||||
//
|
//
|
||||||
/// The keys from `param_map` in a stable order.
|
/// The keys from `param_map` in a stable order.
|
||||||
param_hashes: Vec<u32>,
|
param_hashes: Vec<u32>,
|
||||||
|
@ -338,7 +338,7 @@ impl<P: ClapPlugin> EventLoop<Task, Wrapper<P>> for Wrapper<P> {
|
||||||
unsafe_clap_call! { thread_check=>is_main_thread(&*self.host_callback) }
|
unsafe_clap_call! { thread_check=>is_main_thread(&*self.host_callback) }
|
||||||
}
|
}
|
||||||
// FIXME: `thread::current()` may allocate the first time it's called, is there a safe
|
// FIXME: `thread::current()` may allocate the first time it's called, is there a safe
|
||||||
// nonallocating version of this without using huge OS-specific libraries?
|
// non-allocating version of this without using huge OS-specific libraries?
|
||||||
None => permit_alloc(|| thread::current().id() == self.main_thread_id),
|
None => permit_alloc(|| thread::current().id() == self.main_thread_id),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
assert!(!host_callback.is_null());
|
assert!(!host_callback.is_null());
|
||||||
let host_callback = unsafe { ClapPtr::new(host_callback) };
|
let host_callback = unsafe { ClapPtr::new(host_callback) };
|
||||||
|
|
||||||
// This is a mapping from the parameter IDs specified by the plugin to pointers to thsoe
|
// This is a mapping from the parameter IDs specified by the plugin to pointers to those
|
||||||
// parameters. These pointers are assumed to be safe to dereference as long as
|
// parameters. These pointers are assumed to be safe to dereference as long as
|
||||||
// `wrapper.plugin` is alive. The plugin API identifiers these parameters by hashes, which
|
// `wrapper.plugin` is alive. The plugin API identifiers these parameters by hashes, which
|
||||||
// we'll calculate from the string ID specified by the plugin. These parameters should also
|
// we'll calculate from the string ID specified by the plugin. These parameters should also
|
||||||
|
@ -831,7 +831,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
let mut input_events = self.input_events.borrow_mut();
|
let mut input_events = self.input_events.borrow_mut();
|
||||||
input_events.clear();
|
input_events.clear();
|
||||||
|
|
||||||
// To achive this, we'll always read one event ahead
|
// To achieve this, we'll always read one event ahead
|
||||||
let num_events = clap_call! { in_=>size(in_) };
|
let num_events = clap_call! { in_=>size(in_) };
|
||||||
if num_events == 0 {
|
if num_events == 0 {
|
||||||
return None;
|
return None;
|
||||||
|
@ -867,7 +867,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
);
|
);
|
||||||
|
|
||||||
// NOTE: We explicitly did not do this on a block split because that seems a bit excessive.
|
// NOTE: We explicitly did not do this on a block split because that seems a bit excessive.
|
||||||
// When we're performing a block split we're guarenteed that there's still at least one more
|
// When we're performing a block split we're guaranteed that there's still at least one more
|
||||||
// parameter event after the split so this function will still be called.
|
// parameter event after the split so this function will still be called.
|
||||||
if parameter_values_changed {
|
if parameter_values_changed {
|
||||||
self.notify_param_values_changed();
|
self.notify_param_values_changed();
|
||||||
|
@ -1283,12 +1283,12 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
);
|
);
|
||||||
|
|
||||||
// If the parameter supports polyphonic modulation, then the plugin needs to be
|
// If the parameter supports polyphonic modulation, then the plugin needs to be
|
||||||
// informed that the parmaeter has been monophonicall automated. This allows the
|
// informed that the parameter has been monophonically automated. This allows the
|
||||||
// plugin to update all of its polyphonic modulation values, since polyphonic
|
// plugin to update all of its polyphonic modulation values, since polyphonic
|
||||||
// modulation acts as an offset to the monophonic value.
|
// modulation acts as an offset to the monophonic value.
|
||||||
if let Some(poly_modulation_id) = self.poly_mod_ids_by_hash.get(&event.param_id) {
|
if let Some(poly_modulation_id) = self.poly_mod_ids_by_hash.get(&event.param_id) {
|
||||||
// The modulation offset needs to be normalized to account for modulated
|
// The modulation offset needs to be normalized to account for modulated
|
||||||
// integer or enum parmaeters
|
// integer or enum parameters
|
||||||
let param_ptr = self.param_by_hash[&event.param_id];
|
let param_ptr = self.param_by_hash[&event.param_id];
|
||||||
let normalized_value =
|
let normalized_value =
|
||||||
event.value as f32 / param_ptr.step_count().unwrap_or(1) as f32;
|
event.value as f32 / param_ptr.step_count().unwrap_or(1) as f32;
|
||||||
|
@ -1309,7 +1309,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
match self.poly_mod_ids_by_hash.get(&event.param_id) {
|
match self.poly_mod_ids_by_hash.get(&event.param_id) {
|
||||||
Some(poly_modulation_id) => {
|
Some(poly_modulation_id) => {
|
||||||
// The modulation offset needs to be normalized to account for modulated
|
// The modulation offset needs to be normalized to account for modulated
|
||||||
// integer or enum parmaeters
|
// integer or enum parameters
|
||||||
let param_ptr = self.param_by_hash[&event.param_id];
|
let param_ptr = self.param_by_hash[&event.param_id];
|
||||||
let normalized_offset =
|
let normalized_offset =
|
||||||
event.amount as f32 / param_ptr.step_count().unwrap_or(1) as f32;
|
event.amount as f32 / param_ptr.step_count().unwrap_or(1) as f32;
|
||||||
|
@ -1652,7 +1652,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
check_null_ptr!(false, plugin);
|
check_null_ptr!(false, plugin);
|
||||||
let wrapper = &*(plugin as *const Self);
|
let wrapper = &*(plugin as *const Self);
|
||||||
|
|
||||||
// We weren't allowed to query these in the constructor, so we need to do it now intead.
|
// We weren't allowed to query these in the constructor, so we need to do it now instead.
|
||||||
*wrapper.host_gui.borrow_mut() =
|
*wrapper.host_gui.borrow_mut() =
|
||||||
query_host_extension::<clap_host_gui>(&wrapper.host_callback, CLAP_EXT_GUI);
|
query_host_extension::<clap_host_gui>(&wrapper.host_callback, CLAP_EXT_GUI);
|
||||||
*wrapper.host_latency.borrow_mut() =
|
*wrapper.host_latency.borrow_mut() =
|
||||||
|
@ -1692,7 +1692,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
process_mode: wrapper.current_process_mode.load(),
|
process_mode: wrapper.current_process_mode.load(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Befure initializing the plugin, make sure all smoothers are set the the default values
|
// Before initializing the plugin, make sure all smoothers are set the the default values
|
||||||
for param in wrapper.param_by_hash.values() {
|
for param in wrapper.param_by_hash.values() {
|
||||||
param.update_smoother(buffer_config.sample_rate, true);
|
param.update_smoother(buffer_config.sample_rate, true);
|
||||||
}
|
}
|
||||||
|
@ -1821,7 +1821,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
let process = &*process;
|
let process = &*process;
|
||||||
|
|
||||||
// Before doing anything, clear out any auxiliary outputs since they may contain
|
// Before doing anything, clear out any auxiliary outputs since they may contain
|
||||||
// uninitialized data when the host assumes that we'll always write soemthing there
|
// uninitialized data when the host assumes that we'll always write something there
|
||||||
let current_bus_config = wrapper.current_bus_config.load();
|
let current_bus_config = wrapper.current_bus_config.load();
|
||||||
let has_main_input = current_bus_config.num_input_channels > 0;
|
let has_main_input = current_bus_config.num_input_channels > 0;
|
||||||
let has_main_output = current_bus_config.num_output_channels > 0;
|
let has_main_output = current_bus_config.num_output_channels > 0;
|
||||||
|
@ -1891,8 +1891,8 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
);
|
);
|
||||||
|
|
||||||
// If there are any parameter changes after `block_start` and sample
|
// If there are any parameter changes after `block_start` and sample
|
||||||
// accurate automatoin is enabled or the host sends new transport
|
// accurate automation is enabled or the host sends new transport
|
||||||
// inforamtion, then we'll process a new block just after that. Otherwise we can
|
// information, then we'll process a new block just after that. Otherwise we can
|
||||||
// process all audio until the end of the buffer.
|
// process all audio until the end of the buffer.
|
||||||
match split_result {
|
match split_result {
|
||||||
Some((next_param_change_sample_idx, next_param_change_event_idx)) => {
|
Some((next_param_change_sample_idx, next_param_change_event_idx)) => {
|
||||||
|
@ -2932,7 +2932,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
strlcpy(&mut param_info.module, param_group);
|
strlcpy(&mut param_info.module, param_group);
|
||||||
// We don't use the actual minimum and maximum values here because that would not scale
|
// We don't use the actual minimum and maximum values here because that would not scale
|
||||||
// with skewed integer ranges. Instead, just treat all parameters as `[0, 1]` normalized
|
// with skewed integer ranges. Instead, just treat all parameters as `[0, 1]` normalized
|
||||||
// paramters multiplied by the step size.
|
// parameters multiplied by the step size.
|
||||||
param_info.min_value = 0.0;
|
param_info.min_value = 0.0;
|
||||||
// Stepped parameters are unnormalized float parameters since there's no separate step
|
// Stepped parameters are unnormalized float parameters since there's no separate step
|
||||||
// range option
|
// range option
|
||||||
|
|
|
@ -342,7 +342,7 @@ impl Cpal {
|
||||||
|
|
||||||
move |data, _info| {
|
move |data, _info| {
|
||||||
// Things may have been moved in between callbacks, so these pointers need to be set up
|
// Things may have been moved in between callbacks, so these pointers need to be set up
|
||||||
// agian on each invocation
|
// again on each invocation
|
||||||
unsafe {
|
unsafe {
|
||||||
buffer.with_raw_vec(|output_slices| {
|
buffer.with_raw_vec(|output_slices| {
|
||||||
for (output_slice, channel) in output_slices.iter_mut().zip(channels.iter_mut())
|
for (output_slice, channel) in output_slices.iter_mut().zip(channels.iter_mut())
|
||||||
|
|
|
@ -119,7 +119,7 @@ impl Backend for Jack {
|
||||||
// Unless it is a SysEx message, a JACK MIDI message is always three bytes or
|
// Unless it is a SysEx message, a JACK MIDI message is always three bytes or
|
||||||
// less and is normalized (starts with a status byte and is self-contained).
|
// less and is normalized (starts with a status byte and is self-contained).
|
||||||
if midi.bytes.len() <= 3 {
|
if midi.bytes.len() <= 3 {
|
||||||
// JACK may not pad messages with zeroes, so mesages for things like channel
|
// JACK may not pad messages with zeroes, so messages for things like channel
|
||||||
// pressure may be less than three bytes in length.
|
// pressure may be less than three bytes in length.
|
||||||
let mut midi_data = [0u8; 3];
|
let mut midi_data = [0u8; 3];
|
||||||
midi_data[..midi.bytes.len()].copy_from_slice(midi.bytes);
|
midi_data[..midi.bytes.len()].copy_from_slice(midi.bytes);
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl<P: Plugin, B: Backend> GuiContext for WrapperGuiContext<P, B> {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn raw_begin_set_parameter(&self, _param: ParamPtr) {
|
unsafe fn raw_begin_set_parameter(&self, _param: ParamPtr) {
|
||||||
// Since there's no autmoation being recorded here, gestures don't mean anything
|
// Since there's no automation being recorded here, gestures don't mean anything
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn raw_set_parameter_normalized(&self, param: ParamPtr, normalized: f32) {
|
unsafe fn raw_set_parameter_normalized(&self, param: ParamPtr, normalized: f32) {
|
||||||
|
|
|
@ -217,7 +217,7 @@ impl<P: Plugin, B: Backend> Wrapper<P, B> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Befure initializing the plugin, make sure all smoothers are set the the default values
|
// Before initializing the plugin, make sure all smoothers are set the the default values
|
||||||
for param in wrapper.known_parameters.iter() {
|
for param in wrapper.known_parameters.iter() {
|
||||||
unsafe { param.update_smoother(wrapper.buffer_config.sample_rate, true) };
|
unsafe { param.update_smoother(wrapper.buffer_config.sample_rate, true) };
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ impl<P: Plugin, B: Backend> Wrapper<P, B> {
|
||||||
move |buffer, transport, input_events, output_events| {
|
move |buffer, transport, input_events, output_events| {
|
||||||
// TODO: This process wrapper should actually be in the backends (since the backends
|
// TODO: This process wrapper should actually be in the backends (since the backends
|
||||||
// should also not allocate in their audio callbacks), but that's a bit more
|
// should also not allocate in their audio callbacks), but that's a bit more
|
||||||
// erorr prone
|
// error prone
|
||||||
process_wrapper(|| {
|
process_wrapper(|| {
|
||||||
if should_terminate.load(Ordering::SeqCst) {
|
if should_terminate.load(Ordering::SeqCst) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -73,8 +73,8 @@ impl<P: Vst3Plugin> GuiContext for WrapperGuiContext<P> {
|
||||||
// changing in the middle of the process callback, which would be unsound.
|
// changing in the middle of the process callback, which would be unsound.
|
||||||
// FIXME: So this doesn't work for REAPER, because they just silently stop
|
// FIXME: So this doesn't work for REAPER, because they just silently stop
|
||||||
// processing audio when you bypass the plugin. Great. We can add a time
|
// processing audio when you bypass the plugin. Great. We can add a time
|
||||||
// based heuristic to work aorund this in the meantime.
|
|
||||||
concat!("asfd", "dsaf", stringify!(34));
|
concat!("asfd", "dsaf", stringify!(34));
|
||||||
|
// based heuristic to work around this in the meantime.
|
||||||
if !self.inner.is_processing.load(Ordering::SeqCst) {
|
if !self.inner.is_processing.load(Ordering::SeqCst) {
|
||||||
self.inner.set_normalized_value_by_hash(
|
self.inner.set_normalized_value_by_hash(
|
||||||
*hash,
|
*hash,
|
||||||
|
|
|
@ -196,7 +196,7 @@ impl<P: Vst3Plugin> WrapperInner<P> {
|
||||||
// on `Self::updated_state_sender`
|
// on `Self::updated_state_sender`
|
||||||
let (updated_state_sender, updated_state_receiver) = channel::bounded(0);
|
let (updated_state_sender, updated_state_receiver) = channel::bounded(0);
|
||||||
|
|
||||||
// This is a mapping from the parameter IDs specified by the plugin to pointers to thsoe
|
// This is a mapping from the parameter IDs specified by the plugin to pointers to those
|
||||||
// parameters. These pointers are assumed to be safe to dereference as long as
|
// parameters. These pointers are assumed to be safe to dereference as long as
|
||||||
// `wrapper.plugin` is alive. The plugin API identifiers these parameters by hashes, which
|
// `wrapper.plugin` is alive. The plugin API identifiers these parameters by hashes, which
|
||||||
// we'll calculate from the string ID specified by the plugin. These parameters should also
|
// we'll calculate from the string ID specified by the plugin. These parameters should also
|
||||||
|
@ -357,7 +357,7 @@ impl<P: Vst3Plugin> WrapperInner<P> {
|
||||||
} else {
|
} else {
|
||||||
// If the editor is open, and the host exposes the `IRunLoop` interface, then we'll run
|
// If the editor is open, and the host exposes the `IRunLoop` interface, then we'll run
|
||||||
// the task on the host's GUI thread using that interface. Otherwise we'll use the
|
// the task on the host's GUI thread using that interface. Otherwise we'll use the
|
||||||
// regular eent loop. If the editor gets dropped while there's still outstanding work
|
// regular event loop. If the editor gets dropped while there's still outstanding work
|
||||||
// left in the run loop task queue, then those tasks will be posted to the regular event
|
// left in the run loop task queue, then those tasks will be posted to the regular event
|
||||||
// loop so no work is lost.
|
// loop so no work is lost.
|
||||||
match &*self.plug_view.read() {
|
match &*self.plug_view.read() {
|
||||||
|
@ -507,7 +507,7 @@ impl<P: Vst3Plugin> MainThreadExecutor<Task> for WrapperInner<P> {
|
||||||
// TODO: When we add GUI resizing and context menus, this should propagate those events to
|
// TODO: When we add GUI resizing and context menus, this should propagate those events to
|
||||||
// `IRunLoop` on Linux to keep REAPER happy. That does mean a double spool, but we can
|
// `IRunLoop` on Linux to keep REAPER happy. That does mean a double spool, but we can
|
||||||
// come up with a nicer solution to handle that later (can always add a separate
|
// come up with a nicer solution to handle that later (can always add a separate
|
||||||
// function for checking if a to be scheduled task can be handled right ther and
|
// function for checking if a to be scheduled task can be handled right there and
|
||||||
// then).
|
// then).
|
||||||
match task {
|
match task {
|
||||||
Task::TriggerRestart(flags) => match &*self.component_handler.borrow() {
|
Task::TriggerRestart(flags) => match &*self.component_handler.borrow() {
|
||||||
|
|
|
@ -345,7 +345,7 @@ impl<P: Vst3Plugin> IPlugView for WrapperView<P> {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn on_wheel(&self, _distance: f32) -> tresult {
|
unsafe fn on_wheel(&self, _distance: f32) -> tresult {
|
||||||
// We'll let the plugin use the OS' input mechamisms because not all DAWs (or very few
|
// We'll let the plugin use the OS' input mechanisms because not all DAWs (or very few
|
||||||
// actually) implement these functions
|
// actually) implement these functions
|
||||||
kResultOk
|
kResultOk
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ impl<P: Vst3Plugin> IEventHandler for RunLoopEventHandler<P> {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
impl<P: Vst3Plugin> Drop for RunLoopEventHandler<P> {
|
impl<P: Vst3Plugin> Drop for RunLoopEventHandler<P> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// When this object gets dropped and there are still unprocssed tasks left, then we'll
|
// When this object gets dropped and there are still unprocessed tasks left, then we'll
|
||||||
// handle those in the regular event loop so no work gets lost
|
// handle those in the regular event loop so no work gets lost
|
||||||
let mut posting_failed = false;
|
let mut posting_failed = false;
|
||||||
while let Some(task) = self.tasks.pop() {
|
while let Some(task) = self.tasks.pop() {
|
||||||
|
@ -519,7 +519,7 @@ impl<P: Vst3Plugin> Drop for RunLoopEventHandler<P> {
|
||||||
|
|
||||||
if posting_failed {
|
if posting_failed {
|
||||||
nih_debug_assert_failure!(
|
nih_debug_assert_failure!(
|
||||||
"Outstanding tasks have been dropped when clsoing the editor as the task queue \
|
"Outstanding tasks have been dropped when closing the editor as the task queue \
|
||||||
was full"
|
was full"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl<P: Vst3Plugin> IPluginBase for Wrapper<P> {
|
||||||
|
|
||||||
impl<P: Vst3Plugin> IComponent for Wrapper<P> {
|
impl<P: Vst3Plugin> IComponent for Wrapper<P> {
|
||||||
unsafe fn get_controller_class_id(&self, _tuid: *mut vst3_sys::IID) -> tresult {
|
unsafe fn get_controller_class_id(&self, _tuid: *mut vst3_sys::IID) -> tresult {
|
||||||
// We won't separate the edit controller to keep the implemetnation a bit smaller
|
// We won't separate the edit controller to keep the implementation a bit smaller
|
||||||
kNoInterface
|
kNoInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ impl<P: Vst3Plugin> IComponent for Wrapper<P> {
|
||||||
// custom channel layout overrides we need to initialize here.
|
// custom channel layout overrides we need to initialize here.
|
||||||
match (state != 0, self.inner.current_buffer_config.load()) {
|
match (state != 0, self.inner.current_buffer_config.load()) {
|
||||||
(true, Some(buffer_config)) => {
|
(true, Some(buffer_config)) => {
|
||||||
// Befure initializing the plugin, make sure all smoothers are set the the default values
|
// Before initializing the plugin, make sure all smoothers are set the the default values
|
||||||
for param in self.inner.param_by_hash.values() {
|
for param in self.inner.param_by_hash.values() {
|
||||||
param.update_smoother(buffer_config.sample_rate, true);
|
param.update_smoother(buffer_config.sample_rate, true);
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1033,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
|
||||||
nih_debug_assert!(data.num_samples >= 0);
|
nih_debug_assert!(data.num_samples >= 0);
|
||||||
|
|
||||||
// Before doing anything, clear out any auxiliary outputs since they may contain
|
// Before doing anything, clear out any auxiliary outputs since they may contain
|
||||||
// uninitialized data when the host assumes that we'll always write soemthing there
|
// uninitialized data when the host assumes that we'll always write something there
|
||||||
let current_bus_config = self.inner.current_bus_config.load();
|
let current_bus_config = self.inner.current_bus_config.load();
|
||||||
let has_main_input = current_bus_config.num_input_channels > 0;
|
let has_main_input = current_bus_config.num_input_channels > 0;
|
||||||
// HACK: Bitwig requires VST3 plugins to always have a main output. We'll however still
|
// HACK: Bitwig requires VST3 plugins to always have a main output. We'll however still
|
||||||
|
@ -1238,7 +1238,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
|
||||||
// NOTE: It's important that this sort is stable, because parameter changes need to be
|
// NOTE: It's important that this sort is stable, because parameter changes need to be
|
||||||
// processed before note events. Otherwise you'll get out of bounds note events
|
// processed before note events. Otherwise you'll get out of bounds note events
|
||||||
// with block splitting when the note event occurs at one index after the end (or
|
// with block splitting when the note event occurs at one index after the end (or
|
||||||
// on the exlusive end index) of the block.
|
// on the exclusive end index) of the block.
|
||||||
process_events.sort_by_key(|event| match event {
|
process_events.sort_by_key(|event| match event {
|
||||||
ProcessEvent::ParameterChange { timing, .. } => *timing,
|
ProcessEvent::ParameterChange { timing, .. } => *timing,
|
||||||
ProcessEvent::NoteEvent { timing, .. } => *timing,
|
ProcessEvent::NoteEvent { timing, .. } => *timing,
|
||||||
|
@ -1252,7 +1252,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
|
||||||
// sorted process event array until we run into for the current sample, and then
|
// sorted process event array until we run into for the current sample, and then
|
||||||
// process the block between the current sample and the sample containing the next
|
// process the block between the current sample and the sample containing the next
|
||||||
// parameter change, if any. All timings also need to be compensated for this. As
|
// parameter change, if any. All timings also need to be compensated for this. As
|
||||||
// mentioend above, for this to work correctly parameter changes need to be ordered
|
// mentioned above, for this to work correctly parameter changes need to be ordered
|
||||||
// before note events at the same index.
|
// before note events at the same index.
|
||||||
// The extra scope is here to make sure we release the borrow on input_events
|
// The extra scope is here to make sure we release the borrow on input_events
|
||||||
{
|
{
|
||||||
|
@ -1557,7 +1557,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
|
||||||
// There's also a ppqPos field, but uh how about no
|
// There's also a ppqPos field, but uh how about no
|
||||||
vst3_event.sample_offset = event.timing() as i32 + block_start as i32;
|
vst3_event.sample_offset = event.timing() as i32 + block_start as i32;
|
||||||
|
|
||||||
// `voice_id.onwrap_or(|| ...)` triggers
|
// `voice_id.unwrap_or(|| ...)` triggers
|
||||||
// https://github.com/rust-lang/rust-clippy/issues/8522
|
// https://github.com/rust-lang/rust-clippy/issues/8522
|
||||||
#[allow(clippy::unnecessary_lazy_evaluations)]
|
#[allow(clippy::unnecessary_lazy_evaluations)]
|
||||||
match event {
|
match event {
|
||||||
|
|
Loading…
Reference in a new issue