15.3. load_array()
load_array(variable>,)
Loads an array from an ex-
ternal file (.nka file)
The array variable, this name must be present in the .nka file
Load/Save Commands
132
KSP Reference Manual
0:
A dialog window pops up, allowing you to select an .nka file. Can only be used in UI,
pgs and
persistence_changed
callbacks.
1:
The array is directly loaded from the "Data" folder.
For user instruments, the "Data" folder is located beside the resource container.
For library instruments, the "Data" folder is located here:
OS X:
/Library/Application Support//
Win:
C:\User\\AppData\Local\\
Can be used in UI, pgs, init (synchronous) and
persistence_changed
callbacks.
2:
The array is directly loaded from the "data" folder
inside
the resource container. Can
be used in UI, pgs, init (synchronous) and
persistence_changed callbacks.
Remarks
• It is also possible to load string arrays from .nka files.
• It is not possible to load an array with %xyz in its .nka file into array %abc.
• The array data is not directly available after the
load_array()
command has been executed
since the command works asynchronous. The only situation in which the values are instantly
available is when using mode 1 or mode 2 within an init callback.
• When using mode 0 the callback continues even if the loading dialog is still open.
• Mode 2 is only available for loading arrays, i.e.
save_array()
does not have this option.
• When loading an array within the init callback, please remember that the loaded data will be
overwritten at the end of the callback if the array is persistent. Use
read_persistent_var()
before loading the array to avoid this problem.
• .nka files loaded from the resource container should always have a newline character at the
end of the file. If this last newline is missing, then KONTAKT will not know the file has ended
and will continue to try and load other data from the resources container. Files generated by
the
save_array()
command have this automatically, but if you are creating files manually,
then this is something to take care of.
Example
(see next page)
on init
declare $count
declare ui_button $Load
declare ui_button $Save
declare ui_table %table[8] (2,2,100)
make_persistent(%table)
declare %preset[8]
declare $load_arr_id
$load_arr_id := -1
declare $save_arr_id
$save_arr_id := -1
end on
on ui_control (%table)
Do'stlaringiz bilan baham: |