From c7436815153ff55fe5039ce5429ccecb0243a255 Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 10 Jul 2019 20:41:17 -0300 Subject: [PATCH] add highpass cmd - remove bypass arg from reverb cmd --- doc/README.md | 13 +++++++++++-- examples/highpass.scri | 3 +++ examples/reverb.scri | 2 +- src/lang.zig | 2 ++ src/runner.zig | 34 ++++++++++++++++++++++++---------- 5 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 examples/highpass.scri diff --git a/doc/README.md b/doc/README.md index 205d950..73b81b1 100644 --- a/doc/README.md +++ b/doc/README.md @@ -89,11 +89,20 @@ Runs the Higher Quality Pitch Scaler from the SWH plugins. The `mult` parameter is the pitch coefficient, range from 0.5..2, default 1. -## `reverb split index bypass roomLength roomHeight sourceLR sourceFB listLR listFB hpf warmth diffusion` +## `reverb split index roomLength roomHeight sourceLR sourceFB listLR listFB hpf warmth diffusion` Run the Early Reflection Reverb from the Invada Studio plugins. -**TODO** Parameters. +**TODO** Parameter list + +## `highpass split index freq gain noClip` + +Run the High Pass Filter from the Invada Studio plugins. + +Parameters: + - `freq`: Frequency. 20-20000, default 1000 + - `gain`: Gain, 0-12, default 0 + - `noClip`: Soft Clip (assumed boolean), 0-1, default 0 ## TODO `echo split index delay` diff --git a/examples/highpass.scri b/examples/highpass.scri new file mode 100644 index 0000000..3c58799 --- /dev/null +++ b/examples/highpass.scri @@ -0,0 +1,3 @@ +load :0; +highpass 3 1 1000 0 0; +quicksave; diff --git a/examples/reverb.scri b/examples/reverb.scri index 619faf9..9148bf7 100644 --- a/examples/reverb.scri +++ b/examples/reverb.scri @@ -1,3 +1,3 @@ load :0; -reverb 3 1 0 25 30 0 0.8 0 0.2 1000 50 50; +reverb 3 1 25 30 0 0.8 0 0.2 1000 50 50; quicksave; diff --git a/src/lang.zig b/src/lang.zig index 7add67f..20e0b3a 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -21,6 +21,7 @@ pub const CommandType = enum { Chorus, PitchScaler, Reverb, + Highpass, }; pub const Command = struct { @@ -130,6 +131,7 @@ pub const Lang = struct { _ = try self.keywords.put("chorus", .Chorus); _ = try self.keywords.put("pitchscaler", .PitchScaler); _ = try self.keywords.put("reverb", .Reverb); + _ = try self.keywords.put("highpass", .Highpass); } pub fn parse(self: *Lang, data: []const u8) !CommandList { diff --git a/src/runner.zig b/src/runner.zig index 92f450f..029122c 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -204,6 +204,11 @@ pub const Runner = struct { try image.runPlugin("http://invadarecords.com/plugins/lv2/erreverb/mono", pos, params); } + fn highpassCmd(self: *Runner, pos: Position, params: ParamList) !void { + var image = try self.getImage(); + try image.runPlugin("http://invadarecords.com/plugins/lv2/filter/hpf/mono", pos, params); + } + fn runCommand(self: *Runner, cmd: *lang.Command) !void { var params = ParamList.init(self.allocator); defer params.deinit(); @@ -278,20 +283,29 @@ pub const Runner = struct { .Reverb => blk: { const pos = try cmd.consumePosition(); - try cmd.appendParam(¶ms, "bypass", 2); - try cmd.appendParam(¶ms, "roomLength", 3); - try cmd.appendParam(¶ms, "roomHeight", 4); - try cmd.appendParam(¶ms, "sourceLR", 5); - try cmd.appendParam(¶ms, "sourceFB", 6); - try cmd.appendParam(¶ms, "listLR", 7); - try cmd.appendParam(¶ms, "listFB", 8); - try cmd.appendParam(¶ms, "hpf", 9); - try cmd.appendParam(¶ms, "warmth", 10); - try cmd.appendParam(¶ms, "diffusion", 11); + try cmd.appendParam(¶ms, "roomLength", 2); + try cmd.appendParam(¶ms, "roomHeight", 3); + try cmd.appendParam(¶ms, "sourceLR", 4); + try cmd.appendParam(¶ms, "sourceFB", 5); + try cmd.appendParam(¶ms, "listLR", 6); + try cmd.appendParam(¶ms, "listFB", 7); + try cmd.appendParam(¶ms, "hpf", 8); + try cmd.appendParam(¶ms, "warmth", 9); + try cmd.appendParam(¶ms, "diffusion", 10); try self.reverbCmd(pos, params); }, + .Highpass => blk: { + const pos = try cmd.consumePosition(); + + try cmd.appendParam(¶ms, "freq", 2); + try cmd.appendParam(¶ms, "gain", 3); + try cmd.appendParam(¶ms, "noClip", 4); + + try self.highpassCmd(pos, params); + }, + else => blk: { std.debug.warn("Unsupported command: {}\n", cmd.command); break :blk RunError.UnknownCommand;