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

Commit c3acb39

Browse files
Nico Chatzidoomy
Nico Chatzi
and
doomy
authored
Add prelude for commonly used items (#161)
* Add prelude Co-authored-by: doomy <[email protected]>
1 parent 0ec8865 commit c3acb39

8 files changed

+20
-21
lines changed

examples/dimension_expander.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
#[macro_use]
44
extern crate vst;
55

6-
use vst::buffer::AudioBuffer;
7-
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
8-
use vst::util::AtomicFloat;
9-
106
use std::collections::VecDeque;
117
use std::f64::consts::PI;
128
use std::sync::Arc;
139
use std::time::{SystemTime, UNIX_EPOCH};
10+
use vst::prelude::*;
1411

1512
/// Calculate the length in samples for a delay. Size ranges from 0.0 to 1.0.
1613
fn delay(index: usize, mut size: f32) -> isize {

examples/fwd_midi.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
extern crate vst;
33

44
use vst::api;
5-
use vst::buffer::{AudioBuffer, SendEventBuffer};
6-
use vst::plugin::{CanDo, HostCallback, Info, Plugin};
5+
use vst::prelude::*;
76

87
plugin_main!(MyPlugin); // Important!
98

examples/gain_effect.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
#[macro_use]
44
extern crate vst;
55

6-
use vst::buffer::AudioBuffer;
7-
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
8-
use vst::util::AtomicFloat;
9-
106
use std::sync::Arc;
117

8+
use vst::prelude::*;
9+
1210
/// Simple Gain Effect.
1311
/// Note that this does not use a proper scale for sound and shouldn't be used in
1412
/// a production amplification effect! This is purely for demonstration purposes,

examples/ladder_filter.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use std::f32::consts::PI;
1616
use std::sync::atomic::{AtomicUsize, Ordering};
1717
use std::sync::Arc;
1818

19-
use vst::buffer::AudioBuffer;
20-
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
21-
use vst::util::AtomicFloat;
19+
use vst::prelude::*;
2220

2321
// this is a 4-pole filter with resonance, which is why there's 4 states and vouts
2422
#[derive(Clone)]

examples/sine_synth.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
#[macro_use]
44
extern crate vst;
55

6-
use vst::api::{Events, Supported};
7-
use vst::buffer::AudioBuffer;
8-
use vst::event::Event;
9-
use vst::plugin::{CanDo, Category, HostCallback, Info, Plugin};
6+
use vst::prelude::*;
107

118
use std::f64::consts::PI;
129

examples/transfer_and_smooth.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ extern crate vst;
1010
use std::f32;
1111
use std::sync::Arc;
1212

13-
use vst::buffer::AudioBuffer;
14-
use vst::plugin::{Category, HostCallback, Info, Plugin, PluginParameters};
15-
use vst::util::ParameterTransfer;
13+
use vst::prelude::*;
1614

1715
const PARAMETER_COUNT: usize = 100;
1816
const BASE_FREQUENCY: f32 = 5.0;

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub mod event;
128128
pub mod host;
129129
mod interfaces;
130130
pub mod plugin;
131-
131+
pub mod prelude;
132132
pub mod util;
133133

134134
use api::consts::VST_MAGIC;

src/prelude.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! A collection of commonly used items for implement a Plugin
2+
3+
#[doc(no_inline)]
4+
pub use api::{Events, Supported};
5+
#[doc(no_inline)]
6+
pub use buffer::{AudioBuffer, SendEventBuffer};
7+
#[doc(no_inline)]
8+
pub use event::{Event, MidiEvent};
9+
#[doc(no_inline)]
10+
pub use plugin::{CanDo, Category, HostCallback, Info, Plugin, PluginParameters};
11+
#[doc(no_inline)]
12+
pub use util::{AtomicFloat, ParameterTransfer};

0 commit comments

Comments
 (0)