fix for latest zig

This commit is contained in:
Luna 2020-08-18 17:49:23 -03:00
parent 8aa65958d0
commit 353d8d6947
6 changed files with 17 additions and 21 deletions

View file

@ -97,7 +97,7 @@ pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 {
var tmp_file: std.fs.File = std.fs.cwd().openFile( var tmp_file: std.fs.File = std.fs.cwd().openFile(
nam, nam,
.{ .read = true, .write = false }, .{ .read = true, .write = false },
) catch |err| blk: { ) catch |err| {
if (err == error.FileNotFound) return nam else continue; if (err == error.FileNotFound) return nam else continue;
}; };
@ -321,7 +321,7 @@ pub const Image = struct {
defer self.allocator.free(sym_cstr); defer self.allocator.free(sym_cstr);
var sym = c.lilv_new_string(ctx.world, sym_cstr.ptr); var sym = c.lilv_new_string(ctx.world, sym_cstr.ptr);
const port = c.lilv_plugin_get_port_by_symbol(ctx.plugin, sym) orelse blk: { const port = c.lilv_plugin_get_port_by_symbol(ctx.plugin, sym) orelse {
std.debug.warn("assert fail: symbol {} not found on port\n", .{param.sym}); std.debug.warn("assert fail: symbol {} not found on port\n", .{param.sym});
return ImageError.InvalidSymbol; return ImageError.InvalidSymbol;
}; };

View file

@ -135,8 +135,6 @@ pub const Command = struct {
.embed => Embed, .embed => Embed,
.rotate => Rotate, .rotate => Rotate,
else => @panic("TODO"),
}; };
} }

View file

@ -81,20 +81,20 @@ pub fn setupPorts(ctx: *plugin.Context) ![]Port {
defer ctx.allocator.free(values); defer ctx.allocator.free(values);
c.lilv_plugin_get_port_ranges_float(ctx.plugin, null, null, values.ptr); c.lilv_plugin_get_port_ranges_float(ctx.plugin, null, null, values.ptr);
var lv2_InputPort = c.lilv_new_uri(world, LV2_CORE__InputPort.ptr); var lv2_InputPort = c.lilv_new_uri(world, LV2_CORE__InputPort.ptr).?;
defer std.heap.c_allocator.destroy(lv2_InputPort); //defer std.heap.c_allocator.destroy(lv2_InputPort);
var lv2_OutputPort = c.lilv_new_uri(world, LV2_CORE__OutputPort.ptr); var lv2_OutputPort = c.lilv_new_uri(world, LV2_CORE__OutputPort.ptr).?;
defer std.heap.c_allocator.destroy(lv2_OutputPort); //defer std.heap.c_allocator.destroy(lv2_OutputPort);
var lv2_AudioPort = c.lilv_new_uri(world, LV2_CORE__AudioPort.ptr); var lv2_AudioPort = c.lilv_new_uri(world, LV2_CORE__AudioPort.ptr).?;
defer std.heap.c_allocator.destroy(lv2_AudioPort); //defer std.heap.c_allocator.destroy(lv2_AudioPort);
var lv2_ControlPort = c.lilv_new_uri(world, LV2_CORE__ControlPort.ptr); var lv2_ControlPort = c.lilv_new_uri(world, LV2_CORE__ControlPort.ptr).?;
defer std.heap.c_allocator.destroy(lv2_ControlPort); //defer std.heap.c_allocator.destroy(lv2_ControlPort);
var lv2_connectionOptional = c.lilv_new_uri(world, LV2_CORE__connectionOptional.ptr); var lv2_connection_string = c.lilv_new_uri(world, LV2_CORE__connectionOptional.ptr).?;
defer std.heap.c_allocator.destroy(lv2_connectionOptional); //defer std.heap.c_allocator.destroy(lv2_connection_string);
var i: u32 = 0; var i: u32 = 0;
while (i < n_ports) : (i += 1) { while (i < n_ports) : (i += 1) {
@ -111,7 +111,7 @@ pub fn setupPorts(ctx: *plugin.Context) ![]Port {
port.value = values[i]; port.value = values[i];
} }
port.optional = c.lilv_port_has_property(ctx.plugin, lport, lv2_connectionOptional); port.optional = c.lilv_port_has_property(ctx.plugin, lport, lv2_connection_string);
if (c.lilv_port_is_a(ctx.plugin, lport, lv2_InputPort)) { if (c.lilv_port_is_a(ctx.plugin, lport, lv2_InputPort)) {
port.is_input = true; port.is_input = true;

View file

@ -104,7 +104,7 @@ pub const RunContext = struct {
switch (port.ptype) { switch (port.ptype) {
.Control => lv2.lilv_instance_connect_port(self.instance, p, &port.value), .Control => lv2.lilv_instance_connect_port(self.instance, p, &port.value),
.Audio => blk: { .Audio => {
if (port.is_input) { if (port.is_input) {
lv2.lilv_instance_connect_port( lv2.lilv_instance_connect_port(
self.instance, self.instance,
@ -121,7 +121,7 @@ pub const RunContext = struct {
o += 1; o += 1;
} }
}, },
else => lv2.lilv_instance_connect_port(self.instance, p, null), // else => lv2.lilv_instance_connect_port(self.instance, p, null),
} }
} }
} }
@ -136,7 +136,7 @@ pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Conte
c.lilv_world_load_all(world); c.lilv_world_load_all(world);
var uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse blk: { var uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse {
std.debug.warn("Invalid plugin URI <{}>\n", .{plugin_uri}); std.debug.warn("Invalid plugin URI <{}>\n", .{plugin_uri});
return ImageError.InvalidPlugin; return ImageError.InvalidPlugin;
}; };
@ -144,7 +144,7 @@ pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Conte
const plugins: *const c.LilvPlugins = c.lilv_world_get_all_plugins(world).?; const plugins: *const c.LilvPlugins = c.lilv_world_get_all_plugins(world).?;
var plugin: *const c.LilvPlugin = c.lilv_plugins_get_by_uri(plugins, uri) orelse blk: { var plugin: *const c.LilvPlugin = c.lilv_plugins_get_by_uri(plugins, uri) orelse {
std.debug.warn("Plugin <{}> not found\n", .{plugin_uri}); std.debug.warn("Plugin <{}> not found\n", .{plugin_uri});
return ImageError.UnknownPlugin; return ImageError.UnknownPlugin;
}; };

View file

@ -27,7 +27,6 @@ fn printCommand(stream: anytype, cmd: *langs.Command, comptime tag: langs.Comman
switch (ctype) { switch (ctype) {
.lv2_command => try printCommandWithParams(stream, casted), .lv2_command => try printCommandWithParams(stream, casted),
.custom_command => try printCommandWithParams(stream, casted), .custom_command => try printCommandWithParams(stream, casted),
else => @panic("TODO support command type"),
} }
} }

View file

@ -252,7 +252,6 @@ pub const Runner = struct {
switch (ctype) { switch (ctype) {
.lv2_command => try self.executeLV2Command(command.*), .lv2_command => try self.executeLV2Command(command.*),
.custom_command => try self.executeCustomCommand(command.*), .custom_command => try self.executeCustomCommand(command.*),
else => @panic("TODO support command type"),
} }
} }