0% found this document useful (0 votes)
108 views15 pages

Ambient Escapes Script

This document contains initialization code for an ambient soundscape synthesizer. It declares constants, variables, and arrays needed for the program. It initializes factory sound names, paths, and browser button IDs. It also sets up user zone parameters and makes variables persistent in memory. Functions are defined for closing the browser, updating the UI, clearing async IDs, waiting for async operations, clearing zones, and loading sounds.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views15 pages

Ambient Escapes Script

This document contains initialization code for an ambient soundscape synthesizer. It declares constants, variables, and arrays needed for the program. It initializes factory sound names, paths, and browser button IDs. It also sets up user zone parameters and makes variables persistent in memory. Functions are defined for closing the browser, updating the UI, clearing async IDs, waiting for async operations, clearing zones, and loading sounds.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 15

on init

message("")

disable_logging($NI_LOG_WARNING)
set_key_pressed_support(1)

load_performance_view("ambientescapes")

make_persistent($macros_knobs_blendab)
make_persistent($macros_knobs_attack)
make_persistent($macros_knobs_release)
make_persistent($macros_knobs_cutoff)
make_persistent($macros_knobs_noise)
make_persistent($macros_knobs_phaser)
make_persistent($macros_knobs_crunch)
make_persistent($macros_knobs_volume)

declare const $NUM_LAYERS := 2


declare const $NUM_FACTORY_SOUNDS := 5
declare const $NUM_TOTAL_SOUNDS := 6
declare const $MAX_ZONES_PER_LAYER := 32
declare const $USER_SOUND := 5

declare $a
declare $b
declare $c
declare $d
declare ~e
declare $f
declare $i
declare %asyncIDs[256] := (-1)
declare $first_unassigned
declare $layer_pointer
declare $load_lock
declare $num_levels
declare $prev_note
declare $root_key
declare $search_ID
declare $snap_loaded
declare $temp_low_key
declare $temp_zone_ID
declare $vel_range_per_sample
declare %blend_vol[1001]

declare %browser_btn_ID[12]
%browser_btn_ID[ 0] := get_ui_id($browser_slota_button1)
%browser_btn_ID[ 1] := get_ui_id($browser_slota_button2)
%browser_btn_ID[ 2] := get_ui_id($browser_slota_button3)
%browser_btn_ID[ 3] := get_ui_id($browser_slota_button4)
%browser_btn_ID[ 4] := get_ui_id($browser_slota_button5)
%browser_btn_ID[ 5] := get_ui_id($browser_slota_button6)
%browser_btn_ID[ 6] := get_ui_id($browser_slotb_button1)
%browser_btn_ID[ 7] := get_ui_id($browser_slotb_button2)
%browser_btn_ID[ 8] := get_ui_id($browser_slotb_button3)
%browser_btn_ID[ 9] := get_ui_id($browser_slotb_button4)
%browser_btn_ID[10] := get_ui_id($browser_slotb_button5)
%browser_btn_ID[11] := get_ui_id($browser_slotb_button6)

declare %main_slot_name_ID[$NUM_LAYERS]
%main_slot_name_ID[0] := get_ui_id($main_slota_name)
%main_slot_name_ID[1] := get_ui_id($main_slotb_name)

declare !factory_sound_names[$NUM_FACTORY_SOUNDS]
!factory_sound_names[0] := "Ambient Acid"
!factory_sound_names[1] := "Deep Liquid"
!factory_sound_names[2] := "Field Scapes"
!factory_sound_names[3] := "Harmonic Chaos"
!factory_sound_names[4] := "Soft Synth"

load_array(%blend_vol, 2)

declare %active_sound[$NUM_LAYERS] := (0, 1)


declare %prev_sound[$NUM_LAYERS] := (-1)

make_persistent(%active_sound)
make_persistent(%prev_sound)

read_persistent_var(%active_sound)
read_persistent_var(%prev_sound)

