Module cProcessSlicer

ProcessSlicer allows you to slice up a function which takes a lot of processing time into multiple calls via Lua coroutines.

### Example usage:

local slicer = ProcessSlicer(my_process_func, argument1, argumentX)

This starts calling 'my_process_func' in idle, passing all arguments you've specified in the ProcessSlicer constructor.

slicer:start()

To abort a running sliced process, you can call "stop" at any time from within your processing function of outside of it in the main thread. As soon as your process function returns, the slicer is automatically stopped.

slicer:stop()

To give processing time back to Renoise, call 'coroutine.yield()' anywhere in your process function to temporarily yield back to Renoise:

function my_process_func() for j=1,100 do -- do something that needs a lot of time, and periodically call -- "coroutine.yield()" to give processing time back to Renoise. Renoise -- will switch back to this point of the function as soon as has done -- "its" job: coroutine.yield() end end

### Drawbacks:

By slicing your processing function, you will also slice any changes that are done to the Renoise song into multiple undo actions (one action per slice/yield).

Modal dialogs will block the slicer, cause on_idle notifications are not fired then. It will even block your own process GUI when trying to show it modal.

Functions

ProcessSlicer:running ()
ProcessSlicer:start () start a process
ProcessSlicer:stop () stop a running process
ProcessSlicer:__on_idle () function that gets called from Renoise to do idle stuff.

Fields

process_func


Functions

ProcessSlicer:running ()

Returns:

    true when the current process currently is running
ProcessSlicer:start ()
start a process
ProcessSlicer:stop ()
stop a running process
ProcessSlicer:__on_idle ()
function that gets called from Renoise to do idle stuff. switches back into the processing function or detaches the thread

Fields

process_func
  • process_func (function)
  • VarArg (...)
generated by LDoc 1.4.2