add saturator, vintagedelay cmd

This commit is contained in:
Luna 2020-01-26 14:50:50 -03:00
parent bc8ab98689
commit 08d9923e75
6 changed files with 114 additions and 0 deletions

View file

@ -40,6 +40,8 @@ pub const CommandType = enum {
TapeDelay,
ModDelay,
MultiChorus,
Saturator,
VintageDelay,
Noise,
WildNoise,
@ -209,6 +211,8 @@ pub const Lang = struct {
_ = try self.keywords.put("tapedelay", .TapeDelay);
_ = try self.keywords.put("moddelay", .ModDelay);
_ = try self.keywords.put("multichorus", .MultiChorus);
_ = try self.keywords.put("saturator", .Saturator);
_ = try self.keywords.put("vintagedelay", .VintageDelay);
// custom implementations (not lv2)
_ = try self.keywords.put("noise", .Noise);

View file

@ -34,6 +34,8 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
.TapeDelay => "tapedelay",
.ModDelay => "moddelay",
.MultiChorus => "multichorus",
.Saturator => "saturator",
.VintageDelay => "vintagedelay",
.Noise => "noise",
.WildNoise => "wildnoise",

View file

@ -364,6 +364,16 @@ pub const Runner = struct {
try image.runPlugin("http://calf.sourceforge.net/plugins/MultiChorus", pos, params);
}
fn saturatorCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://calf.sourceforge.net/plugins/Saturator", pos, params);
}
fn vintagedelayCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://calf.sourceforge.net/plugins/VintageDelay", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -700,6 +710,58 @@ pub const Runner = struct {
try self.multichorusCmd(pos, params);
},
.Saturator => {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "bypass");
try cmd.appendParam(&params, "level_in");
try cmd.appendParam(&params, "level_out");
try cmd.appendParam(&params, "mix");
try cmd.appendParam(&params, "drive");
try cmd.appendParam(&params, "blend");
try cmd.appendParam(&params, "lp_pre_freq");
try cmd.appendParam(&params, "hp_pre_freq");
try cmd.appendParam(&params, "lp_post_freq");
try cmd.appendParam(&params, "hp_post_freq");
try cmd.appendParam(&params, "p_freq");
try cmd.appendParam(&params, "p_level");
try cmd.appendParam(&params, "p_q");
try cmd.appendParam(&params, "pre");
try cmd.appendParam(&params, "post");
try self.saturatorCmd(pos, params);
},
.VintageDelay => {
const pos = try cmd.consumePosition();
const PARAMS = [_][]const u8{
"level_in",
"level_out",
"subdiv",
"time_l",
"time_r",
"feedback",
"amount",
"mix_mode",
"medium",
"dry",
"width",
"fragmentation",
"pbeats",
"pfrag",
"timing",
"bpm",
"ms",
"hz",
"bpm_host",
};
inline for (PARAMS) |param| {
try cmd.appendParam(&params, param);
}
try self.vintagedelayCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
break :blk RunError.UnknownCommand;