declare @FACTORY_SAMPLE_BASE_PATH
@FACTORY_SAMPLE_BASE_PATH := get_folder($GET_FOLDER_PATCH_DIR) & "Samples/"

declare !factory_sample_names[$NUM_FACTORY_SOUNDS]
!factory_sample_names[0] := "Heaven"
!factory_sample_names[1] := "Earth"
!factory_sample_names[2] := "Bowgart"
!factory_sample_names[3] := "PPGChoir"
!factory_sample_names[4] := "Stringer"

declare !factory_sample_paths[$NUM_FACTORY_SOUNDS]

$a := 0
while ($a < $NUM_FACTORY_SOUNDS)
!factory_sample_paths[$a] := @FACTORY_SAMPLE_BASE_PATH & !
factory_sample_names[$a] & ".ncw"
inc($a)
end while

declare %new_user_sample_dropped[$NUM_LAYERS]
declare %num_user_zones_per_layer[$NUM_LAYERS] := (1)
declare %user_zones_per_key[128 * $MAX_ZONES_PER_LAYER]
declare %user_zone_key_low[$MAX_ZONES_PER_LAYER * $NUM_LAYERS]
declare %user_zone_key_high[$MAX_ZONES_PER_LAYER * $NUM_LAYERS] := (127)
declare %user_zone_vel_low[$MAX_ZONES_PER_LAYER * $NUM_LAYERS] := (1)
declare %user_zone_vel_high[$MAX_ZONES_PER_LAYER * $NUM_LAYERS] := (127)
declare !user_sample_paths[$MAX_ZONES_PER_LAYER * $NUM_LAYERS]
declare ?user_zone_key_root[$MAX_ZONES_PER_LAYER * $NUM_LAYERS] := (60.0)
declare ?user_zone_rms[$MAX_ZONES_PER_LAYER * $NUM_LAYERS]
declare ?user_zone_temp[$MAX_ZONES_PER_LAYER * $NUM_LAYERS]

make_persistent(%num_user_zones_per_layer)
make_persistent(%user_zone_key_low)
make_persistent(%user_zone_key_high)
make_persistent(%user_zone_vel_low)
make_persistent(%user_zone_vel_high)
make_persistent(%user_zone_vel_high)
make_persistent(?user_zone_key_root)
make_persistent(?user_zone_rms)
make_persistent(!user_sample_paths)

{ set up user zones }


set_num_user_zones($NUM_LAYERS * $MAX_ZONES_PER_LAYER)

{ default zone parameters }


$a := 0
while ($a < $NUM_LAYERS)
if (%active_sound[$a] # %prev_sound[$a] and %active_sound[$a] <
$NUM_FACTORY_SOUNDS)

$temp_zone_ID := %NI_USER_ZONE_IDS[$a * $MAX_ZONES_PER_LAYER]


set_sample($temp_zone_ID, !
factory_sample_paths[%active_sound[$a]])

set_zone_par($temp_zone_ID, $ZONE_PAR_GROUP, $a)


set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_KEY, 0)
set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_KEY, 127)
set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_VELO, 1)
set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_VELO, 127)
set_zone_par($temp_zone_ID, $ZONE_PAR_ROOT_KEY, 60)
end if

inc($a)
end while
end on

function closeBrowser()
set_control_par(get_ui_id($browser), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
set_control_par(get_ui_id($main), $CONTROL_PAR_HIDE, $HIDE_PART_NOTHING)
end function

function openBrowser()
set_control_par(get_ui_id($main), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
set_control_par(get_ui_id($browser), $CONTROL_PAR_HIDE, $HIDE_PART_NOTHING)
end function

function updateUI()
$a := 0
while ($a < $NUM_LAYERS)
if (%active_sound[$a] < $NUM_FACTORY_SOUNDS)
set_control_par_str(%main_slot_name_ID[$a], $CONTROL_PAR_TEXT, !
factory_sound_names[%active_sound[$a]])
else
set_control_par_str(%main_slot_name_ID[$a], $CONTROL_PAR_TEXT,
"User Sound")
end if

$b := 0
while ($b < $NUM_FACTORY_SOUNDS + 1)
if (%active_sound[$a] = $b)
set_control_par(%browser_btn_ID[$a * ($NUM_FACTORY_SOUNDS +
1) + $b], $CONTROL_PAR_VALUE, 1)
else
set_control_par(%browser_btn_ID[$a * ($NUM_FACTORY_SOUNDS +
1) + $b], $CONTROL_PAR_VALUE, 0)
end if
inc($b)
end while

inc($a)
end while

attach_zone($main_slota_waveform, %NI_USER_ZONE_IDS[0], 0)
attach_zone($main_slotb_waveform, %NI_USER_ZONE_IDS[$MAX_ZONES_PER_LAYER], 0)
end function

function clearAsyncIDs()
$f := 0
while ($f < num_elements(%asyncIDs))
%asyncIDs[$f] := -1
inc($f)
end while
end function

function waitAsync()
$f := 0
while ($f < num_elements(%asyncIDs))
if (%asyncIDs[$f] # -1)
wait_async(%asyncIDs[$f])
end if

inc($f)
end while
end function

function clearZones()
$f := 0
while ($first_unassigned < $MAX_ZONES_PER_LAYER)
$temp_zone_ID := %NI_USER_ZONE_IDS[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $first_unassigned]
%asyncIDs[$f] := set_sample($temp_zone_ID, "")

inc($f)
inc($first_unassigned)
end while

call waitAsync()
end function

function loadSound()
fade_out($ALL_EVENTS, 2000, 1)

$load_lock := 1

if (%active_sound[$layer_pointer] # %prev_sound[$layer_pointer] or
%new_user_sample_dropped[$layer_pointer] = 1 or $snap_loaded = 1)
if (%active_sound[$layer_pointer] < $NUM_FACTORY_SOUNDS)
{ factory sound loading }

$temp_zone_ID := %NI_USER_ZONE_IDS[$layer_pointer *
$MAX_ZONES_PER_LAYER]

call clearAsyncIDs()
%asyncIDs[0] := set_sample($temp_zone_ID, !
factory_sample_paths[%active_sound[$layer_pointer]])
%asyncIDs[1] := set_zone_par($temp_zone_ID, $ZONE_PAR_GROUP,
$layer_pointer)
%asyncIDs[2] := set_zone_par($temp_zone_ID, $ZONE_PAR_ROOT_KEY,
60)
%asyncIDs[3] := set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_KEY, 0)
%asyncIDs[4] := set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_KEY,
127)
%asyncIDs[5] := set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_VELO,
1)
%asyncIDs[6] := set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_VELO,
127)

call waitAsync()

{ since factory sounds have only a single sample, clearing unused


zones only needs to be done once, when switching from user sound }
if (%prev_sound[$layer_pointer] = $USER_SOUND)
$first_unassigned := 1
call clearZones()
end if
else
{ user sound loading }

if (%new_user_sample_dropped[$layer_pointer] = 1)
{ show samples loading overlay }
set_skin_offset(640)
hide_part($loading_overlay, $HIDE_PART_NOTHING)

{ clear out sound name and waveform }


if ($layer_pointer = 0)
set_text($main_slota_name, "")
attach_zone($main_slota_waveform, -1, 0)
else
set_text($main_slotb_name, "")
attach_zone($main_slotb_waveform, -1, 0)
end if

{ initialize the mapping grid array for zone IDs (number of


keys x number of samples per key, maximum of which is $MAX_ZONES_PER_LAYER) }
$b := 0
while ($b < num_elements(%user_zones_per_key))
%user_zones_per_key[$b] := -1

inc($b)
end while

{ assign samples to user zones, detect their root keys and


set them to the appropriate instrument group }
$b := 0
while ($b < %num_user_zones_per_layer[$layer_pointer])
$temp_zone_ID := %NI_USER_ZONE_IDS[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b]

%asyncIDs[($b * 3) + 0] :=
set_sample($temp_zone_ID, !user_sample_paths[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 3) + 1] :=
detect_pitch($temp_zone_ID, ?user_zone_key_root[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 3) + 2] :=
detect_rms($temp_zone_ID, ?user_zone_rms[($layer_pointer * $MAX_ZONES_PER_LAYER) +
$b])

inc($b)
end while

call waitAsync()

{ place user zone IDs into the mapping array based on root
key horizontally and number of samples having the same root key vertically }
$b := 0
while ($b < %num_user_zones_per_layer[$layer_pointer])
$temp_zone_ID := %NI_USER_ZONE_IDS[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b]

$c := real_to_int(round(?
user_zone_key_root[($layer_pointer * $MAX_ZONES_PER_LAYER) + $b])) *
$MAX_ZONES_PER_LAYER
while (%user_zones_per_key[$c] # -1)
inc($c)
end while

%user_zones_per_key[$c] := $temp_zone_ID

inc($b)
end while

{ use MIR functions to detect velocity and loudness, in


order to automap the user-dropped samples }
$prev_note := -1
$b := 0
while ($b < 128)
{ count how many velocity layers there are for
current key ($b) }
$num_levels := 0
while (%user_zones_per_key[($b *
$MAX_ZONES_PER_LAYER) + $num_levels] # -1)
inc($num_levels)
end while

if ($num_levels > 0)
if ($prev_note = -1)
$temp_low_key := 0
else
$temp_low_key := $prev_note + ($b -
$prev_note) / 2
end if

if ($prev_note # -1)
$c := 0
while ($c < $num_levels)
$temp_zone_ID := real_to_int(?
user_zone_temp[$c])
$search_ID :=
search(%NI_USER_ZONE_IDS, $temp_zone_ID)
%user_zone_key_high[$search_ID] :=
$temp_low_key - 1

inc($c)
end while
end if

$c := 0
while ($c < num_elements(?user_zone_temp))
?user_zone_temp[$c] := -1.0
inc($c)
end while

$c := 0
while ($c < $num_levels)
{ temporary store user zone ID to the
first half of user_zone_temp array }
?user_zone_temp[$c] :=
int_to_real(%user_zones_per_key[($b * $MAX_ZONES_PER_LAYER) + $c])

$temp_zone_ID := real_to_int(?
user_zone_temp[$c])
$search_ID := search(%NI_USER_ZONE_IDS,
$temp_zone_ID)

{ transfer the detected loudness to the


second half of user_zone_temp array }
?user_zone_temp[$c +
$MAX_ZONES_PER_LAYER] := ?user_zone_rms[$search_ID]

inc($c)
end while

$c := 0
while (?user_zone_temp[$c] # -1.0 or $c <
$MAX_ZONES_PER_LAYER - 1)
$d := $c + 1
if (?user_zone_temp[$c +
$MAX_ZONES_PER_LAYER] > ?user_zone_temp[$d + $MAX_ZONES_PER_LAYER])
~e := ?user_zone_temp[$c]
?user_zone_temp[$c] := ?
user_zone_temp[$d]
?user_zone_temp[$d] := ~e

~e := ?user_zone_temp[$c +
$MAX_ZONES_PER_LAYER]
?user_zone_temp[$c +
$MAX_ZONES_PER_LAYER] := ?user_zone_temp[$d + $MAX_ZONES_PER_LAYER]
?user_zone_temp[$d +
$MAX_ZONES_PER_LAYER] := ~e
end if

inc($c)
end while

$vel_range_per_sample := real_to_int(127.0 /
int_to_real($num_levels))

$c := 0
while ($c < $num_levels)
$temp_zone_ID := real_to_int(?
user_zone_temp[$c])
$search_ID := search(%NI_USER_ZONE_IDS,
$temp_zone_ID)

{ store zone parameters into separate


arrays for later recall }
%user_zone_vel_low[$search_ID] := ($c *
$vel_range_per_sample) + 1
%user_zone_vel_high[$search_ID] := (($c +
1) * $vel_range_per_sample) + 1
%user_zone_key_low[$search_ID] :=
$temp_low_key
%user_zone_key_high[$search_ID] := 127

inc($c)
end while

$prev_note := $b
end if

inc($b)
end while

call clearAsyncIDs()

{ set all zone parameters using the data stored in arrays }


$b := 0
while ($b < %num_user_zones_per_layer[$layer_pointer])
$temp_zone_ID := %NI_USER_ZONE_IDS[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b]

%asyncIDs[($b * 6) + 0] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_GROUP, $layer_pointer)
%asyncIDs[($b * 6) + 1] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_ROOT_KEY, real_to_int(round(?
user_zone_key_root[($layer_pointer * $MAX_ZONES_PER_LAYER) + $b])))
%asyncIDs[($b * 6) + 2] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_KEY, %user_zone_key_low[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 6) + 3] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_KEY, %user_zone_key_high[($layer_pointer
* $MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 6) + 4] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_VELO, %user_zone_vel_low[($layer_pointer
* $MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 6) + 5] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_VELO,
%user_zone_vel_high[($layer_pointer * $MAX_ZONES_PER_LAYER) + $b])

inc($b)
end while

call waitAsync()
else
call clearAsyncIDs()

{ no new user samples were dropped, so we can speed up the


loading time of user sound by using the zone parameters stored in arrays }
$b := 0
while ($b < %num_user_zones_per_layer[$layer_pointer])
$temp_zone_ID := %NI_USER_ZONE_IDS[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b]

%asyncIDs[($b * 7) + 0] :=
set_sample($temp_zone_ID, !user_sample_paths[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 7) + 1] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_GROUP, $layer_pointer)
%asyncIDs[($b * 7) + 2] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_ROOT_KEY, real_to_int(round(?
user_zone_key_root[($layer_pointer * $MAX_ZONES_PER_LAYER) + $b])))
%asyncIDs[($b * 7) + 3] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_KEY, %user_zone_key_low[($layer_pointer *
$MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 7) + 4] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_KEY, %user_zone_key_high[($layer_pointer
* $MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 7) + 5] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_LOW_VELO, %user_zone_vel_low[($layer_pointer
* $MAX_ZONES_PER_LAYER) + $b])
%asyncIDs[($b * 7) + 6] :=
set_zone_par($temp_zone_ID, $ZONE_PAR_HIGH_VELO,
%user_zone_vel_high[($layer_pointer * $MAX_ZONES_PER_LAYER) + $b])

inc($b)
end while

call waitAsync()
end if

{ clear unassigned user zones }


$first_unassigned := $b
call clearZones()

{ hide samples loading overlay }


set_skin_offset(0)
hide_part($loading_overlay, $HIDE_WHOLE_CONTROL)
end if
end if

%prev_sound[$layer_pointer] := %active_sound[$layer_pointer]

$load_lock := 0

call updateUI()
end function

function mainSlotLeftArrow()
%active_sound[$layer_pointer] := (%active_sound[$layer_pointer] +
$NUM_TOTAL_SOUNDS - 1) mod $NUM_TOTAL_SOUNDS
call loadSound()
end function

function mainSlotRightArrow()
%active_sound[$layer_pointer] := (%active_sound[$layer_pointer] +
$NUM_TOTAL_SOUNDS + 1) mod $NUM_TOTAL_SOUNDS
call loadSound()
end function

on persistence_changed
call updateUI()

$snap_loaded := 1

$i := 0
while ($i < $NUM_LAYERS)
$layer_pointer := $i
call loadSound()

inc($i)
end while

$snap_loaded := 0
end on

on note
if ($load_lock = 1)
ignore_event($EVENT_ID)
exit
end if

if (get_event_par($EVENT_ID, $EVENT_PAR_SOURCE) = -1)


set_key_pressed($EVENT_NOTE, 1)
end if
end on

on release
if ($load_lock = 1)
ignore_event($EVENT_ID)
exit
end if

if (get_event_par($EVENT_ID, $EVENT_PAR_SOURCE) = -1)


