fix output ports not using out_buf

This commit is contained in:
Luna 2019-07-07 16:05:10 -03:00
parent f222c5e34f
commit fdbed55b80

View file

@ -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;