Asynchronous operations. More...
Classes | |
class | AsyncBrowseForFileTask |
An Asyncronous task that browses for a file on disk. More... | |
class | AsyncMidiFileLoadTask |
An Asyncronous task that load a MIDI file. More... | |
class | AsyncTask |
An Asyncronous task. More... | |
Functions | |
function | browseForFile (mode, title, initialFileOrDirectory, filePatterns, callback) |
launch a file chooser to select a file to open or save More... | |
function | createMidiFile (maxNumTracks, maxNumEvents, callback) |
create a midi file asynchronously More... | |
function | loadData (path, callback) |
load data from file. More... | |
function | loadImpulse (reverb, path, callback) |
load and impulse response inside the reverb. More... | |
function | loadMidi (path, callback) |
load a midi file asynchronously More... | |
function | loadSample (oscillator, path, callback) |
load a sample inside the oscillator More... | |
function | loadState (path, callback) |
load state to file. More... | |
function | loadTextData (path, callback) |
load string from file. More... | |
function | purge (target, callback) |
purge an/several element(s)/oscillator(s) from its/their content in order to release memory. More... | |
function | saveData (data, path, callback) |
save data to file. More... | |
function | saveMidi (midifile, path, callback) |
save a midi file asynchronously More... | |
function | saveState (path, callback) |
save state from file. More... | |
function | saveTextData (data, path, callback) |
save string to file. More... | |
function | setPlaybackOptions (oscillator, start, end_, loopType, loopStart, loopEnd, playForward, callback) |
set playback options inside the oscillator More... | |
function | unpurge (target, callback) |
unpurge an/several element(s)/oscillator(s) content in order to load their memory. More... | |
Asynchronous operations.
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 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 setPlaybackOptions | ( | oscillator | , |
start | , | ||
end_ | , | ||
loopType | , | ||
loopStart | , | ||
loopEnd | , | ||
playForward | , | ||
callback | |||
) |
set playback options inside the oscillator
oscillator | |
start | |
end | |
loopType | 0 None, 1 Forward, 2 Alternate, 3 OneShot |
loopStart | |
loopEnd | |
playForward | |
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 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 loadData | ( | path | , |
callback | |||
) |
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 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 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 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 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 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 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 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 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