set_key_pressed($EVENT_NOTE, 0)
end if
end on

on ui_control ($main_slota_droptarget)
$layer_pointer := 0
%new_user_sample_dropped[$layer_pointer] := 1

if (num_elements(!NI_DND_ITEMS_AUDIO) <= $MAX_ZONES_PER_LAYER)


%num_user_zones_per_layer[$layer_pointer] := num_elements(!
NI_DND_ITEMS_AUDIO)
else
%num_user_zones_per_layer[$layer_pointer] := $MAX_ZONES_PER_LAYER
end if

$a := 0
while ($a < $MAX_ZONES_PER_LAYER)
!user_sample_paths[$a] := !NI_DND_ITEMS_AUDIO[$a]
inc($a)
end while

%active_sound[$layer_pointer] := $USER_SOUND
call loadSound()

%new_user_sample_dropped[$layer_pointer] := 0
end on

on ui_control ($main_slotb_droptarget)
$layer_pointer := 1
%new_user_sample_dropped[$layer_pointer] := 1

if (num_elements(!NI_DND_ITEMS_AUDIO) <= $MAX_ZONES_PER_LAYER)


%num_user_zones_per_layer[$layer_pointer] := num_elements(!
NI_DND_ITEMS_AUDIO)
else
%num_user_zones_per_layer[$layer_pointer] := $MAX_ZONES_PER_LAYER
end if

$a := 0
while ($a < $MAX_ZONES_PER_LAYER)
!user_sample_paths[$a + $MAX_ZONES_PER_LAYER] := !
NI_DND_ITEMS_AUDIO[$a]
inc($a)
end while

%active_sound[$layer_pointer] := $USER_SOUND
call loadSound()

%new_user_sample_dropped[$layer_pointer] := 0
end on

on ui_control ($macros_knobs_blendab)
set_engine_par($ENGINE_PAR_VOLUME, %blend_vol[1000 - $macros_knobs_blendab],
0, -1, -1)
set_engine_par($ENGINE_PAR_VOLUME, %blend_vol[$macros_knobs_blendab], 1, -1,
-1)
end on

on ui_control ($macros_knobs_attack)
$a := 0
while ($a < $NUM_LAYERS)
set_engine_par($ENGINE_PAR_ATTACK, $macros_knobs_attack, $a,
find_mod($a, "ENV_AHDSR"), -1)
inc($a)
end while
end on

on ui_control ($macros_knobs_release)
$a := 0
while ($a < $NUM_LAYERS)
set_engine_par($ENGINE_PAR_RELEASE, $macros_knobs_release, $a,
find_mod($a, "ENV_AHDSR"), -1)
inc($a)
end while
end on

on ui_control ($macros_knobs_cutoff)
$a := 0
while ($a < $NUM_LAYERS)
set_engine_par($ENGINE_PAR_CUTOFF, $macros_knobs_cutoff, $a, 0, -1)
inc($a)
end while
end on

on ui_control ($macros_knobs_noise)
set_engine_par($ENGINE_PAR_NOISELEVEL, $macros_knobs_noise, -1, 0, 1)
end on

on ui_control ($macros_knobs_phaser)
set_engine_par($ENGINE_PAR_PHASIS_MIX, $macros_knobs_phaser, -1, 1, 1)
end on

on ui_control ($macros_knobs_crunch)
set_engine_par($ENGINE_PAR_TP_GAIN, $macros_knobs_crunch, -1, 2, 1)
set_engine_par($ENGINE_PAR_TP_WARMTH, 500000 + ($macros_knobs_crunch / 2),
-1, 2, 1)
set_engine_par($ENGINE_PAR_TP_HF_ROLLOFF, 1000000 - $macros_knobs_crunch, -1,
2, 1)
if ($macros_knobs_crunch < 500000)
set_engine_par($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, 397000, -1, 2, 1)
else
set_engine_par($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, 397000 +
(($macros_knobs_crunch - 500000) / 2), -1, 2, 1)
end if
end on

