run(
dev,mx,opts) ->task/fn
Run the audio writer task on the LEV event loop
Spawns (into the current lev.run) a coroutine that waits for the device to be
writable and feeds it one period of mixed audio at a time — the recommended way
to drive audio next to a frame loop. When no voices play it writes silence to
keep the stream from underrunning.
| opts field | default | description |
|---|---|---|
timeout | 0.1 | poll/cancel-check interval, seconds |
cancel | nil | a lev.cancel_token — when fired the task exits |
name | "sound_writer" | task name |
spawn | true | set false to get the loop body back as a function and drive it yourself |
Requires LEV; with spawn ~= false it must be called inside lev.run().