![]() |
uvi-script
Musical event scripting with Lua
|
Classes | |
| class | AsyncTask |
| An Asyncronous task. More... | |
| class | AsyncBrowseForFileTask |
| An Asyncronous task that browses for a file on disk. More... | |
| class | AsyncMidiFileLoadTask |
| An Asyncronous task that load a MIDI file. More... | |
Functions | |
| function | browseForFile (mode, title, initialFileOrDirectory, filePatterns, callback) |
| launch a file chooser to select a file to open or save | |
| function | loadSample (oscillator, path, callback) |
| load a sample inside the oscillator | |
| function | setPlaybackOptions (oscillator, start, end_, loopType, loopStart, loopEnd, playForward, callback) |
| set playback options inside the oscillator | |
| function | loadState (path, callback) |
| load state to file. | |
| function | saveState (path, callback) |
| save state from file. | |
| function | loadData (path, callback) |
| load data from file. | |
| function | saveTextData (data, path, callback) |
| save string to file. | |
| function | loadTextData (path, callback) |
| load string from file. | |
| function | saveData (data, path, callback) |
| save data to file. | |
| function | loadMidi (path, callback) |
| load a midi file asynchronously | |
| function | createMidiFile (maxNumTracks, maxNumEvents, callback) |
| create a midi file asynchronously | |
| function | saveMidi (midifile, path, callback) |
| save a midi file asynchronously | |
| function | loadImpulse (reverb, path, callback) |
| load and impulse response inside the reverb. | |
| function | purge (target, callback) |
| purge an/several element(s)/oscillator(s) from its/their content in order to release memory. | |
| function | unpurge (target, callback) |
| unpurge an/several element(s)/oscillator(s) content in order to load their memory. | |
Asynchronous operations for non-blocking file I/O and long-running tasks.
Async operations run on background threads to avoid blocking the real-time audio thread. They return AsyncTask objects that can be polled for completion or accept callbacks for notification when the operation finishes.
Available Operations:
Task Management:
Usage Patterns:
| function browseForFile | ( | mode | , |
| title | , | ||
| initialFileOrDirectory | , | ||
| filePatterns | , | ||
| callback | ) |
launch a file chooser to select a file to open or save
| mode | file browsing mode ("open" or "save") |
| title | a text string to display in the dialog box to tell the user what's going on |
| initialFileOrDirectory | the file or directory that should be selected when the dialog box opens. If left empty the default location is OS-dependent |
| filePatterns | a set of file patterns to specify which files can be selected - each pattern should be separated by a comma or semi-colon, e.g. "*" or "*.jpg;*.gif". An empty string means that all files are allowed |
| callback | callback function that will be called upon completion of the asynchronous task |
Example:
| function createMidiFile | ( | maxNumTracks | , |
| maxNumEvents | , | ||
| callback | ) |
create a midi file asynchronously
| maxNumTracks | |
| maxNumEvents | |
| callback | callback function that will be called upon completion of the asynchronous task |
| function loadData | ( | path | , |
| callback | ) |
| function loadImpulse | ( | reverb | , |
| path | , | ||
| callback | ) |
load and impulse response inside the reverb.
| reverb | |
| path | path to impulse response file |
| callback | callback function that will be called upon completion of the asynchronous task |
Example:
| function loadMidi | ( | path | , |
| callback | ) |
load a midi file asynchronously
| path | path to midi file |
| callback | callback function that will be called upon completion of the asynchronous task |
| function loadSample | ( | oscillator | , |
| path | , | ||
| callback | ) |
load a sample inside the oscillator
| oscillator | |
| path | path to sample file |
| callback | callback function that will be called upon completion of the asynchronous task |
Example:
| function loadState | ( | path | , |
| callback | ) |
load state to file.
| path | path to file |
| callback | callback function that will be called upon completion of the asynchronous task |
| function loadTextData | ( | path | , |
| callback | ) |
load string from file.
| path | path to file |
| callback | callback function that will be called upon completion of the asynchronous task |
Example:
| function purge | ( | target | , |
| callback | ) |
purge an/several element(s)/oscillator(s) from its/their content in order to release memory.
A purge command is sent and executed asynchronously to avoid blocking the script execution. One can specify either a single Element or an array of Elements to purge. Elements that contain other Elements are purged recursively. One can also specify and optional callback to be called upon completion of the asynchronous operation.
| target | it can be either a single oscillator, and Element or a Table of Elements |
| callback | callback function that will be called upon completion of the asynchronous task |
Examples: a) asynchronous callback
b) polling
| function saveData | ( | data | , |
| path | , | ||
| callback | ) |
save data to file.
the data is encoded using JSON, supported types are boolean, numbers, arrays and dicts lua tables can be both arrays and dicts at the same time, this case cannot be converted and is thus unsupported, the result is undefined is undefined. Lua tables that are saved should be either arrays or dicts. Nested tables are supported but circular references are not. Any other lua datatype that cannot be mapped to JSON will be ignored:
| data | data to save |
| path | path to file |
| callback | callback function that will be called upon completion of the asynchronous task |
| function saveMidi | ( | midifile | , |
| path | , | ||
| callback | ) |
save a midi file asynchronously
| midifile | midi sequence object |
| path | path where the midi file should be saved |
| callback | callback function that will be called upon completion of the asynchronous task |
| function saveState | ( | path | , |
| callback | ) |
save state from file.
| path | path to file |
| callback | callback function that will be called upon completion of the asynchronous task |
| function saveTextData | ( | data | , |
| path | , | ||
| callback | ) |
save string to file.
| data | string to save |
| path | path to file |
| callback | callback function that will be called upon completion of the asynchronous task |
| function setPlaybackOptions | ( | oscillator | , |
| start | , | ||
| end_ | , | ||
| loopType | , | ||
| loopStart | , | ||
| loopEnd | , | ||
| playForward | , | ||
| callback | ) |
set playback options inside the oscillator
| oscillator | the oscillator element to modify |
| start | sample start position in samples |
| end | sample end position in samples |
| loopType | loop mode: 0 = None, 1 = Forward, 2 = Alternate, 3 = OneShot |
| loopStart | loop start position in samples |
| loopEnd | loop end position in samples |
| playForward | true to play forward, false to play in reverse |
| callback | callback function that will be called upon completion of the asynchronous task |
Example:
| function unpurge | ( | target | , |
| callback | ) |
unpurge an/several element(s)/oscillator(s) content in order to load their memory.
An unpurge command is sent and executed asynchronously to avoid blocking the script execution. One can specify either a single Element or an array of Elements to load. Elements that contain other Elements are unpurged recursively. One can also specify and optional callback to be called upon completion of the asynchronous operation.
| target | it can be either a single oscillator, and Element or a Table of Elements |
| callback | callback function that will be called upon completion of the asynchronous task |
Examples: a) asynchronous callback
b) polling