fix: resolve compilation errors in plugin and engine code
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
32
src/lib.rs
32
src/lib.rs
@@ -1,14 +1,14 @@
|
||||
use nih_plug::prelude::*;
|
||||
|
||||
mod engine;
|
||||
use engine::{Engine, ClipState};
|
||||
use engine::Engine;
|
||||
|
||||
/// The main plugin struct
|
||||
pub struct ClipLauncher {
|
||||
/// The engine managing clips
|
||||
engine: Engine,
|
||||
/// Pending MIDI output events
|
||||
pending_midi: Vec<NoteEvent>,
|
||||
pending_midi: Vec<NoteEvent<f32>>,
|
||||
}
|
||||
|
||||
impl Default for ClipLauncher {
|
||||
@@ -50,7 +50,7 @@ impl Plugin for ClipLauncher {
|
||||
_context: &mut impl InitContext<Self>,
|
||||
) -> bool {
|
||||
self.engine = Engine::new(
|
||||
_audio_io_layout.main_input_channels.map(|c| c.get()).unwrap_or(2),
|
||||
_audio_io_layout.main_input_channels.map(|c| c.get() as usize).unwrap_or(2),
|
||||
buffer_config.sample_rate,
|
||||
);
|
||||
true
|
||||
@@ -71,23 +71,25 @@ impl Plugin for ClipLauncher {
|
||||
// Process MIDI input events
|
||||
while let Some(event) = context.next_event() {
|
||||
match event {
|
||||
NoteEvent::NoteOn { timing, note, velocity, channel } => {
|
||||
let output_velocity = self.engine.process_midi_note(note, velocity, true);
|
||||
NoteEvent::NoteOn { timing, note, velocity, channel, voice_id } => {
|
||||
let output_velocity = self.engine.process_midi_note(note, velocity as u8, true);
|
||||
// Queue output MIDI event
|
||||
self.pending_midi.push(NoteEvent::NoteOn {
|
||||
timing,
|
||||
note,
|
||||
velocity: output_velocity,
|
||||
velocity: output_velocity as f32,
|
||||
channel,
|
||||
voice_id,
|
||||
});
|
||||
}
|
||||
NoteEvent::NoteOff { timing, note, velocity, channel } => {
|
||||
let output_velocity = self.engine.process_midi_note(note, velocity, false);
|
||||
NoteEvent::NoteOff { timing, note, velocity, channel, voice_id } => {
|
||||
let output_velocity = self.engine.process_midi_note(note, velocity as u8, false);
|
||||
self.pending_midi.push(NoteEvent::NoteOff {
|
||||
timing,
|
||||
note,
|
||||
velocity: output_velocity,
|
||||
velocity: output_velocity as f32,
|
||||
channel,
|
||||
voice_id,
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
@@ -96,7 +98,7 @@ impl Plugin for ClipLauncher {
|
||||
|
||||
// Process audio
|
||||
for channel_samples in buffer.iter_samples() {
|
||||
let (input, mut output) = channel_samples;
|
||||
let (input, mut output) = channel_samples.split();
|
||||
let num_samples = input.len();
|
||||
|
||||
// Process this block
|
||||
@@ -118,11 +120,17 @@ impl Plugin for ClipLauncher {
|
||||
|
||||
/// Empty params struct (no parameters needed for this plugin)
|
||||
#[derive(Params)]
|
||||
struct ClipLauncherParams;
|
||||
struct ClipLauncherParams {
|
||||
/// Placeholder parameter to satisfy the derive macro
|
||||
#[id = "dummy"]
|
||||
dummy: BoolParam,
|
||||
}
|
||||
|
||||
impl Default for ClipLauncherParams {
|
||||
fn default() -> Self {
|
||||
Self
|
||||
Self {
|
||||
dummy: BoolParam::new("Dummy", false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user