Use comptime for fully declarative LV2 and Custom commands #14

Merged
luna merged 69 commits from declarative-commands into master 2020-06-02 21:37:47 +00:00
Showing only changes of commit 0453f37305 - Show all commits

View file

@ -175,18 +175,19 @@ pub const Runner = struct {
try image.saveTo(out_path);
}
fn runQSCmd(self: *Runner, program: []const u8) !void {
fn runQSCmd(self: *Runner, cmd: lang.Command) !void {
const runqs = cmd.cast(lang.Command.RunQS).?;
var image = try self.getImage();
const out_path = try self.makeGlitchedPath();
try image.saveTo(out_path);
var proc = try std.ChildProcess.init(
&[_][]const u8{ program, out_path },
&[_][]const u8{ runqs.program, out_path },
self.allocator,
);
defer proc.deinit();
std.debug.warn("running '{} {}'\n", .{ program, out_path });
std.debug.warn("running '{} {}'\n", .{ runqs.program, out_path });
_ = try proc.spawnAndWait();
}
@ -249,12 +250,14 @@ pub const Runner = struct {
fn runCommand(self: *@This(), cmd: lang.Command) !void {
switch (cmd.tag) {
.noop => {},
.load => {
const command = cmd.cast(lang.Command.Load).?;
try self.loadCmd(command.path);
},
.quicksave => try self.quicksaveCmd(),
.rotate => try self.rotateCmd(cmd),
.runqs => try self.runQSCmd(cmd),
.amp => try self.runSingleCommand(cmd, .amp),
.rflanger => try self.runSingleCommand(cmd, .rflanger),