Use comptime for fully declarative LV2 and Custom commands #14
1 changed files with 5 additions and 18 deletions
|
@ -239,13 +239,6 @@ pub const Runner = struct {
|
||||||
) !void {
|
) !void {
|
||||||
comptime const typ = lang.Command.tagToType(tag);
|
comptime const typ = lang.Command.tagToType(tag);
|
||||||
const command = cmd.cast(typ).?;
|
const command = cmd.cast(typ).?;
|
||||||
inline for (@typeInfo(typ).Struct.decls) |decl| {
|
|
||||||
comptime {
|
|
||||||
if (!std.mem.eql(u8, decl.name, "command_type")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ctype = typ.command_type;
|
const ctype = typ.command_type;
|
||||||
switch (ctype) {
|
switch (ctype) {
|
||||||
.lv2_command => try self.executeLV2Command(command.*),
|
.lv2_command => try self.executeLV2Command(command.*),
|
||||||
|
@ -253,7 +246,6 @@ pub const Runner = struct {
|
||||||
else => @panic("TODO support command type"),
|
else => @panic("TODO support command type"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn runCommand(self: *@This(), cmd: lang.Command) !void {
|
fn runCommand(self: *@This(), cmd: lang.Command) !void {
|
||||||
switch (cmd.tag) {
|
switch (cmd.tag) {
|
||||||
|
@ -297,11 +289,6 @@ pub const Runner = struct {
|
||||||
.wildnoise => try self.runSingleCommand(cmd, .wildnoise),
|
.wildnoise => try self.runSingleCommand(cmd, .wildnoise),
|
||||||
.write => try self.runSingleCommand(cmd, .write),
|
.write => try self.runSingleCommand(cmd, .write),
|
||||||
.embed => try self.runSingleCommand(cmd, .embed),
|
.embed => try self.runSingleCommand(cmd, .embed),
|
||||||
|
|
||||||
else => {
|
|
||||||
std.debug.warn("TODO support {}\n", .{@tagName(cmd.tag)});
|
|
||||||
@panic("TODO support tag");
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Run a list of commands.
|
/// Run a list of commands.
|
||||||
|
|
Loading…
Reference in a new issue