add foverdrive cmd
- lang: remove oldGetCommand
This commit is contained in:
parent
fa8740e0db
commit
c73b7440a6
5 changed files with 26 additions and 65 deletions
65
src/lang.zig
65
src/lang.zig
|
@ -34,6 +34,7 @@ pub const CommandType = enum {
|
|||
TalkBox,
|
||||
DynComp,
|
||||
ThruZero,
|
||||
Foverdrive,
|
||||
|
||||
Noise,
|
||||
WildNoise,
|
||||
|
@ -197,6 +198,7 @@ pub const Lang = struct {
|
|||
_ = try self.keywords.put("overdrive", .Overdrive);
|
||||
_ = try self.keywords.put("talkbox", .TalkBox);
|
||||
_ = try self.keywords.put("thruzero", .ThruZero);
|
||||
_ = try self.keywords.put("foverdrive", .Foverdrive);
|
||||
|
||||
// custom implementations (not lv2)
|
||||
_ = try self.keywords.put("noise", .Noise);
|
||||
|
@ -221,69 +223,6 @@ pub const Lang = struct {
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE this is fallback since std.AutoHashMap does not follow
|
||||
// pointers anymore (in master).
|
||||
fn oldGetCommand(self: *Lang, stmt: []const u8) ?CommandType {
|
||||
const commands = [_][]const u8{
|
||||
"noop",
|
||||
"load",
|
||||
"quicksave",
|
||||
"runqs",
|
||||
"amp",
|
||||
"rflanger",
|
||||
"eq",
|
||||
"phaser",
|
||||
"mbeq",
|
||||
"chorus",
|
||||
"pitchscaler",
|
||||
"reverb",
|
||||
"highpass",
|
||||
"delay",
|
||||
"vinyl",
|
||||
"revdelay",
|
||||
"noise",
|
||||
"wildnoise",
|
||||
"write",
|
||||
"embed",
|
||||
"rotate",
|
||||
};
|
||||
|
||||
const command_types = [_]CommandType{
|
||||
.Noop,
|
||||
.Load,
|
||||
.Quicksave,
|
||||
.RunQS,
|
||||
|
||||
.Amp,
|
||||
.RFlanger,
|
||||
.Eq,
|
||||
.Phaser,
|
||||
.Mbeq,
|
||||
.Chorus,
|
||||
.PitchScaler,
|
||||
.Reverb,
|
||||
.Highpass,
|
||||
.Delay,
|
||||
.Vinyl,
|
||||
.RevDelay,
|
||||
|
||||
.Noise,
|
||||
.WildNoise,
|
||||
.Write,
|
||||
.Embed,
|
||||
|
||||
.Rotate,
|
||||
};
|
||||
|
||||
std.debug.assert(commands.len == command_types.len);
|
||||
|
||||
for (commands) |command, idx| {
|
||||
if (std.mem.eql(u8, stmt, command)) return command_types[idx];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
fn expectAny(self: *Lang, count: usize, args: ArgList) !void {
|
||||
if (args.len != count) {
|
||||
self.doError("expected {} arguments, found {}", .{ count, args.len });
|
||||
|
|
|
@ -28,6 +28,7 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
|
|||
.TalkBox => "talkbox",
|
||||
.DynComp => "dyncomp",
|
||||
.ThruZero => "thruzero",
|
||||
.Foverdrive => "foverdrive",
|
||||
|
||||
.Noise => "noise",
|
||||
.WildNoise => "wildnoise",
|
||||
|
|
|
@ -329,6 +329,11 @@ pub const Runner = struct {
|
|||
try image.runPlugin("http://gareus.org/oss/lv2/darc#mono", pos, params);
|
||||
}
|
||||
|
||||
fn foverdriveCmd(self: *Runner, pos: Position, params: ParamList) !void {
|
||||
var image = try self.getImage();
|
||||
try image.runPlugin("http://plugin.org.uk/swh-plugins/foverdrive", pos, params);
|
||||
}
|
||||
|
||||
fn thruZeroCmd(self: *Runner, pos: Position, params: ParamList) !void {
|
||||
var image = try self.getImage();
|
||||
try image.runPlugin("http://drobilla.net/plugins/mda/ThruZero", pos, params);
|
||||
|
@ -601,6 +606,12 @@ pub const Runner = struct {
|
|||
try self.thruZeroCmd(pos, params);
|
||||
},
|
||||
|
||||
.Foverdrive => {
|
||||
const pos = try cmd.consumePosition();
|
||||
try cmd.appendParam(¶ms, "drive");
|
||||
try self.foverdriveCmd(pos, params);
|
||||
},
|
||||
|
||||
else => blk: {
|
||||
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
|
||||
break :blk RunError.UnknownCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue