Compare commits

..

No commits in common. "c0269ead20d38d4ebedb5f22d9ef6a63e82b762b" and "4aa9e9d7b99a4d74f3e7b65a21dd04db17bc2dcf" have entirely different histories.

2 changed files with 7 additions and 16 deletions

View file

@ -5,11 +5,11 @@ const custom = @import("custom.zig");
const plugins = @import("plugin.zig");
/// Approximate size of the BMP header, in bytes.
/// Approximate size of the BMP header.
pub const BMPHeaderSize: usize = 82000;
/// Buffer size for main image copying.
pub const BufferSize: usize = 300000;
/// Buffer size for main copying
pub const BufferSize: usize = 60000;
pub const ImageError = error{
OpenFail,
@ -176,7 +176,6 @@ pub const Image = struct {
return n_read == 1;
}
/// Copy bytes from the current file to out_file.
fn copyBytes(
self: *Image,
out_file: *c.SNDFILE,

View file

@ -95,8 +95,6 @@ pub const RunContext = struct {
plugin: *const c.LilvPlugin,
) !RunContext {
var instance = c.lilv_plugin_instantiate(plugin, f64(44100), null);
errdefer c.lilv_instance_free(instance);
if (instance == null) {
return ImageError.InstantiateFail;
}
@ -141,17 +139,13 @@ pub const RunContext = struct {
pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Context {
const cstr_plugin_uri = try std.cstr.addNullByte(allocator, plugin_uri);
var world: *c.LilvWorld = c.lilv_world_new().?;
errdefer c.lilv_world_free(world);
var world = c.lilv_world_new().?;
c.lilv_world_load_all(world);
var uri: *c.LilvNode = c.lilv_new_uri(world, cstr_plugin_uri.ptr) orelse blk: {
std.debug.warn("Invalid plugin URI <{}>\n", plugin_uri);
return ImageError.InvalidPlugin;
};
defer c.lilv_node_free(uri);
const plugins: *const c.LilvPlugins = c.lilv_world_get_all_plugins(world);
@ -160,9 +154,7 @@ pub fn makeContext(allocator: *std.mem.Allocator, plugin_uri: []const u8) !Conte
return ImageError.UnknownPlugin;
};
return Context{
.allocator = allocator,
.world = world,
.plugin = plugin,
};
c.lilv_node_free(uri);
return Context{ .allocator = allocator, .world = world, .plugin = plugin };
}