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 b5512c45fb - Show all commits

View file

@ -378,7 +378,7 @@ pub const Lang = struct {
cmd.split = try std.fmt.parseInt(usize, tok_it.next().?, 10); cmd.split = try std.fmt.parseInt(usize, tok_it.next().?, 10);
cmd.index = try std.fmt.parseInt(usize, tok_it.next().?, 10); cmd.index = try std.fmt.parseInt(usize, tok_it.next().?, 10);
inline for (@typeInfo(@typeOf(command_struct.parameters)).Struct.fields) |cmd_field| { inline for (@typeInfo(@TypeOf(cmd.parameters)).Struct.fields) |cmd_field| {
const arg = tok_it.next().?; const arg = tok_it.next().?;
const argument_value = switch (cmd_field.field_type) { const argument_value = switch (cmd_field.field_type) {
f32 => try std.fmt.parseFloat(f32, arg), f32 => try std.fmt.parseFloat(f32, arg),
@ -391,7 +391,7 @@ pub const Lang = struct {
argument_value, argument_value,
}); });
@field(cmd.params, cmd_field.name) = argument_value; @field(cmd.parameters, cmd_field.name) = argument_value;
} }
} else { } else {
inline for (@typeInfo(command_struct).Struct.fields) |cmd_field| { inline for (@typeInfo(command_struct).Struct.fields) |cmd_field| {