scaffold missing module crates
This commit is contained in:
parent
725b18dc72
commit
cf29a6d26b
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-click-instrument"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_click_instrument"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct ClickInstrumentModule;
|
||||
|
||||
impl OxideModule for ClickInstrumentModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, _ports: Ports, _context: &ProcessContext) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-compressor"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_compressor"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct CompressorModule;
|
||||
|
||||
impl OxideModule for CompressorModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, ports: Ports, _context: &ProcessContext) {
|
||||
let Some(audio_in) = ports.main_audio_in else { return };
|
||||
let Some(mut audio_out) = ports.main_audio_out else { return };
|
||||
|
||||
let inp = audio_in.buffer();
|
||||
let out = audio_out.buffer_mut();
|
||||
let len = out.len().min(inp.len());
|
||||
out[..len].copy_from_slice(&inp[..len]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-eq"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_eq"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct EqModule;
|
||||
|
||||
impl OxideModule for EqModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, ports: Ports, _context: &ProcessContext) {
|
||||
let Some(audio_in) = ports.main_audio_in else { return };
|
||||
let Some(mut audio_out) = ports.main_audio_out else { return };
|
||||
|
||||
let inp = audio_in.buffer();
|
||||
let out = audio_out.buffer_mut();
|
||||
let len = out.len().min(inp.len());
|
||||
out[..len].copy_from_slice(&inp[..len]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-gain"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_gain"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct GainModule;
|
||||
|
||||
impl OxideModule for GainModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, ports: Ports, context: &ProcessContext) {
|
||||
let Some(audio_in) = ports.main_audio_in else { return };
|
||||
let Some(mut audio_out) = ports.main_audio_out else { return };
|
||||
|
||||
let gain = context.params.get("gain").copied().unwrap_or(1.0);
|
||||
let inp = audio_in.buffer();
|
||||
let out = audio_out.buffer_mut();
|
||||
let len = out.len().min(inp.len());
|
||||
for i in 0..len {
|
||||
out[i] = inp[i] * gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct InputDeviceModule;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn create_module(config: &GlobalConfig) -> *mut Box<dyn OxideModule> {
|
||||
let module = InputDeviceModule::new(config);
|
||||
let boxed_trait: Box<dyn OxideModule> = Box::new(module);
|
||||
Box::into_raw(Box::new(boxed_trait))
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn destroy_module(module_ptr: *mut Box<dyn OxideModule>) {
|
||||
if !module_ptr.is_null() {
|
||||
let _ = unsafe { Box::from_raw(module_ptr) };
|
||||
}
|
||||
}
|
||||
|
||||
impl OxideModule for InputDeviceModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, ports: Ports, context: &ProcessContext) {
|
||||
let Some(audio_in) = ports.main_audio_in else { return };
|
||||
let Some(mut audio_out) = ports.main_audio_out else { return };
|
||||
|
||||
let trim = context.params.get("trim").copied().unwrap_or(1.0);
|
||||
let inp = audio_in.buffer();
|
||||
let out = audio_out.buffer_mut();
|
||||
let len = out.len().min(inp.len());
|
||||
for i in 0..len {
|
||||
out[i] = inp[i] * trim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-metronome-midi"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_metronome_midi"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct MetronomeMidiModule;
|
||||
|
||||
impl OxideModule for MetronomeMidiModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, _ports: Ports, _context: &ProcessContext) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-midi-player"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_midi_player"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct MidiPlayerModule;
|
||||
|
||||
impl OxideModule for MidiPlayerModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, _ports: Ports, _context: &ProcessContext) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "output_device"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct OutputDeviceModule;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn create_module(config: &GlobalConfig) -> *mut Box<dyn OxideModule> {
|
||||
let module = OutputDeviceModule::new(config);
|
||||
let boxed_trait: Box<dyn OxideModule> = Box::new(module);
|
||||
Box::into_raw(Box::new(boxed_trait))
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn destroy_module(module_ptr: *mut Box<dyn OxideModule>) {
|
||||
if !module_ptr.is_null() {
|
||||
let _ = unsafe { Box::from_raw(module_ptr) };
|
||||
}
|
||||
}
|
||||
|
||||
impl OxideModule for OutputDeviceModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, ports: Ports, _context: &ProcessContext) {
|
||||
let Some(audio_in) = ports.main_audio_in else { return };
|
||||
let Some(mut audio_out) = ports.main_audio_out else { return };
|
||||
|
||||
let inp = audio_in.buffer();
|
||||
let out = audio_out.buffer_mut();
|
||||
let len = out.len().min(inp.len());
|
||||
out[..len].copy_from_slice(&inp[..len]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "oxide-phase-compressor"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "oxide_phase_compressor"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
oxforge = { path = "../../oxforge" }
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
use oxforge::mdk::*;
|
||||
|
||||
pub struct PhaseCompressorModule;
|
||||
|
||||
impl OxideModule for PhaseCompressorModule {
|
||||
fn new(_config: &GlobalConfig) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
fn process(&mut self, ports: Ports, _context: &ProcessContext) {
|
||||
let Some(audio_in) = ports.main_audio_in else { return };
|
||||
let Some(mut audio_out) = ports.main_audio_out else { return };
|
||||
|
||||
let inp = audio_in.buffer();
|
||||
let out = audio_out.buffer_mut();
|
||||
let len = out.len().min(inp.len());
|
||||
out[..len].copy_from_slice(&inp[..len]);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue