From 325e7b110286ebbb19d36d819109c8a06c3f8236 Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 31 May 2020 18:29:42 -0300 Subject: [PATCH] add support for the rest of lv2 commands --- src/lang.zig | 100 ++++++++++++++++++++++++++++++--- src/runner.zig | 149 +++---------------------------------------------- 2 files changed, 101 insertions(+), 148 deletions(-) diff --git a/src/lang.zig b/src/lang.zig index 6d444c9..a455a1f 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -105,13 +105,13 @@ pub const Command = struct { .dyncomp => Dyncomp, .thruzero => Thruzero, .foverdrive => Foverdrive, - // .gverb => Gverb, - // .invert => Invert, - // .tapedelay => Tapedelay, - // .moddelay => Moddelay, - // .multichorus => Multichorus, - // .saturator => Saturator, - // .vintagedelay => Vintagedelay, + .gverb => Gverb, + .invert => Invert, + .tapedelay => Tapedelay, + .moddelay => Moddelay, + .multichorus => Multichorus, + .saturator => Saturator, + .vintagedelay => Vintagedelay, else => @panic("TODO"), }; @@ -335,6 +335,92 @@ pub const Command = struct { pub const Thruzero = LV2Command(.thruzero, "http://drobilla.net/plugins/mda/ThruZero", struct { rate: f32, mix: f32, feedback: f32, depth_mod: f32 }); + + pub const Gverb = LV2Command(.gverb, "http://plugin.org.uk/swh-plugins/gverb", struct { + roomsize: f32, + revtime: f32, + damping: f32, + inputbandwidth: f32, + drylevel: f32, + earlylevel: f32, + taillevel: f32, + }); + pub const Invert = LV2Command(.invert, "http://plugin.org.uk/swh-plugins/inv", struct {}); + pub const Tapedelay = LV2Command(.tapedelay, "http://plugin.org.uk/swh-plugins/tapeDelay", struct { + speed: f32, + da_db: f32, + + t1d: f32, + t1a_db: f32, + + t2d: f32, + t2a_db: f32, + + t3d: f32, + t3a_db: f32, + + t4d: f32, + t4a_db: f32, + }); + pub const Moddelay = LV2Command(.moddelay, "http://plugin.org.uk/swh-plugins/modDelay", struct { + base: f32, + }); + + pub const Multichorus = LV2Command(.multichorus, "http://calf.sourceforge.net/plugins/MultiChorus", struct { + min_delay: f32, + mod_depth: f32, + mod_rate: f32, + stereo: f32, + voices: f32, + vphase: f32, + amount: f32, + dry: f32, + freq: f32, + freq2: f32, + q: f32, + overlap: f32, + level_in: f32, + level_out: f32, + lfo: f32, + }); + pub const Saturator = LV2Command(.saturator, "http://calf.sourceforge.net/plugins/Saturator", struct { + bypass: f32, + level_in: f32, + level_out: f32, + mix: f32, + drive: f32, + blend: f32, + lp_pre_freq: f32, + hp_pre_freq: f32, + lp_post_freq: f32, + hp_post_freq: f32, + p_freq: f32, + p_level: f32, + p_q: f32, + pre: f32, + post: f32, + }); + pub const Vintagedelay = LV2Command(.vintagedelay, "http://calf.sourceforge.net/plugins/VintageDelay", struct { + level_in: f32, + level_out: f32, + subdiv: f32, + time_l: f32, + time_r: f32, + feedback: f32, + amount: f32, + mix_mode: f32, + medium: f32, + dry: f32, + width: f32, + fragmentation: f32, + pbeats: f32, + pfrag: f32, + timing: f32, + bpm: f32, + ms: f32, + hz: f32, + bpm_host: f32, + }); }; pub const CommandList = std.ArrayList(*Command); diff --git a/src/runner.zig b/src/runner.zig index b4bf4af..7922c30 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -292,11 +292,6 @@ pub const Runner = struct { try image.runPlugin("http://plugin.org.uk/swh-plugins/gverb", pos, params); } - fn invertCmd(self: *Runner, pos: Position, params: ParamList) !void { - var image = try self.getImage(); - try image.runPlugin("http://plugin.org.uk/swh-plugins/inv", pos, params); - } - fn tapedelayCmd(self: *Runner, pos: Position, params: ParamList) !void { var image = try self.getImage(); try image.runPlugin("http://plugin.org.uk/swh-plugins/tapeDelay", pos, params); @@ -397,13 +392,13 @@ pub const Runner = struct { .dyncomp => try self.newRunCommandSingle(cmd, .dyncomp), .thruzero => try self.newRunCommandSingle(cmd, .thruzero), .foverdrive => try self.newRunCommandSingle(cmd, .foverdrive), - // .gverb => try self.newRunCommandSingle(cmd, .gverb), - // .invert => try self.newRunCommandSingle(cmd, .invert), - // .tapedelay => try self.newRunCommandSingle(cmd, .tapedelay), - // .moddelay => try self.newRunCommandSingle(cmd, .moddelay), - // .multichorus => try self.newRunCommandSingle(cmd, .multichorus), - // .saturator => try self.newRunCommandSingle(cmd, .saturator), - // .vintagedelay => try self.newRunCommandSingle(cmd, .vintagedelay), + .gverb => try self.newRunCommandSingle(cmd, .gverb), + .invert => try self.newRunCommandSingle(cmd, .invert), + .tapedelay => try self.newRunCommandSingle(cmd, .tapedelay), + .moddelay => try self.newRunCommandSingle(cmd, .moddelay), + .multichorus => try self.newRunCommandSingle(cmd, .multichorus), + .saturator => try self.newRunCommandSingle(cmd, .saturator), + .vintagedelay => try self.newRunCommandSingle(cmd, .vintagedelay), else => { std.debug.warn("TODO support {}\n", .{@tagName(cmd.tag)}); @@ -467,67 +462,8 @@ pub const Runner = struct { try self.rotateCmd(deg, bgfill); }, - .Gate => { - const pos = try cmd.consumePosition(); - try self.gateCmd(pos, params); - }, - - .Detune => { - const pos = try cmd.consumePosition(); - try self.detuneCmd(pos, params); - }, - - .Overdrive => { - const pos = try cmd.consumePosition(); - try self.overdriveCmd(pos, params); - }, - - .Degrade => { - const pos = try cmd.consumePosition(); - try self.degradeCmd(pos, params); - }, - - .RePsycho => { - const pos = try cmd.consumePosition(); - try self.repsychoCmd(pos, params); - }, - - .TalkBox => { - const pos = try cmd.consumePosition(); - - try self.talkboxCmd(pos, params); - }, - - .DynComp => { - const pos = try cmd.consumePosition(); - - try self.dynCompCmd(pos, params); - }, - - .ThruZero => { - const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "rate"); - try cmd.appendParam(¶ms, "mix"); - try cmd.appendParam(¶ms, "feedback"); - try cmd.appendParam(¶ms, "depth_mod"); - try self.thruZeroCmd(pos, params); - }, - - .Foverdrive => { - const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "drive"); - try self.foverdriveCmd(pos, params); - }, - .Gverb => { const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "roomsize"); - try cmd.appendParam(¶ms, "revtime"); - try cmd.appendParam(¶ms, "damping"); - try cmd.appendParam(¶ms, "inputbandwidth"); - try cmd.appendParam(¶ms, "drylevel"); - try cmd.appendParam(¶ms, "earlylevel"); - try cmd.appendParam(¶ms, "taillevel"); try self.gverbCmd(pos, params); }, @@ -538,20 +474,6 @@ pub const Runner = struct { .TapeDelay => { const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "speed"); - try cmd.appendParam(¶ms, "da_db"); - - try cmd.appendParam(¶ms, "t1d"); - try cmd.appendParam(¶ms, "t1a_db"); - - try cmd.appendParam(¶ms, "t2d"); - try cmd.appendParam(¶ms, "t2a_db"); - - try cmd.appendParam(¶ms, "t3d"); - try cmd.appendParam(¶ms, "t3a_db"); - - try cmd.appendParam(¶ms, "t4d"); - try cmd.appendParam(¶ms, "t4a_db"); try self.tapedelayCmd(pos, params); }, @@ -564,73 +486,18 @@ pub const Runner = struct { .MultiChorus => { const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "min_delay"); - try cmd.appendParam(¶ms, "mod_depth"); - try cmd.appendParam(¶ms, "mod_rate"); - try cmd.appendParam(¶ms, "stereo"); - try cmd.appendParam(¶ms, "voices"); - try cmd.appendParam(¶ms, "vphase"); - try cmd.appendParam(¶ms, "amount"); - try cmd.appendParam(¶ms, "dry"); - try cmd.appendParam(¶ms, "freq"); - try cmd.appendParam(¶ms, "freq2"); - try cmd.appendParam(¶ms, "q"); - try cmd.appendParam(¶ms, "overlap"); - try cmd.appendParam(¶ms, "level_in"); - try cmd.appendParam(¶ms, "level_out"); - try cmd.appendParam(¶ms, "lfo"); + try self.multichorusCmd(pos, params); }, .Saturator => { const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "bypass"); - try cmd.appendParam(¶ms, "level_in"); - try cmd.appendParam(¶ms, "level_out"); - try cmd.appendParam(¶ms, "mix"); - try cmd.appendParam(¶ms, "drive"); - try cmd.appendParam(¶ms, "blend"); - try cmd.appendParam(¶ms, "lp_pre_freq"); - try cmd.appendParam(¶ms, "hp_pre_freq"); - try cmd.appendParam(¶ms, "lp_post_freq"); - try cmd.appendParam(¶ms, "hp_post_freq"); - try cmd.appendParam(¶ms, "p_freq"); - try cmd.appendParam(¶ms, "p_level"); - try cmd.appendParam(¶ms, "p_q"); - try cmd.appendParam(¶ms, "pre"); - try cmd.appendParam(¶ms, "post"); try self.saturatorCmd(pos, params); }, .VintageDelay => { const pos = try cmd.consumePosition(); - const PARAMS = [_][]const u8{ - "level_in", - "level_out", - "subdiv", - "time_l", - "time_r", - "feedback", - "amount", - "mix_mode", - "medium", - "dry", - "width", - "fragmentation", - "pbeats", - "pfrag", - "timing", - "bpm", - "ms", - "hz", - "bpm_host", - }; - - inline for (PARAMS) |param| { - try cmd.appendParam(¶ms, param); - } - try self.vintagedelayCmd(pos, params); },