add dyncomp cmd

This commit is contained in:
Luna 2020-01-25 22:45:37 -03:00
parent 7dae50b030
commit 5a0e6934e7
5 changed files with 43 additions and 3 deletions

View file

@ -32,6 +32,7 @@ pub const CommandType = enum {
Degrade,
RePsycho,
TalkBox,
DynComp,
Noise,
WildNoise,
@ -202,6 +203,7 @@ pub const Lang = struct {
_ = try self.keywords.put("embed", .Embed);
_ = try self.keywords.put("degrade", .Degrade);
_ = try self.keywords.put("repsycho", .RePsycho);
_ = try self.keywords.put("dyncomp", .RePsycho);
// even more custom
_ = try self.keywords.put("rotate", .Rotate);

View file

@ -26,6 +26,7 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
.Degrade => "Degrade",
.RePsycho => "repsycho",
.TalkBox => "talkbox",
.DynComp => "dyncomp",
.Noise => "noise",
.WildNoise => "wildnoise",

View file

@ -324,6 +324,11 @@ pub const Runner = struct {
try image.runPlugin("http://drobilla.net/plugins/mda/TalkBox", pos, params);
}
fn dynCompCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://gareus.org/oss/lv2/darc#mono", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -566,6 +571,22 @@ pub const Runner = struct {
try cmd.appendParam(&params, "quality");
try self.talkboxCmd(pos, params);
},
.DynComp => {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "enable");
try cmd.appendParam(&params, "hold");
try cmd.appendParam(&params, "inputgain");
try cmd.appendParam(&params, "threshold");
try cmd.appendParam(&params, "ratio");
try cmd.appendParam(&params, "attack");
try cmd.appendParam(&params, "release");
try cmd.appendParam(&params, "gain_min");
try cmd.appendParam(&params, "gain_max");
try cmd.appendParam(&params, "rms");
try self.dynCompCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
break :blk RunError.UnknownCommand;