Group Commands
allow_group()
|
---|
Allows the specified group, i.e. makes it available for playback |
Remarks
The numbering of the group index is zero-based, i.e. index of the first instrument group is 0.
The group allow states can only be changed if the voice is not running.
Examples
on note disallow_group($ALL_GROUPS) allow_group(0) end on
Only the first group will play back
See Also
Events and MIDI: $ALL_GROUPS
, $EVENT_PAR_ALLOW_GROUP
disallow_group()
|
---|
Disallows the specified group, i.e. makes it unavailable for playback |
Remarks
The numbering of the group index is zero-based, i.e. index of the first instrument group is 0.
The group disallow states can only be changed if the voice is not running.
Examples
on init declare $count declare ui_menu $groups_menu add_menu_item($groups_menu, "Play All", -1) while ($count < $NUM_GROUPS) add_menu_item($groups_menu, "Mute: " & group_name($count), $count) inc($count) end while end on on note if ($groups_menu # -1) disallow_group($groups_menu) end if end on
Muting one specific group of an instrument
See Also
Events and MIDI: $ALL_GROUPS
, $EVENT_PAR_ALLOW_GROUP
get_group_idx()
|
---|
Returns the group index for the specified group name |
Remarks
If no group with the specified name is found, this command will return $NI_NOT_FOUND.
Examples
on init declare $group_idx end on on note $group_idx := get_group_idx("Accordion") if ($group_idx # $NI_NOT_FOUND) disallow_group($group_idx) end if end on
A simple, yet useful script
See Also
get_purge_state()
| |
---|---|
Returns the purge state of the specified group: 0: The group is purged. 1: The group is not purged, i.e. the samples are loaded. | |
| The index number of the group that should be checked. |
Examples
on init declare ui_button $purge declare ui_button $checkpurge set_text($purge, "Purge first group") set_text($checkpurge, "Check purge status") end on on ui_control ($purge) { 1 - $purge inverts the behaviour of the button, here } purge_group(0, 1 - $purge) end on on ui_control ($checkpurge) if (get_purge_state(0) = 0) message(“Group is purged.”) else message(“Group is not purged.”) end if end on
A simple purge check
See Also
group_name()
|
---|
Returns the group name for the specified group |
Remarks
The numbering of the group index is zero-based, i.e. index of the first instrument group is 0.
Examples
on init declare $count declare ui_menu $groups_menu $count := 0 while ($count < $NUM_GROUPS) add_menu_item ($groups_menu, group_name($count), $count) inc($count) end while end on
Quickly creating a menu with all available groups
on init declare $count declare ui_label $label (2, 6) set_text($label, "") end on on note $count := 0 while ($count < num_elements(%GROUPS_AFFECTED)) add_text_line($label, group_name(%GROUPS_AFFECTED[$count])) inc($count) end while end on on release set_text($label, "") end on
Query the status of the first 1001 zone IDs
See Also
Events and MIDI: $ALL_GROUPS
, $NUM_GROUPS
purge_group()
| |
---|---|
Purges (i.e. unloads from RAM) the samples of the specified group | |
| The index number of the group which contains the samples to be purged. |
| If set to 0, the samples of the specified group are unloaded. If set to 1, the samples are reloaded. |
Remarks
When using
purge_group()
in a while loop, don’t use anywait()
commands within the loop.purge_group()
can only be used inui_control
andpersistence_changed
callbacks.It is recommended not to use the
purge_group()
command in UI callbacks of automatable controls.It is also possible to supply an async ID to the
purge_group()
function and get a return in theasync_complete
callback.
Examples
on init declare $async_id := -1 declare ui_button $purge set_text($purge,"Purge first group") end on on ui_control ($purge) $async_id := purge_group(0, abs($purge - 1)) end on on async_complete if ($NI_ASYNC_ID = $async_id) if (get_purge_state(0) = 0) message("Group is purged") else message("Group is not purged") end if end if end on
Unloading all samples of the first group