add delay cmd

This commit is contained in:
Luna 2019-07-11 10:20:09 -03:00
parent 79dc56daae
commit b9160adad2
4 changed files with 44 additions and 3 deletions

View file

@ -23,6 +23,7 @@ pub const CommandType = enum {
PitchScaler,
Reverb,
Highpass,
Delay,
};
pub const Command = struct {
@ -137,6 +138,7 @@ pub const Lang = struct {
_ = try self.keywords.put("pitchscaler", .PitchScaler);
_ = try self.keywords.put("reverb", .Reverb);
_ = try self.keywords.put("highpass", .Highpass);
_ = try self.keywords.put("delay", .Delay);
}
pub fn parse(self: *Lang, data: []const u8) !CommandList {

View file

@ -230,6 +230,11 @@ pub const Runner = struct {
try image.runPlugin("http://invadarecords.com/plugins/lv2/filter/hpf/mono", pos, params);
}
fn delayCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/delayorama", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -328,6 +333,23 @@ pub const Runner = struct {
try self.highpassCmd(pos, params);
},
.Delay => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "seed");
try cmd.appendParam(&params, "gain");
try cmd.appendParam(&params, "feedback_pc");
try cmd.appendParam(&params, "tap_count");
try cmd.appendParam(&params, "first_delay");
try cmd.appendParam(&params, "delay_range");
try cmd.appendParam(&params, "delay_scale");
try cmd.appendParam(&params, "delay_rand_pc");
try cmd.appendParam(&params, "gain_scale");
try cmd.appendParam(&params, "wet");
try self.delayCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand;