Use comptime for fully declarative LV2 and Custom commands #14
1 changed files with 0 additions and 63 deletions
|
@ -307,69 +307,6 @@ pub const Runner = struct {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn runCommand(self: *Runner, cmd: *lang.Command) !void {
|
|
||||||
var params = ParamList.init(self.allocator);
|
|
||||||
defer params.deinit();
|
|
||||||
|
|
||||||
var map = ParamMap.init(self.allocator);
|
|
||||||
defer map.deinit();
|
|
||||||
|
|
||||||
return switch (cmd.command) {
|
|
||||||
.Noop => {},
|
|
||||||
.Load => blk: {
|
|
||||||
var path = cmd.args.items[0];
|
|
||||||
try self.loadCmd(path);
|
|
||||||
|
|
||||||
// TODO is this needed?
|
|
||||||
break :blk;
|
|
||||||
},
|
|
||||||
.Quicksave => try self.quicksaveCmd(),
|
|
||||||
.RunQS => try self.runQSCmd(cmd.args.items[0]),
|
|
||||||
|
|
||||||
.Noise => blk: {
|
|
||||||
const pos = try cmd.consumePosition();
|
|
||||||
|
|
||||||
try cmd.appendParamMap(&map, "seed");
|
|
||||||
try cmd.appendParamMap(&map, "fill_bytes");
|
|
||||||
|
|
||||||
try self.noiseCmd(pos, &map);
|
|
||||||
},
|
|
||||||
|
|
||||||
.WildNoise => blk: {
|
|
||||||
const pos = try cmd.consumePosition();
|
|
||||||
|
|
||||||
try cmd.appendParamMap(&map, "seed");
|
|
||||||
try cmd.appendParamMap(&map, "fill_bytes");
|
|
||||||
|
|
||||||
try self.wildNoiseCmd(pos, &map);
|
|
||||||
},
|
|
||||||
|
|
||||||
.Write => blk: {
|
|
||||||
const pos = try cmd.consumePosition();
|
|
||||||
try cmd.appendParamMap(&map, "data");
|
|
||||||
try self.writeCmd(pos, &map);
|
|
||||||
},
|
|
||||||
|
|
||||||
.Embed => blk: {
|
|
||||||
const pos = try cmd.consumePosition();
|
|
||||||
const path = cmd.args.items[2];
|
|
||||||
try self.embedCmd(pos, path);
|
|
||||||
},
|
|
||||||
|
|
||||||
.Rotate => blk: {
|
|
||||||
const deg = try cmd.floatArgAt(0);
|
|
||||||
const bgfill = try cmd.argAt(1);
|
|
||||||
try self.rotateCmd(deg, bgfill);
|
|
||||||
},
|
|
||||||
|
|
||||||
else => blk: {
|
|
||||||
std.debug.warn("Unsupported command: {}\n", .{cmd.command});
|
|
||||||
break :blk RunError.UnknownCommand;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Run a list of commands.
|
/// Run a list of commands.
|
||||||
pub fn runCommands(
|
pub fn runCommands(
|
||||||
self: *Runner,
|
self: *Runner,
|
||||||
|
|
Loading…
Reference in a new issue