pub trait Plugin {
// Required methods
fn new() -> Self
where Self: Sized;
fn process(&mut self, channels: &mut [&mut [f32]]);
}Expand description
Trait for Sesh audio plugins.
Implement this trait on your plugin struct, then pass the type to sesh_plugin!.
§Example
use sesh_sdk::{sesh_plugin, Plugin, Scratch};
struct MyPlugin {
scratch: Scratch,
}
impl Plugin for MyPlugin {
fn new() -> Self {
Self { scratch: Scratch::new() }
}
fn process(&mut self, channels: &mut [&mut [f32]]) {
let frames = channels[0].len();
let tmp = self.scratch.buf(frames);
for ch in channels.iter_mut() {
for sample in ch.iter_mut() {
*sample *= 0.5;
}
}
}
}
sesh_plugin!(MyPlugin);