Check and Windows preview / check (anvil) (push) Successful in 2m41s
Check and Windows preview / check (crucible) (push) Successful in 2m7s
Check and Windows preview / check (patina) (push) Successful in 2m5s
Check and Windows preview / check (rivet) (push) Successful in 1m33s
Check and Windows preview / previews (push) Successful in 1m10s
Check and Windows preview / windows (push) Successful in 2m2s
Independent plugin release / publish (push) Successful in 8s
Independent plugin release / plan (push) Successful in 7s
Independent plugin release / build (push) Successful in 3m3s
Two new CLAP effects aimed at riddim and dubstep production, plus shared crates so all four plugins keep one look and reuse DSP. Anvil 0.1.0 (io.storyboard.sub-anchor): - Replaces the band below Split with a clean mono sine. Every note gets the same peak level and restarts at the same phase, so switch-ups keep their weight and kick hits line up. - Pitch and note starts come from the audio (YIN, 80 ms lookahead reported to the host) or from MIDI notes sent to the effect. - Dynamics, Drive, Octave, Glide, Phase, Gate and Keep; Solo sub monitor, note readout, level meters and a low-band oscilloscope. Crucible 0.1.0 (io.storyboard.resampler): - Records its input continuously in a lock-free ring with host transport markers. Capture takes the newest 1-16 complete bars on the bar grid, following tempo changes, or the newest audio when stopped. - Grid (straight and triplet) or transient slicing, manual cuts, slice audition without audio-thread allocation. - Export writes the loop, trimmed, declicked and normalised slices named and tagged with their root note, and an optional 2048-sample wavetable for Serum and Vital. Shared: - common-ui holds the palette, fonts, knobs and panels taken from Patina; Patina renders identically. Rotary knobs at their minimum no longer tessellate a zero-length arc into NaN vertices. - common-dsp holds biquads, a Linkwitz-Riley crossover, YIN, note helpers and a float WAV writer with sampler root and Serum frame chunks. - Catalog, CI matrix, release tags, editor previews and docs cover both plugins; a script test keeps the catalog and workflows in step.
201 lines
6.9 KiB
Rust
201 lines
6.9 KiB
Rust
//! CLAP audio effect. Audio passes through unchanged; the input is recorded continuously.
|
|
use crucible_core::{Player, Queues, Recorder, Ring, Settings, Transport, HISTORY};
|
|
use nih_plug::prelude::*;
|
|
use nih_plug_egui::{create_egui_editor, egui, EguiState};
|
|
use std::sync::{Arc, Mutex, RwLock};
|
|
|
|
#[derive(Params)]
|
|
pub struct CrucibleParams {
|
|
#[persist = "editor"]
|
|
pub editor: Arc<EguiState>,
|
|
#[persist = "crucible-settings"]
|
|
pub settings: RwLock<Settings>,
|
|
#[id = "bypass"]
|
|
pub bypass: BoolParam,
|
|
}
|
|
impl Default for CrucibleParams {
|
|
fn default() -> Self {
|
|
Self {
|
|
editor: EguiState::from_size(crucible_ui::WIDTH, crucible_ui::HEIGHT),
|
|
settings: RwLock::new(Settings::default()),
|
|
bypass: BoolParam::new("Bypass", false).make_bypass(),
|
|
}
|
|
}
|
|
}
|
|
|
|
struct Shared {
|
|
/// Replaced on activation; the editor clones the Arc briefly, never the audio thread.
|
|
ring: Mutex<Option<Arc<Ring>>>,
|
|
queues: Arc<Queues>,
|
|
}
|
|
pub struct Crucible {
|
|
params: Arc<CrucibleParams>,
|
|
shared: Arc<Shared>,
|
|
ring: Option<Arc<Ring>>,
|
|
recorder: Recorder,
|
|
player: Player,
|
|
}
|
|
impl Default for Crucible {
|
|
fn default() -> Self {
|
|
Self {
|
|
params: Arc::new(CrucibleParams::default()),
|
|
shared: Arc::new(Shared {
|
|
ring: Mutex::new(None),
|
|
queues: Arc::new(Queues::default()),
|
|
}),
|
|
ring: None,
|
|
recorder: Recorder::new(),
|
|
player: Player::default(),
|
|
}
|
|
}
|
|
}
|
|
impl Plugin for Crucible {
|
|
const NAME: &'static str = "Crucible";
|
|
const VENDOR: &'static str = "Rivet & Patina";
|
|
const URL: &'static str = "";
|
|
const EMAIL: &'static str = "";
|
|
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
|
const AUDIO_IO_LAYOUTS: &'static [AudioIOLayout] = &[
|
|
AudioIOLayout {
|
|
main_input_channels: NonZeroU32::new(2),
|
|
main_output_channels: NonZeroU32::new(2),
|
|
..AudioIOLayout::const_default()
|
|
},
|
|
AudioIOLayout {
|
|
main_input_channels: NonZeroU32::new(1),
|
|
main_output_channels: NonZeroU32::new(1),
|
|
..AudioIOLayout::const_default()
|
|
},
|
|
];
|
|
const SAMPLE_ACCURATE_AUTOMATION: bool = false;
|
|
type SysExMessage = ();
|
|
type BackgroundTask = ();
|
|
fn params(&self) -> Arc<dyn Params> {
|
|
self.params.clone()
|
|
}
|
|
fn editor(&mut self, _: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
|
let params = self.params.clone();
|
|
let shared = self.shared.clone();
|
|
create_egui_editor(
|
|
params.editor.clone(),
|
|
crucible_ui::State::default(),
|
|
|ctx, _| crucible_ui::style(ctx),
|
|
move |ctx, _setter, state| {
|
|
let link = crucible_ui::Link {
|
|
ring: shared.ring.lock().ok().and_then(|r| r.clone()),
|
|
queues: shared.queues.clone(),
|
|
};
|
|
let mut settings = params
|
|
.settings
|
|
.read()
|
|
.map(|s| s.clone())
|
|
.unwrap_or_default();
|
|
let before = settings.clone();
|
|
nih_plug_egui::resizable_window::ResizableWindow::new("crucible-editor")
|
|
.min_size(egui::vec2(
|
|
crucible_ui::WIDTH as f32 - 80.,
|
|
crucible_ui::HEIGHT as f32 - 40.,
|
|
))
|
|
.show(ctx, ¶ms.editor, |ui| {
|
|
crucible_ui::show(ui, &mut settings, state, &link)
|
|
});
|
|
if settings != before {
|
|
if let Ok(mut s) = params.settings.write() {
|
|
*s = settings;
|
|
}
|
|
}
|
|
// Meters and the transport readout follow the audio.
|
|
ctx.request_repaint_after(std::time::Duration::from_millis(50));
|
|
},
|
|
)
|
|
}
|
|
fn initialize(
|
|
&mut self,
|
|
_: &AudioIOLayout,
|
|
config: &BufferConfig,
|
|
_: &mut impl InitContext<Self>,
|
|
) -> bool {
|
|
if let Ok(mut s) = self.params.settings.write() {
|
|
s.sanitize();
|
|
}
|
|
let ring = Arc::new(Ring::new(config.sample_rate, HISTORY));
|
|
self.ring = Some(ring.clone());
|
|
self.recorder = Recorder::new();
|
|
self.player = Player::default();
|
|
if let Ok(mut slot) = self.shared.ring.lock() {
|
|
*slot = Some(ring);
|
|
}
|
|
true
|
|
}
|
|
fn reset(&mut self) {
|
|
self.player = Player::default();
|
|
}
|
|
fn process(
|
|
&mut self,
|
|
buffer: &mut Buffer,
|
|
_: &mut AuxiliaryBuffers,
|
|
context: &mut impl ProcessContext<Self>,
|
|
) -> ProcessStatus {
|
|
let Some(ring) = self.ring.as_deref() else {
|
|
return ProcessStatus::Normal;
|
|
};
|
|
let bypass = self.params.bypass.value();
|
|
let t = context.transport();
|
|
let transport = match (t.tempo, t.pos_beats()) {
|
|
(Some(tempo), Some(beats)) => Some(Transport {
|
|
playing: t.playing,
|
|
tempo,
|
|
beats,
|
|
numerator: t.time_sig_numerator.unwrap_or(4).clamp(1, 64) as u32,
|
|
denominator: t.time_sig_denominator.unwrap_or(4).clamp(1, 64) as u32,
|
|
}),
|
|
_ => None,
|
|
};
|
|
if !bypass {
|
|
self.recorder.block(ring, transport);
|
|
}
|
|
self.player.block(&self.shared.queues);
|
|
let channels = buffer.channels();
|
|
for mut sample in buffer.iter_samples() {
|
|
let left = *sample.get_mut(0).unwrap();
|
|
let right = if channels > 1 {
|
|
*sample.get_mut(1).unwrap()
|
|
} else {
|
|
left
|
|
};
|
|
if bypass {
|
|
continue;
|
|
}
|
|
self.recorder.push(ring, [left, right]);
|
|
// Auditioned slices are added to the output, never recorded.
|
|
let a = self.player.next(&self.shared.queues);
|
|
if self.player.playing() || a != [0.; 2] {
|
|
*sample.get_mut(0).unwrap() += if channels > 1 {
|
|
a[0]
|
|
} else {
|
|
0.5 * (a[0] + a[1])
|
|
};
|
|
if channels > 1 {
|
|
*sample.get_mut(1).unwrap() += a[1];
|
|
}
|
|
}
|
|
}
|
|
self.recorder.publish(ring);
|
|
ProcessStatus::Normal
|
|
}
|
|
}
|
|
impl ClapPlugin for Crucible {
|
|
const CLAP_ID: &'static str = "io.storyboard.resampler";
|
|
const CLAP_DESCRIPTION: Option<&'static str> =
|
|
Some("Capture the last bars, slice them and export clean, key-labelled samples");
|
|
const CLAP_MANUAL_URL: Option<&'static str> = None;
|
|
const CLAP_SUPPORT_URL: Option<&'static str> = None;
|
|
const CLAP_FEATURES: &'static [ClapFeature] = &[
|
|
ClapFeature::AudioEffect,
|
|
ClapFeature::Utility,
|
|
ClapFeature::Stereo,
|
|
ClapFeature::Mono,
|
|
];
|
|
}
|
|
nih_export_clap!(Crucible);
|