Use comptime for fully declarative LV2 and Custom commands #14
1 changed files with 6 additions and 3 deletions
|
@ -175,18 +175,19 @@ pub const Runner = struct {
|
||||||
try image.saveTo(out_path);
|
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();
|
var image = try self.getImage();
|
||||||
const out_path = try self.makeGlitchedPath();
|
const out_path = try self.makeGlitchedPath();
|
||||||
try image.saveTo(out_path);
|
try image.saveTo(out_path);
|
||||||
|
|
||||||
var proc = try std.ChildProcess.init(
|
var proc = try std.ChildProcess.init(
|
||||||
&[_][]const u8{ program, out_path },
|
&[_][]const u8{ runqs.program, out_path },
|
||||||
self.allocator,
|
self.allocator,
|
||||||
);
|
);
|
||||||
defer proc.deinit();
|
defer proc.deinit();
|
||||||
|
|
||||||
std.debug.warn("running '{} {}'\n", .{ program, out_path });
|
std.debug.warn("running '{} {}'\n", .{ runqs.program, out_path });
|
||||||
_ = try proc.spawnAndWait();
|
_ = try proc.spawnAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,12 +250,14 @@ pub const Runner = struct {
|
||||||
|
|
||||||
fn runCommand(self: *@This(), cmd: lang.Command) !void {
|
fn runCommand(self: *@This(), cmd: lang.Command) !void {
|
||||||
switch (cmd.tag) {
|
switch (cmd.tag) {
|
||||||
|
.noop => {},
|
||||||
.load => {
|
.load => {
|
||||||
const command = cmd.cast(lang.Command.Load).?;
|
const command = cmd.cast(lang.Command.Load).?;
|
||||||
try self.loadCmd(command.path);
|
try self.loadCmd(command.path);
|
||||||
},
|
},
|
||||||
.quicksave => try self.quicksaveCmd(),
|
.quicksave => try self.quicksaveCmd(),
|
||||||
.rotate => try self.rotateCmd(cmd),
|
.rotate => try self.rotateCmd(cmd),
|
||||||
|
.runqs => try self.runQSCmd(cmd),
|
||||||
|
|
||||||
.amp => try self.runSingleCommand(cmd, .amp),
|
.amp => try self.runSingleCommand(cmd, .amp),
|
||||||
.rflanger => try self.runSingleCommand(cmd, .rflanger),
|
.rflanger => try self.runSingleCommand(cmd, .rflanger),
|
||||||
|
|
Loading…
Reference in a new issue