lua.wetgenes.gamecake.fun.bitsynth_task
local bitsynth_task=require("wetgenes.gamecake.fun.bitsynth_task")
Manages synth rendering in a subtask, possibly multiple subtasks, so as not to block the main thread when generating synth sounds.
lua.wetgenes.gamecake.fun.bitsynth_task.code
lanes task function for handling bitsynth rendering.
lua.wetgenes.gamecake.fun.bitsynth_task.render
local f=bitsynth_task.render(tasks,ot)
-- busy check for result , dont do this :)
repeat
local dat,err=f()
if dat then -- we loaded it
-- use sound here
else
if err then error(err) end -- caught an error
end
until dat
returns a function that will peek for a return msg and return data (s16 sound data string) on success.
on error it will return nil,error so need to check the second return if you want to handle errors.
after a successful result then subsequent calls will return nil,"done" indicating that the task has already completed.