Commit 97a14a63 authored by Aske Simon Christensen's avatar Aske Simon Christensen
Browse files

Changed vst2 dependency to rust-vst crate

parent e139e659
......@@ -4,7 +4,7 @@ version = "2.1.0"
authors = ["Aske Simon Christensen <blueberry@loonies.dk>"]
[dependencies]
vst2 = { git = "https://github.com/askeksa/rust-vst2", branch = "string_success" }
vst2 = { git = "https://github.com/rust-dsp/rust-vst" }
[lib]
name = "OidosReverb"
......
......@@ -238,7 +238,7 @@ impl Plugin for OidosReverbPlugin {
}.to_string()
}
fn process(&mut self, buffer: AudioBuffer<f32>) {
fn process(&mut self, buffer: &mut AudioBuffer<f32>) {
let (inputs, mut outputs) = buffer.split();
let size = inputs[0].len();
......
......@@ -5,7 +5,7 @@ authors = ["Aske Simon Christensen <blueberry@loonies.dk>"]
build = "build.rs"
[dependencies]
vst2 = { git = "https://github.com/askeksa/rust-vst2", branch = "string_success" }
vst2 = { git = "https://github.com/rust-dsp/rust-vst" }
rand = "0.3"
[build-dependencies]
......
......@@ -3,9 +3,9 @@ use std::collections::{HashMap, VecDeque};
use std::marker::PhantomData;
use std::sync::RwLock;
use vst2::api::Supported;
use vst2::api::{Events, Supported};
use vst2::buffer::AudioBuffer;
use vst2::event::Event;
use vst2::event::{Event, MidiEvent};
use vst2::host::Host;
use vst2::plugin::{CanDo, Category, HostCallback, Info, Plugin};
......@@ -37,7 +37,7 @@ impl MidiCommand {
}
}
pub struct MidiEvent {
pub struct TimedMidiCommand {
time: usize,
command: MidiCommand,
}
......@@ -124,7 +124,7 @@ pub struct SynthPlugin<G: SoundGenerator, S: SynthInfo> {
sample_rate: f32,
time: usize,
notes: Vec<Note>,
events: VecDeque<MidiEvent>,
events: VecDeque<TimedMidiCommand>,
cache: RwLock<Vec<SoundCache<G>>>,
sound_params: G::Parameters,
......@@ -205,11 +205,11 @@ impl<G: SoundGenerator, S: SynthInfo> Plugin for SynthPlugin<G, S> {
}
}
fn process_events(&mut self, events: Vec<Event>) {
for e in events.iter() {
match *e {
Event::Midi { delta_frames, ref data, .. } => {
self.events.push_back(MidiEvent {
fn process_events(&mut self, events: &Events) {
for e in events.events() {
match e {
Event::Midi(MidiEvent { delta_frames, ref data, .. }) => {
self.events.push_back(TimedMidiCommand {
time: self.time + (delta_frames as usize),
command: MidiCommand::fromData(data)
});
......@@ -219,7 +219,7 @@ impl<G: SoundGenerator, S: SynthInfo> Plugin for SynthPlugin<G, S> {
}
}
fn process(&mut self, buffer: AudioBuffer<f32>) {
fn process(&mut self, buffer: &mut AudioBuffer<f32>) {
let mut outputs = buffer.split().1;
for i in 0..outputs[0].len() {
while !self.events.is_empty() && self.events.front().unwrap().time == self.time {
......@@ -273,7 +273,7 @@ impl<G: SoundGenerator, S: SynthInfo> Plugin for SynthPlugin<G, S> {
}
impl<G: SoundGenerator, S: SynthInfo> SynthPlugin<G, S> {
fn handle_event(&mut self, event: MidiEvent) {
fn handle_event(&mut self, event: TimedMidiCommand) {
let param_map: &HashMap<&'static str, f32> = &self.param_map.read().unwrap();
match event.command {
MidiCommand::NoteOn { key, velocity, .. } => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment