From fdbed55b80be762a4c026a46ad5febadd1cbc24d Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 7 Jul 2019 16:05:10 -0300 Subject: [PATCH] fix output ports not using out_buf --- src/main.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.zig b/src/main.zig index 36f87ef..fc61a2c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -461,7 +461,7 @@ pub fn main() !void { lilv_instance_connect_port(self.instance, p, &in_buf[i]); i += 1; } else { - lilv_instance_connect_port(self.instance, p, &in_buf[o]); + lilv_instance_connect_port(self.instance, p, &out_buf[o]); o += 1; } } else { @@ -472,11 +472,9 @@ pub fn main() !void { // Ports are now connected to buffers in interleaved format, so we can run // a single frame at a time and avoid having to interleave buffers to // read/write from/to sndfile. - std.debug.warn("almost there!\n"); - lilv_instance_activate(self.instance); - const START = 2 * 44100; + const START = 10 * 44100; // for the first START frames, copy from in to out i = 0; @@ -491,6 +489,7 @@ pub fn main() !void { while (sread(self.in_file, in_fmt.channels, in_buf)) { lilv_instance_run(self.instance, 1); + if (c.sf_writef_float(self.out_file, out_buf.ptr, 1) != 1) { std.debug.warn("failed to write to output file\n"); return;