add vinyl cmd

This commit is contained in:
Luna 2019-07-13 16:46:26 -03:00
parent f07c989407
commit 8d3cd47665
4 changed files with 23 additions and 1 deletions

View File

@ -118,7 +118,7 @@ Parameters:
- `gain_scale`: Amplitude change, 0.2..5, default 1
- `wet`: Dry/wet mix, 0..1, default 1
## TODO `vynil split index year warp click wear`
## TODO `vinyl split index year warp click wear`
VyNil effect from SWH.

3
examples/vinyl.scri Normal file
View File

@ -0,0 +1,3 @@
load :0;
vinyl 3 1 1990 33 0 0 0;
quicksave;

View File

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

View File

@ -235,6 +235,11 @@ pub const Runner = struct {
try image.runPlugin("http://plugin.org.uk/swh-plugins/delayorama", pos, params);
}
fn vinylCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/vynil", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -350,6 +355,18 @@ pub const Runner = struct {
try self.delayCmd(pos, params);
},
.Vinyl => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "year");
try cmd.appendParam(&params, "rpm");
try cmd.appendParam(&params, "warp");
try cmd.appendParam(&params, "click");
try cmd.appendParam(&params, "wear");
try self.vinylCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand;