add gate cmd
This commit is contained in:
parent
182d368363
commit
9a6caa2453
5 changed files with 33 additions and 0 deletions
|
@ -26,6 +26,7 @@ pub const CommandType = enum {
|
|||
Delay,
|
||||
Vinyl,
|
||||
RevDelay,
|
||||
Gate,
|
||||
|
||||
Noise,
|
||||
WildNoise,
|
||||
|
@ -184,6 +185,7 @@ pub const Lang = struct {
|
|||
_ = try self.keywords.put("delay", .Delay);
|
||||
_ = try self.keywords.put("vinyl", .Vinyl);
|
||||
_ = try self.keywords.put("revdelay", .RevDelay);
|
||||
_ = try self.keywords.put("gate", .Gate);
|
||||
|
||||
// custom implementations (not lv2)
|
||||
_ = try self.keywords.put("noise", .Noise);
|
||||
|
|
|
@ -20,6 +20,7 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
|
|||
.Delay => "delay",
|
||||
.Vinyl => "vinyl",
|
||||
.RevDelay => "revdelay",
|
||||
.Gate => "gate",
|
||||
|
||||
.Noise => "noise",
|
||||
.WildNoise => "wildnoise",
|
||||
|
|
|
@ -294,6 +294,11 @@ pub const Runner = struct {
|
|||
try magick.runRotate(image, deg, c_bgfill);
|
||||
}
|
||||
|
||||
fn gateCmd(self: *Runner, pos: Position, params: ParamList) !void {
|
||||
var image = try self.getImage();
|
||||
try image.runPlugin("http://hippie.lt/lv2/gate", pos, params);
|
||||
}
|
||||
|
||||
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
|
||||
var params = ParamList.init(self.allocator);
|
||||
defer params.deinit();
|
||||
|
@ -477,6 +482,17 @@ pub const Runner = struct {
|
|||
try self.rotateCmd(deg, bgfill);
|
||||
},
|
||||
|
||||
.Gate => {
|
||||
const pos = try cmd.consumePosition();
|
||||
try cmd.appendParam(¶ms, "switch");
|
||||
try cmd.appendParam(¶ms, "threshold");
|
||||
try cmd.appendParam(¶ms, "attack");
|
||||
try cmd.appendParam(¶ms, "hold");
|
||||
try cmd.appendParam(¶ms, "decay");
|
||||
try cmd.appendParam(¶ms, "gaterange");
|
||||
try self.gateCmd(pos, params);
|
||||
},
|
||||
|
||||
else => blk: {
|
||||
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
|
||||
break :blk RunError.UnknownCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue