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
1 changed files with 22 additions and 5 deletions
Showing only changes of commit 8ce844ceed - Show all commits

View File

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