add vinyl cmd
This commit is contained in:
parent
f07c989407
commit
8d3cd47665
4 changed files with 23 additions and 1 deletions
|
@ -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
3
examples/vinyl.scri
Normal file
|
@ -0,0 +1,3 @@
|
|||
load :0;
|
||||
vinyl 3 1 1990 33 0 0 0;
|
||||
quicksave;
|
|
@ -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 {
|
||||
|
|
|
@ -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(¶ms, "year");
|
||||
try cmd.appendParam(¶ms, "rpm");
|
||||
try cmd.appendParam(¶ms, "warp");
|
||||
try cmd.appendParam(¶ms, "click");
|
||||
try cmd.appendParam(¶ms, "wear");
|
||||
|
||||
try self.vinylCmd(pos, params);
|
||||
},
|
||||
|
||||
else => blk: {
|
||||
std.debug.warn("Unsupported command: {}\n", cmd.command);
|
||||
break :blk RunError.UnknownCommand;
|
||||
|
|
Loading…
Reference in a new issue