From 2ab53f3c5862704e24415f969b0d2be1c75b4e7a Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 23 Nov 2023 04:04:05 +0300 Subject: fixed playing of muxed streams and improved error reporting during Stream:play() * This now preserves the original traceback. --- applause.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/applause.lua b/applause.lua index 702913d..dcb283e 100644 --- a/applause.lua +++ b/applause.lua @@ -680,7 +680,7 @@ function Stream:play(first_port) local old_stepmul = collectgarbage("setstepmul", 100) local channels = self.channels - local _, err = pcall(Stream.foreach, self, function(frame) + local _, err = xpcall(self.foreach, debug.traceback, self, function(frame) -- Loop should get unrolled automatically for i = 1, channels do local sample = tonumber(frame[i]) @@ -704,7 +704,7 @@ function Stream:play(first_port) collectgarbage("setpause", old_pause) collectgarbage("setstepmul", old_stepmul) - if err then error(err, 2) end + if err then error(err, 0) end end --- Execute function for each frame generated by the stream. @@ -776,11 +776,11 @@ function Stream:jdump(opt, outfile) -- force some bulk calculations, so instead we always generate -- up to 1s of samples here. -- See also the "hotloop" optimization parameter. - local _, err = pcall(function() + local _, err = xpcall(function() for _ = 1, samplerate do tick() end - end) + end, debug.traceback) dump.off() - if err then error(err) end + if err then error(err, 0) end end --- Convert all values to Lua numbers -- cgit v1.2.3