add pitchscaler cmd

This commit is contained in:
Luna 2019-07-10 17:31:18 -03:00
parent f9898b2f11
commit ab9eaa1400
4 changed files with 25 additions and 10 deletions

View file

@ -19,6 +19,7 @@ pub const CommandType = enum {
Phaser,
Mbeq,
Chorus,
PitchScaler,
};
pub const Command = struct {
@ -126,6 +127,7 @@ pub const Lang = struct {
_ = try self.keywords.put("mbeq", .Mbeq);
_ = try self.keywords.put("phaser", .Phaser);
_ = try self.keywords.put("chorus", .Chorus);
_ = try self.keywords.put("pitchscaler", .PitchScaler);
}
pub fn parse(self: *Lang, data: []const u8) !CommandList {

View file

@ -173,11 +173,7 @@ pub const Runner = struct {
try image.runPlugin("http://plugin.org.uk/swh-plugins/lfoPhaser", position, params);
}
fn mbeqCmd(
self: *Runner,
position: Position,
bands: []const f32,
) !void {
fn mbeqCmd(self: *Runner, position: Position, bands: []const f32) !void {
var image = try self.getImage();
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -193,15 +189,16 @@ pub const Runner = struct {
try image.runPlugin("http://plugin.org.uk/swh-plugins/mbeq", position, params);
}
fn chorusCmd(
self: *Runner,
pos: Position,
params: ParamList,
) !void {
fn chorusCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/multivoiceChorus", pos, params);
}
fn pitchScalerCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/pitchScaleHQ", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator);
defer params.deinit();
@ -267,6 +264,12 @@ pub const Runner = struct {
try self.chorusCmd(pos, params);
},
.PitchScaler => blk: {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "mult", 2);
try self.pitchScalerCmd(pos, params);
},
else => blk: {
std.debug.warn("Unsupported command: {}\n", cmd.command);
break :blk RunError.UnknownCommand;