Skip to main content

Group Commands

allow_group()

allow_group(<group-index>)

Allows the specified group, i.e. makes it available for playback.

Remarks

  • This commmand is only available in on note and on release callbacks.

  • 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

disallow_group()

set_event_par_arr()

Events and MIDI: $ALL_GROUPS, $EVENT_PAR_ALLOW_GROUP

disallow_group()

disallow_group(<group-index>)

Disallows the specified group, i.e. makes it unavailable for playback.

Remarks

  • This commmand is only available in on note and on release callbacks.

  • 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 

allow_group()

set_event_par_arr()

Events and MIDI: $ALL_GROUPS, $EVENT_PAR_ALLOW_GROUP

get_group_idx()

get_group_idx(<group-name>)

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 

allow_group()

disallow_group()

group_name()

get_purge_state()

get_purge_state(<group-index>)

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.

<group-index>

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

purge_group()

group_name()

group_name(<group-index>)

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 

allow_group()

disallow_group()

get_group_idx()

output_channel_name()

Events and MIDI: $ALL_GROUPS, $NUM_GROUPS

purge_group()

purge_group(<group-index>, <mode>)

Purges (i.e. unloads from RAM) the samples of the specified group.

<group-index>

The index number of the group which contains the samples to be purged.

<mode>

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 any wait() commands within the loop.

  • purge_group() can only be used in on ui_control, on ui_controls and on persistence_changed callbacks.

  • It is recommended not to use the purge_group() command in UI callbacks of automatable controls.

  • It is possible to supply an async ID to the purge_group() function and get a return in the on async_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.

See Also

get_purge_state()