Skip to content

Commit e6351f8

Browse files
committed
impl: Improve speed of nonsimple macro operations
- Add a new function `selection_to_array_ext()` which generate a selection code array based from the current selections; - Utilize `selection_to_array_ext()` in macros instead of `selection_to_array()` for selection code; - This method works well for selection of less than 20k notes.
1 parent ee3288c commit e6351f8

17 files changed

Lines changed: 66 additions & 14 deletions

File tree

Minecraft Note Block Studio.yyp

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/check_custom_instrument/check_custom_instrument.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function check_custom_instrument(argument0) {
22
// check_custom_instrument(string)
33
var str, total_vals, val
44
str = argument0
5-
var arr_data = selection_to_array(str)
5+
var arr_data = selection_to_array_ext()
66
total_vals = array_length(arr_data)
77
val = 0
88
//show_debug_message(string_count("-1", str))

scripts/draw_window_macro_arpeggio/draw_window_macro_arpeggio.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function draw_window_macro_arpeggio() {
3737
windowopen = 0
3838
window = 0
3939
str = selection_code
40-
var arr_data = selection_to_array(str)
40+
var arr_data = selection_to_array_ext()
4141
total_vals = array_length(arr_data)
4242
val = 0
4343
pattern = string_digits_symbol(pattern, "|")

scripts/draw_window_macro_portamento/draw_window_macro_portamento.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function draw_window_macro_portamento() {
3131
windowopen = 0
3232
window = 0
3333
str = selection_code
34-
var arr_data = selection_to_array(str)
34+
var arr_data = selection_to_array_ext()
3535
total_vals = array_length(arr_data)
3636
decr = port_cent / macro_column_count(arr_data)
3737
inc = decr

scripts/draw_window_macro_stagger/draw_window_macro_stagger.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function draw_window_macro_stagger() {
4747
windowopen = 0
4848
window = 0
4949
str = selection_code
50-
var arr_data = selection_to_array(str)
50+
var arr_data = selection_to_array_ext()
5151
total_vals = array_length(arr_data)
5252
val = 0
5353
conf = 0

scripts/draw_window_macro_stereo/draw_window_macro_stereo.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function draw_window_macro_stereo() {
3333
windowclose = 0
3434
windowopen = 0
3535
str = selection_code
36-
var arr_data = selection_to_array(str)
36+
var arr_data = selection_to_array_ext()
3737
window = 0
3838
total_vals = array_length(arr_data)
3939
val = 0

scripts/macro_chorus/macro_chorus.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function macro_chorus() {
22
// macro_chorus()
33
var str, total_vals, val;
44
str = selection_code
5-
var arr_data = selection_to_array(str)
5+
var arr_data = selection_to_array_ext()
66
window = 0
77
total_vals = array_length(arr_data)
88
show_debug_message(str)

scripts/macro_fadein/macro_fadein.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function macro_fadein() {
33
var str, total_vals, val, decr, inc, maxdecr, velval
44
str = selection_code
55
if (selected = 0) return 0
6-
var arr_data = selection_to_array(str)
6+
var arr_data = selection_to_array_ext()
77
total_vals = array_length(arr_data)
88
val = 0
99
// Check bottom-right note block's velocity value, calculate fade out from that.

scripts/macro_fadeout/macro_fadeout.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function macro_fadeout() {
33
var str, total_vals, val, decr, inc, maxdecr
44
str = selection_code
55
if (selected = 0) return 0
6-
var arr_data = selection_to_array(str)
6+
var arr_data = selection_to_array_ext()
77
total_vals = array_length(arr_data)
88
val = 0
99
// Check top-left note block's velocity value, calculate fade out from that.

scripts/macro_replacekey/macro_replacekey.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function macro_replacekey() {
44
var str, key
55
str = selection_code
66
if (selected = 0) return 0
7-
var arr_data = selection_to_array(str)
7+
var arr_data = selection_to_array_ext()
88
key = arr_data[3]
99
selection_change(m_key, key, false)
1010
if(!keyboard_check(vk_alt)) selection_place(false)

0 commit comments

Comments
 (0)