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

@ -245,3 +245,16 @@ other presets:
- dry: 0..1, default 0
- carrier: 0..1, default 0
- quality: 0..1, default 1
## `dyncomp split index enable hold inputgain threshold ratio attack release gain_min gain_max rms`
- enable (bool): 0..1, default 1
- hold (bool): 0..1, default 0
- inputgain (dB): -10..30, default 0
- threshold (dB): -50..-10, default -30
- ratio (???): 0..1, default 0
- attack (seconds): 0.001..0.1, default 0.01
- release (seconds): 0.03..3.0, default 0.3
- gain\_min (dB): -20..40
- gain\_max (dB): -20..40
- rms (signal level, dB): -80..10

View File

@ -1,5 +1,8 @@
load :0;
degrade 5 1 0.8 0.5 0.65 0.9 0.58 0.5;
degrade 5 2 0.1 1 0.65 0.5 0.5 0.4;
degrade 5 3 0.1 1 0.65 0.9 0.58 0.5;
degrade 8 1 0.8 0.5 0.65 0.9 0.58 0.5;
degrade 8 2 0.1 1 0.65 0.5 0.5 0.4;
degrade 8 3 0.1 1 0.65 0.9 0.58 0.5;
degrade 8 4 0 1 1 0 0 1;
degrade 8 5 0 1 1 0 0 0;
degrade 8 6 0 0 0 0 0 0;
quicksave;

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;