Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ log = "0.4"
num-traits = "0.2"
libc = "0.2"
bitflags = "1"
libloading = "0.5"
libloading = "0.7"

[dev-dependencies]
time = "0.1"
rand = "0.7"
time = "0.2"
rand = "0.8"

[[example]]
name = "dimension_expander"
Expand Down
3 changes: 2 additions & 1 deletion examples/dimension_expander.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use vst::util::AtomicFloat;
use std::collections::VecDeque;
use std::f64::consts::PI;
use std::sync::Arc;
use time::OffsetDateTime;

/// Calculate the length in samples for a delay. Size ranges from 0.0 to 1.0.
fn delay(index: usize, mut size: f32) -> isize {
Expand Down Expand Up @@ -155,7 +156,7 @@ impl Plugin for DimensionExpander {
let mut right_processed = 0.0;

// Recalculate time per sample
let time_s = time::precise_time_ns() as f64 / 1_000_000_000.0;
let time_s = (OffsetDateTime::now_utc() - OffsetDateTime::unix_epoch()).as_seconds_f64();

// Use buffer index to offset volume LFO
for (n, buffer) in self.buffers.iter_mut().enumerate() {
Expand Down
31 changes: 16 additions & 15 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,23 @@ impl<T: Host> PluginLoader<T> {
/// `/Library/Audio/Plug-Ins/VST/iZotope Ozone 5.vst/Contents/MacOS/PluginHooksVST`
pub fn load(path: &Path, host: Arc<Mutex<T>>) -> Result<PluginLoader<T>, PluginLoadError> {
// Try loading the library at the given path
let lib = match Library::new(path) {
Ok(l) => l,
Err(_) => return Err(PluginLoadError::InvalidPath),
};
unsafe {
let lib = match Library::new(path) {
Ok(l) => l,
Err(_) => return Err(PluginLoadError::InvalidPath),
};

Ok(PluginLoader {
main: unsafe {
// Search the library for the VSTAPI entry point
match lib.get(b"VSTPluginMain") {
Ok(s) => *s,
_ => return Err(PluginLoadError::NotAPlugin),
}
},
lib: Arc::new(lib),
host,
})
Ok(PluginLoader {
main:
// Search the library for the VSTAPI entry point
match lib.get(b"VSTPluginMain") {
Ok(s) => *s,
_ => return Err(PluginLoadError::NotAPlugin),
},
lib: Arc::new(lib),
host,
})
}
}

/// Call the VST entry point and retrieve a (possibly null) pointer.
Expand Down
4 changes: 2 additions & 2 deletions src/util/parameter_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ mod tests {
thread::spawn(move || {
let mut values = vec![0f32; PARAMETERS];
for _ in 0..UPDATES {
let p: usize = t_rng.gen_range(0, PARAMETERS);
let v: f32 = t_rng.gen_range(0.0, 1.0);
let p: usize = t_rng.gen_range(0..PARAMETERS);
let v: f32 = t_rng.gen_range(0.0..1.0);
values[p] = v;
t_transfer.set_parameter(p, v);
}
Expand Down