on ui_control ($macros_knobs_volume)
set_engine_par($ENGINE_PAR_INSERT_EFFECT_OUTPUT_GAIN, $macros_knobs_volume,
-1, 3, 1)
end on

on ui_control ($browser_close)
call closeBrowser()
end on

on ui_control ($main_slota_browse)
if (get_control_par(get_ui_id($main_slota_browse), $CONTROL_PAR_KEY_ALT) = 1)
$main_slota_browse := 0

$a := 0
while ($a < $MAX_ZONES_PER_LAYER)
!user_sample_paths[$a] := ""
inc($a)
end while

message("Cleared user sample paths for layer A!")


wait(3000000)
message("")
else
call openBrowser()
end if
end on

on ui_control ($main_slotb_browse)
if (get_control_par(get_ui_id($main_slotb_browse), $CONTROL_PAR_KEY_ALT) = 1)
$main_slotb_browse := 0
$a := 0
while ($a < $MAX_ZONES_PER_LAYER)
!user_sample_paths[$MAX_ZONES_PER_LAYER + $a] := ""
inc($a)
end while

message("Cleared user sample paths for layer B!")


wait(3000000)
message("")
else
call openBrowser()
end if
end on

on ui_control ($main_slota_left)
if ($load_lock = 0)
$layer_pointer := 0
call mainSlotLeftArrow()
end if
end on

on ui_control ($main_slotb_left)
if ($load_lock = 0)
$layer_pointer := 1
call mainSlotLeftArrow()
end if
end on

on ui_control ($main_slota_right)
if ($load_lock = 0)
$layer_pointer := 0
call mainSlotRightArrow()
end if
end on

on ui_control ($main_slotb_right)
if ($load_lock = 0)
$layer_pointer := 1
call mainSlotRightArrow()
end if
end on

on ui_control ($browser_slota_button1)
if ($load_lock = 0)
$layer_pointer := 0
%active_sound[$layer_pointer] := 0
call loadSound()
end if
end on

on ui_control ($browser_slota_button2)
if ($load_lock = 0)
$layer_pointer := 0
%active_sound[$layer_pointer] := 1
call loadSound()
end if
end on
on ui_control ($browser_slota_button3)
if ($load_lock = 0)
$layer_pointer := 0
%active_sound[$layer_pointer] := 2
call loadSound()
end if
end on

on ui_control ($browser_slota_button4)
if ($load_lock = 0)
$layer_pointer := 0
%active_sound[$layer_pointer] := 3
call loadSound()
end if
end on

on ui_control ($browser_slota_button5)
if ($load_lock = 0)
$layer_pointer := 0
%active_sound[$layer_pointer] := 4
call loadSound()
end if
end on

on ui_control ($browser_slota_button6)
if ($load_lock = 0)
$layer_pointer := 0
%active_sound[$layer_pointer] := 5
call loadSound()
end if
end on

on ui_control ($browser_slotb_button1)
if ($load_lock = 0)
$layer_pointer := 1
%active_sound[$layer_pointer] := 0
call loadSound()
end if
end on

on ui_control ($browser_slotb_button2)
if ($load_lock = 0)
$layer_pointer := 1
%active_sound[$layer_pointer] := 1
call loadSound()
end if
end on

on ui_control ($browser_slotb_button3)
if ($load_lock = 0)
$layer_pointer := 1
%active_sound[$layer_pointer] := 2
call loadSound()
end if
end on

on ui_control ($browser_slotb_button4)
if ($load_lock = 0)
$layer_pointer := 1
%active_sound[$layer_pointer] := 3
call loadSound()
end if
end on

on ui_control ($browser_slotb_button5)
if ($load_lock = 0)
$layer_pointer := 1
%active_sound[$layer_pointer] := 4
call loadSound()
end if
end on

on ui_control ($browser_slotb_button6)
if ($load_lock = 0)
$layer_pointer := 1
%active_sound[$layer_pointer] := 5
call loadSound()
end if
end on

You might also like