add gate cmd
This commit is contained in:
parent
182d368363
commit
9a6caa2453
5 changed files with 33 additions and 0 deletions
|
@ -178,3 +178,12 @@ with a suffix on the filename (before extension).
|
||||||
|
|
||||||
Doing consecutive `quicksave`s will not overwrite any files, the suffixes will
|
Doing consecutive `quicksave`s will not overwrite any files, the suffixes will
|
||||||
just be different.
|
just be different.
|
||||||
|
|
||||||
|
## `gate split index switch threshold attack hold decay gaterange`
|
||||||
|
|
||||||
|
- switch (bool): 0..1, default 0
|
||||||
|
- threshold (dB): -70..12, default -70
|
||||||
|
- attack (ms): 0.1..500, default 30
|
||||||
|
- hold (ms): 5..3000, default 500
|
||||||
|
- decay (ms): 5..4000, default 1000
|
||||||
|
- gaterange (dB): -90..-20, default -90
|
||||||
|
|
5
examples/gate.scri
Normal file
5
examples/gate.scri
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
load :0;
|
||||||
|
gate 5 1 0 1 100 500 1000 -50;
|
||||||
|
gate 5 2 1 1 100 500 1000 -50;
|
||||||
|
gate 5 3 1 1 150 1000 1000 -50;
|
||||||
|
quicksave;
|
|
@ -26,6 +26,7 @@ pub const CommandType = enum {
|
||||||
Delay,
|
Delay,
|
||||||
Vinyl,
|
Vinyl,
|
||||||
RevDelay,
|
RevDelay,
|
||||||
|
Gate,
|
||||||
|
|
||||||
Noise,
|
Noise,
|
||||||
WildNoise,
|
WildNoise,
|
||||||
|
@ -184,6 +185,7 @@ pub const Lang = struct {
|
||||||
_ = try self.keywords.put("delay", .Delay);
|
_ = try self.keywords.put("delay", .Delay);
|
||||||
_ = try self.keywords.put("vinyl", .Vinyl);
|
_ = try self.keywords.put("vinyl", .Vinyl);
|
||||||
_ = try self.keywords.put("revdelay", .RevDelay);
|
_ = try self.keywords.put("revdelay", .RevDelay);
|
||||||
|
_ = try self.keywords.put("gate", .Gate);
|
||||||
|
|
||||||
// custom implementations (not lv2)
|
// custom implementations (not lv2)
|
||||||
_ = try self.keywords.put("noise", .Noise);
|
_ = try self.keywords.put("noise", .Noise);
|
||||||
|
|
|
@ -20,6 +20,7 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
|
||||||
.Delay => "delay",
|
.Delay => "delay",
|
||||||
.Vinyl => "vinyl",
|
.Vinyl => "vinyl",
|
||||||
.RevDelay => "revdelay",
|
.RevDelay => "revdelay",
|
||||||
|
.Gate => "gate",
|
||||||
|
|
||||||
.Noise => "noise",
|
.Noise => "noise",
|
||||||
.WildNoise => "wildnoise",
|
.WildNoise => "wildnoise",
|
||||||
|
|
|
@ -294,6 +294,11 @@ pub const Runner = struct {
|
||||||
try magick.runRotate(image, deg, c_bgfill);
|
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 {
|
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
|
||||||
var params = ParamList.init(self.allocator);
|
var params = ParamList.init(self.allocator);
|
||||||
defer params.deinit();
|
defer params.deinit();
|
||||||
|
@ -477,6 +482,17 @@ pub const Runner = struct {
|
||||||
try self.rotateCmd(deg, bgfill);
|
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: {
|
else => blk: {
|
||||||
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
|
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
|
||||||
break :blk RunError.UnknownCommand;
|
break :blk RunError.UnknownCommand;
|
||||||
|
|
Loading…
Reference in a new issue