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

@ -129,6 +129,15 @@ Parameters:
- `click`: Crackle, 0..1, default 0
- `wear`: Wear, 0..1, default 0
## `revdelay split index delay_time dry_level wet_level feedback xfade_samp`
Parameters:
- `delay_time`: Delay time (s), 0..5, default 0
- `dry_level`: Dry Level (dB), -70..0, default 0
- `wet_level`: Wet Level (dB), -70..0, default 0,
- `feedback`: Feedback, 0..1, default 0
- `xfade_samp`: Crossfade samples (int), 0..5000, default 1250
## TODO `echo split index delay`
Run an echo filter on the given loaded file.

3
examples/revdelay.scri Normal file
View File

@ -0,0 +1,3 @@
load :0;
revdelay 3 1 0 0 0 0 1250;
quicksave;

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;