allow any typed command to use lv2 param parse logic

This commit is contained in:
Luna 2020-05-31 22:27:38 -03:00
parent 30da41293a
commit 690ab89cfd

View file

@ -521,7 +521,7 @@ pub const Lang = struct {
var cmd = try self.allocator.create(command_struct); var cmd = try self.allocator.create(command_struct);
const is_lv2_command = switch (command_struct.base_tag) { const is_lv2_command = switch (command_struct.base_tag) {
.noop, .load, .quicksave, .runqs, .rotate => false, .noop, .load, .quicksave, .runqs, .rotate => false,
else => command_struct.command_type == .lv2_command, else => true,
}; };
// TODO: crash when no arguments are left but we still need // TODO: crash when no arguments are left but we still need
@ -543,7 +543,6 @@ pub const Lang = struct {
cmd.split = try std.fmt.parseInt(usize, split.?, 10); cmd.split = try std.fmt.parseInt(usize, split.?, 10);
cmd.index = try std.fmt.parseInt(usize, index.?, 10); cmd.index = try std.fmt.parseInt(usize, index.?, 10);
// All parameters for LV2 plugins are f32.
inline for (@typeInfo(@TypeOf(cmd.parameters)).Struct.fields) |cmd_field| { inline for (@typeInfo(@TypeOf(cmd.parameters)).Struct.fields) |cmd_field| {
const maybe_arg = tok_it.next(); const maybe_arg = tok_it.next();
if (maybe_arg == null) { if (maybe_arg == null) {