add phaser cmd
This commit is contained in:
parent
20aeedeef2
commit
6bc54f8e46
4 changed files with 49 additions and 0 deletions
|
@ -16,6 +16,7 @@ pub const CommandType = enum {
|
|||
Amp,
|
||||
RFlanger,
|
||||
Eq,
|
||||
Phaser,
|
||||
};
|
||||
|
||||
pub const Command = struct {
|
||||
|
@ -85,6 +86,7 @@ pub const Lang = struct {
|
|||
_ = try self.keywords.put("amp", .Amp);
|
||||
_ = try self.keywords.put("rflanger", .RFlanger);
|
||||
_ = try self.keywords.put("eq", .Eq);
|
||||
_ = try self.keywords.put("phaser", .Phaser);
|
||||
}
|
||||
|
||||
pub fn parse(self: *Lang, data: []const u8) !CommandList {
|
||||
|
|
|
@ -211,6 +211,26 @@ pub const Runner = struct {
|
|||
try image.runPlugin("http://plugin.org.uk/swh-plugins/dj_eq_mono", position, params);
|
||||
}
|
||||
|
||||
fn phaserCmd(
|
||||
self: *Runner,
|
||||
position: plugin.Position,
|
||||
lfo_rate: f32,
|
||||
lfo_depth: f32,
|
||||
fb: f32,
|
||||
spread: f32,
|
||||
) !void {
|
||||
var image = try self.getImage();
|
||||
var params = plugin.ParamList.init(self.allocator);
|
||||
defer params.deinit();
|
||||
|
||||
try appendParam(¶ms, "lfo_rate", lfo_rate);
|
||||
try appendParam(¶ms, "lfo_depth", lfo_depth);
|
||||
try appendParam(¶ms, "fb", fb);
|
||||
try appendParam(¶ms, "spread", spread);
|
||||
|
||||
try image.runPlugin("http://plugin.org.uk/swh-plugins/lfoPhaser", position, params);
|
||||
}
|
||||
|
||||
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
|
||||
return switch (cmd.command) {
|
||||
.Noop => {},
|
||||
|
@ -247,6 +267,17 @@ pub const Runner = struct {
|
|||
try self.eqCmd(pos, lo, mid, high);
|
||||
},
|
||||
|
||||
.Phaser => blk: {
|
||||
const pos = try cmd.consumePosition();
|
||||
|
||||
const lfo_rate = try cmd.floatArgAt(2);
|
||||
const lfo_depth = try cmd.floatArgAt(3);
|
||||
const fb = try cmd.floatArgAt(4);
|
||||
const spread = try cmd.floatArgAt(5);
|
||||
|
||||
try self.phaserCmd(pos, lfo_rate, lfo_depth, fb, spread);
|
||||
},
|
||||
|
||||
else => blk: {
|
||||
std.debug.warn("Unknown command: {}\n", cmd.command);
|
||||
break :blk RunError.UnknownCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue