Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Add prelude for commonly used items #161

Merged
merged 5 commits into from
Feb 26, 2022
Merged
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
5 changes: 1 addition & 4 deletions examples/dimension_expander.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
#[macro_use]
extern crate vst;

use vst::buffer::AudioBuffer;
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
use vst::util::AtomicFloat;

use std::collections::VecDeque;
use std::f64::consts::PI;
use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};
use vst::prelude::*;

/// 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
3 changes: 1 addition & 2 deletions examples/fwd_midi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
extern crate vst;

use vst::api;
use vst::buffer::{AudioBuffer, SendEventBuffer};
use vst::plugin::{CanDo, HostCallback, Info, Plugin};
use vst::prelude::*;

plugin_main!(MyPlugin); // Important!

Expand Down
6 changes: 2 additions & 4 deletions examples/gain_effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
#[macro_use]
extern crate vst;

use vst::buffer::AudioBuffer;
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
use vst::util::AtomicFloat;

use std::sync::Arc;

use vst::prelude::*;

/// Simple Gain Effect.
/// Note that this does not use a proper scale for sound and shouldn't be used in
/// a production amplification effect! This is purely for demonstration purposes,
Expand Down
4 changes: 1 addition & 3 deletions examples/ladder_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use std::f32::consts::PI;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use vst::buffer::AudioBuffer;
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
use vst::util::AtomicFloat;
use vst::prelude::*;

// this is a 4-pole filter with resonance, which is why there's 4 states and vouts
#[derive(Clone)]
Expand Down
5 changes: 1 addition & 4 deletions examples/sine_synth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#[macro_use]
extern crate vst;

use vst::api::{Events, Supported};
use vst::buffer::AudioBuffer;
use vst::event::Event;
use vst::plugin::{CanDo, Category, HostCallback, Info, Plugin};
use vst::prelude::*;

use std::f64::consts::PI;

Expand Down
4 changes: 1 addition & 3 deletions examples/transfer_and_smooth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ extern crate vst;
use std::f32;
use std::sync::Arc;

use vst::buffer::AudioBuffer;
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
use vst::util::ParameterTransfer;
use vst::prelude::*;

const PARAMETER_COUNT: usize = 100;
const BASE_FREQUENCY: f32 = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub mod event;
pub mod host;
mod interfaces;
pub mod plugin;

pub mod prelude;
pub mod util;

use api::consts::VST_MAGIC;
Expand Down
12 changes: 12 additions & 0 deletions src/prelude.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! A collection of commonly used items for implement a Plugin

#[doc(no_inline)]
pub use api::{Events, Supported};
#[doc(no_inline)]
pub use buffer::{AudioBuffer, SendEventBuffer};
#[doc(no_inline)]
pub use event::{Event, MidiEvent};
#[doc(no_inline)]
pub use plugin::{CanDo, Category, HostCallback, Info, Plugin, PluginParameters};
#[doc(no_inline)]
pub use util::{AtomicFloat, ParameterTransfer};