add revdelay cmd

This commit is contained in:
Luna 2019-07-13 17:20:14 -03:00
parent 223fb6628c
commit aedf47dbe1
4 changed files with 31 additions and 0 deletions

View file

@ -25,6 +25,7 @@ pub const CommandType = enum {
Highpass,
Delay,
Vinyl,
RevDelay,
};
pub const Command = struct {
@ -141,6 +142,7 @@ pub const Lang = struct {
_ = try self.keywords.put("highpass", .Highpass);
_ = try self.keywords.put("delay", .Delay);
_ = try self.keywords.put("vinyl", .Vinyl);
_ = try self.keywords.put("revdelay", .RevDelay);
}
pub fn parse(self: *Lang, data: []const u8) !CommandList {

View file

@ -240,6 +240,11 @@ pub const Runner = struct {
try image.runPlugin("http://plugin.org.uk/swh-plugins/vynil", pos, params);
}
fn revDelayCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/revdelay", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -367,6 +372,18 @@ pub const Runner = struct {
try self.vinylCmd(pos, params);
},
.RevDelay => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "delay_time");
try cmd.appendParam(&params, "dry_level");
try cmd.appendParam(&params, "wet_level");
try cmd.appendParam(&params, "feedback");
try cmd.appendParam(&params, "xfade_samp");
try self.revDelayCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand;