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 8ce844ceed - Show all commits

View file

@ -362,9 +362,14 @@ pub const Command = struct {
t4d: f32, t4d: f32,
t4a_db: f32, t4a_db: f32,
}); });
pub const Moddelay = LV2Command(.moddelay, "http://plugin.org.uk/swh-plugins/modDelay", struct {
pub const Moddelay = LV2Command(
.moddelay,
"http://plugin.org.uk/swh-plugins/modDelay",
struct {
base: f32, base: f32,
}); },
);
pub const Multichorus = LV2Command(.multichorus, "http://calf.sourceforge.net/plugins/MultiChorus", struct { pub const Multichorus = LV2Command(.multichorus, "http://calf.sourceforge.net/plugins/MultiChorus", struct {
min_delay: f32, min_delay: f32,
@ -471,8 +476,20 @@ pub const Lang = struct {
// arguments... // arguments...
if (is_lv2_command) { if (is_lv2_command) {
cmd.split = try std.fmt.parseInt(usize, tok_it.next().?, 10); const split = tok_it.next();
cmd.index = try std.fmt.parseInt(usize, tok_it.next().?, 10); if (split == null) {
self.doError("Expected split parameter, got EOL", .{});
return;
}
const index = tok_it.next();
if (index == null) {
self.doError("Expected index parameter, got EOL", .{});
return;
}
cmd.split = try std.fmt.parseInt(usize, split.?, 10);
cmd.index = try std.fmt.parseInt(usize, index.?, 10);
inline for (@typeInfo(@TypeOf(cmd.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().?;