dctortion

main
annieversary 2022-12-17 01:22:34 +01:00
parent ed97aa806c
commit 3cce56550e
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,12 @@
[package]
name = "dctortion"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]
baseplug = { git = "https://github.com/wrl/baseplug.git", rev = "9cec68f31cca9c0c7a1448379f75d92bbbc782a8" }
serde = "1.0.126"
utils = { path = "../utils" }

View File

@ -0,0 +1,51 @@
#![allow(incomplete_features)]
#![feature(generic_associated_types)]
use baseplug::{Plugin, ProcessContext};
use serde::{Deserialize, Serialize};
baseplug::model! {
#[derive(Debug, Serialize, Deserialize)]
struct GainModel {
#[model(min = 0.0, max = 1.0)]
#[parameter(name = "offset")]
offset: f32,
}
}
impl Default for GainModel {
fn default() -> Self {
Self { offset: 0.0 }
}
}
struct Gain;
impl Plugin for Gain {
const NAME: &'static str = "dctortion";
const PRODUCT: &'static str = "dctortion";
const VENDOR: &'static str = "unnieversal";
const INPUT_CHANNELS: usize = 2;
const OUTPUT_CHANNELS: usize = 2;
type Model = GainModel;
#[inline]
fn new(_sample_rate: f32, _model: &GainModel) -> Self {
Self
}
#[inline]
fn process(&mut self, model: &GainModelProcess, ctx: &mut ProcessContext<Self>) {
let input = &ctx.inputs[0].buffers;
let output = &mut ctx.outputs[0].buffers;
for i in 0..ctx.nframes {
output[0][i] = input[0][i] + model.offset[i];
output[1][i] = input[1][i] - model.offset[i];
}
}
}
baseplug::vst2!(Gain, b"tAnE");