Skip to content

Commit 367a123

Browse files
committed
Add mode actions to set and reset vel/pan/pitch
- According to the selected edit mode, it's now possible to set each property to a certain value (opens a window), or reset it to the default value, alongside with adding +10, -10, +1, -1 - Makes use of the existing macros to set velocity and panning, and also adds a new one to set the pitch
1 parent 0e6bb3e commit 367a123

File tree

28 files changed

+222
-53
lines changed

28 files changed

+222
-53
lines changed

scripts/control_create/control_create.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ stereo_width = 50
321321
times_clipedited = 0
322322
setvel = 100
323323
setpan = 0
324+
setpit = 0
324325

325326
// Saving
326327
save_version = nbs_version

scripts/control_draw/control_draw.gml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ if (sela > -1 && selb > -1 && window = 0 && cursmarker = 0 && clickinarea = 1) {
389389
inactive(selected = 0) + "Ctrl+D$" + get_mode_actions(2) + "|"+
390390
inactive(selected = 0) + "Ctrl+R$" + get_mode_actions(3) + "|"+
391391
inactive(selected = 0) + "Ctrl+F$" + get_mode_actions(4) + "|"+
392+
condstr((editmode != m_key), inactive(selected = 0) + "Ctrl+T$" + get_mode_actions(5) + "|") +
393+
condstr((editmode != m_key), inactive(selected = 0) + "Ctrl+G$" + get_mode_actions(6) + "|") +
392394
inactive(selected = 0) + "Change instrument...|\\|" + str + condstr(customstr != "", "-|") + customstr + "/|-|"+
393395
inactive(selected = 0 || selection_l = 0) + "Expand selection|"+
394396
inactive(selected = 0 || selection_l = 0) + "Compress selection|"+
@@ -437,6 +439,8 @@ if (window = 0 && text_focus = -1) {
437439
if (keyboard_check_pressed(ord("D"))) mode_action(2)
438440
if (keyboard_check_pressed(ord("R"))) mode_action(3)
439441
if (keyboard_check_pressed(ord("F"))) mode_action(4)
442+
if ((editmode != m_key) && (keyboard_check_pressed(ord("T")))) mode_action(5)
443+
if ((editmode != m_key) && (keyboard_check_pressed(ord("G")))) mode_action(6)
440444
}
441445
if (keyboard_check_pressed(vk_delete) && selected > 0) selection_delete(0)
442446
if (sb_sel = 0) {
@@ -946,7 +950,8 @@ if (draw_macroicon(9, xx, yy, "Fade Out", 0, 0)) {playing = 0 macro_fadeout()} x
946950
if (draw_macroicon(10, xx, yy + 16, "Replace Key", 0, 0)) {playing = 0 macro_replacekey()} xx += 25
947951
if (draw_macroicon(11, xx, yy + 16, "Set Velocity", 0, 0)) {playing = 0 window = w_setvelocity} xx += 25
948952
if (draw_macroicon(12, xx, yy + 16, "Set Panning", 0, 0)) {playing = 0 window = w_setpanning} xx += 25
949-
if (draw_macroicon(13, xx, yy + 16, "Reset", 0, 0)) {playing = 0 macro_reset()} xx += 25
953+
if (draw_macroicon(13, xx, yy + 16, "Set Pitch", 0, 0)) {playing = 0 window = w_setpitch} xx += 25
954+
if (draw_macroicon(14, xx, yy + 16, "Reset", 0, 0)) {playing = 0 macro_reset()} xx += 25
950955
}
951956

952957
// Tabs
@@ -997,6 +1002,8 @@ if (draw_tab("Edit")) {
9971002
inactive(selected = 0) + "Ctrl+D$" + get_mode_actions(2) + "|"+
9981003
inactive(selected = 0) + "Ctrl+R$" + get_mode_actions(3) + "|"+
9991004
inactive(selected = 0) + "Ctrl+F$" + get_mode_actions(4) + "|"+
1005+
condstr((editmode != m_key), inactive(selected = 0) + "Ctrl+T$" + get_mode_actions(5) + "|") +
1006+
condstr((editmode != m_key), inactive(selected = 0) + "Ctrl+G$" + get_mode_actions(6) + "|") +
10001007
inactive(selected = 0) + "Change instrument...|\\|" + str + condstr(customstr != "", "-|") + customstr + "/|-|"+
10011008
inactive(selected = 0 || selection_l = 0) + "Expand selection|"+
10021009
inactive(selected = 0 || selection_l = 0) + "Compress selection|"+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// draw_window_setpanning()
2+
var x1, y1, a, b, str, total_vals, val, decr, inc;
3+
curs = cr_default
4+
text_exists[0] = 0
5+
x1 = floor(window_width / 2 - 80)
6+
y1 = floor(window_height / 2 - 80)
7+
draw_window(x1, y1, x1 + 140, y1 + 130)
8+
draw_set_font(fnt_mainbold)
9+
draw_text(x1 + 8, y1 + 8, "Set Note Pitch")
10+
if (selected = 0) return 0
11+
draw_set_font(fnt_main)
12+
if (theme = 0) {
13+
draw_set_color(c_white)
14+
draw_rectangle(x1 + 6, y1 + 26, x1 + 134, y1 + 92, 0)
15+
draw_set_color(make_color_rgb(137, 140, 149))
16+
draw_rectangle(x1 + 6, y1 + 26, x1 + 134, y1 + 92, 1)
17+
}
18+
draw_areaheader(x1 + 10, y1 + 53, 120, 35, "Pitch")
19+
setpit = median(-1000, draw_dragvalue(18, x1 + 55, y1 + 65, setpit, 0.1), 1000)
20+
21+
draw_theme_color()
22+
if (draw_button2(x1 + 10, y1 + 98, 60, "OK")) {
23+
str = selection_code
24+
val = 0
25+
arr_data = selection_to_array(str)
26+
window = 0
27+
total_vals = string_count("|", str)
28+
val = 0
29+
while (val < total_vals) {
30+
val += 6
31+
arr_data[val] = setpit
32+
val += 1
33+
while arr_data[val] != -1 {
34+
val += 5
35+
arr_data[val] = setpit
36+
val += 1
37+
}
38+
val ++
39+
}
40+
str = array_to_selection(arr_data, total_vals)
41+
selection_load(selection_x,selection_y,str,true)
42+
if(!keyboard_check(vk_alt)) selection_place(false)
43+
}
44+
if (draw_button2(x1 + 70, y1 + 98, 60, "Cancel")) {window = 0}
45+
window_set_cursor(curs)

scripts/draw_window_macro_setpitch/draw_window_macro_setpitch.yy

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

scripts/draw_windows/draw_windows.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ switch (window mod w_menu) {
2828
case w_saveoptions: draw_window_save_options() break
2929
case w_setvelocity: draw_window_macro_setvelocity() break
3030
case w_setpanning: draw_window_macro_setpanning() break
31+
case w_setpitch: draw_window_macro_setpitch() break
3132
case w_branch_export: draw_window_branch_export() break
3233
}

scripts/get_mode_actions/get_mode_actions.gml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ switch editmode {
1010
case 2: return "Decrease octave" break
1111
case 3: return "Increase key" break
1212
case 4: return "Decrease key" break
13+
default: return ""
1314
}
1415
break
1516
}
@@ -19,6 +20,9 @@ switch editmode {
1920
case 2: return "Decrease velocity by 10" break
2021
case 3: return "Increase velocity" break
2122
case 4: return "Decrease velocity" break
23+
case 5: return "Set velocity..." break
24+
case 6: return "Reset velocity" break
25+
default: return ""
2226
}
2327
break
2428
}
@@ -28,6 +32,9 @@ switch editmode {
2832
case 2: return "Pan left by 10" break
2933
case 3: return "Pan right" break
3034
case 4: return "Pan left" break
35+
case 5: return "Set panning..." break
36+
case 6: return "Reset panning" break
37+
default: return ""
3138
}
3239
break
3340
}
@@ -37,6 +44,9 @@ switch editmode {
3744
case 2: return "Detune -10 cents" break
3845
case 3: return "Detune +1 cent" break
3946
case 4: return "Detune -1 cent" break
47+
case 5: return "Set pitch..." break
48+
case 6: return "Reset pitch" break
49+
default: return ""
4050
}
4151
break
4252
}

scripts/macros/macros.gml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#macro w_update 16
5050
#macro w_minecraft 15
5151
#macro w_schematic_export 14
52-
#macro w_branch_export 39
52+
#macro w_branch_export 40
5353
#macro w_datapack_export 30
5454
#macro w_mp3_export 31
5555
#macro w_checkupdates 13
@@ -74,6 +74,7 @@
7474
#macro w_saveoptions 36
7575
#macro w_setvelocity 37
7676
#macro w_setpanning 38
77+
#macro w_setpitch 39
7778

7879
#macro br "\r\n"
7980

scripts/menu_click/menu_click.gml

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,26 @@ switch (m) {
7070
if (sel = 12) mode_action(2)
7171
if (sel = 13) mode_action(3)
7272
if (sel = 14) mode_action(4)
73-
if (sel > 15 && sel < 16 + ds_list_size(instrument_list)) selection_changeins(instrument_list[| sel - 16])
74-
if (sel = 16 + ds_list_size(instrument_list)) selection_expand()
75-
if (sel = 17 + ds_list_size(instrument_list)) selection_compress()
76-
if (sel = 19 + ds_list_size(instrument_list)) window = w_tremolo
77-
if (sel = 20 + ds_list_size(instrument_list)) window = w_stereo
78-
if (sel = 21 + ds_list_size(instrument_list)) window = w_arpeggio
79-
if (sel = 22 + ds_list_size(instrument_list)) window = w_portamento
80-
if (sel = 23 + ds_list_size(instrument_list)) macro_vibrato()
81-
if (sel = 24 + ds_list_size(instrument_list)) window = w_stagger
82-
if (sel = 25 + ds_list_size(instrument_list)) macro_chorus()
83-
if (sel = 26 + ds_list_size(instrument_list)) macro_velocitylfo()
84-
if (sel = 27 + ds_list_size(instrument_list)) macro_fadein()
85-
if (sel = 28 + ds_list_size(instrument_list)) macro_fadeout()
86-
if (sel = 29 + ds_list_size(instrument_list)) macro_replacekey()
87-
if (sel = 30 + ds_list_size(instrument_list)) window = w_setvelocity
88-
if (sel = 31 + ds_list_size(instrument_list)) window = w_setpanning
89-
if (sel = 32 + ds_list_size(instrument_list)) macro_reset()
90-
if (sel = 33 + ds_list_size(instrument_list)) {
73+
if (sel = 15 && editmode != m_key) mode_action(5)
74+
if (sel = 16 && editmode != m_key) mode_action(6)
75+
if (sel > 17 && sel < 18 + ds_list_size(instrument_list)) selection_changeins(instrument_list[| sel - 18])
76+
if (sel = 18 + ds_list_size(instrument_list)) selection_expand()
77+
if (sel = 19 + ds_list_size(instrument_list)) selection_compress()
78+
if (sel = 21 + ds_list_size(instrument_list)) window = w_tremolo
79+
if (sel = 22 + ds_list_size(instrument_list)) window = w_stereo
80+
if (sel = 23 + ds_list_size(instrument_list)) window = w_arpeggio
81+
if (sel = 24 + ds_list_size(instrument_list)) window = w_portamento
82+
if (sel = 25 + ds_list_size(instrument_list)) macro_vibrato()
83+
if (sel = 26 + ds_list_size(instrument_list)) window = w_stagger
84+
if (sel = 27 + ds_list_size(instrument_list)) macro_chorus()
85+
if (sel = 28 + ds_list_size(instrument_list)) macro_velocitylfo()
86+
if (sel = 29 + ds_list_size(instrument_list)) macro_fadein()
87+
if (sel = 30 + ds_list_size(instrument_list)) macro_fadeout()
88+
if (sel = 31 + ds_list_size(instrument_list)) macro_replacekey()
89+
if (sel = 32 + ds_list_size(instrument_list)) window = w_setvelocity
90+
if (sel = 33 + ds_list_size(instrument_list)) window = w_setpanning
91+
if (sel = 34 + ds_list_size(instrument_list)) macro_reset()
92+
if (sel = 35 + ds_list_size(instrument_list)) {
9193
if (question("Transpose selected notes so that they fall within Minecraft's 2 octaves?", "Transpose notes")) selection_transpose()
9294
}
9395
break
@@ -114,24 +116,26 @@ switch (m) {
114116
if (sel = 12) mode_action(2)
115117
if (sel = 13) mode_action(3)
116118
if (sel = 14) mode_action(4)
117-
if (sel > 15 && sel < 16 + ds_list_size(instrument_list)) selection_changeins(instrument_list[| sel - 16])
118-
if (sel = 16 + ds_list_size(instrument_list)) selection_expand()
119-
if (sel = 17 + ds_list_size(instrument_list)) selection_compress()
120-
if (sel = 19 + ds_list_size(instrument_list)) window = w_tremolo
121-
if (sel = 20 + ds_list_size(instrument_list)) window = w_stereo
122-
if (sel = 21 + ds_list_size(instrument_list)) window = w_arpeggio
123-
if (sel = 22 + ds_list_size(instrument_list)) window = w_portamento
124-
if (sel = 23 + ds_list_size(instrument_list)) macro_vibrato()
125-
if (sel = 24 + ds_list_size(instrument_list)) window = w_stagger
126-
if (sel = 25 + ds_list_size(instrument_list)) macro_chorus()
127-
if (sel = 26 + ds_list_size(instrument_list)) macro_velocitylfo()
128-
if (sel = 27 + ds_list_size(instrument_list)) macro_fadein()
129-
if (sel = 28 + ds_list_size(instrument_list)) macro_fadeout()
130-
if (sel = 29 + ds_list_size(instrument_list)) macro_replacekey()
131-
if (sel = 30 + ds_list_size(instrument_list)) window = w_setvelocity
132-
if (sel = 31 + ds_list_size(instrument_list)) window = w_setpanning
133-
if (sel = 32 + ds_list_size(instrument_list)) macro_reset()
134-
if (sel = 33 + ds_list_size(instrument_list)) {
119+
if (sel = 15 && editmode != m_key) mode_action(5)
120+
if (sel = 16 && editmode != m_key) mode_action(6)
121+
if (sel > 17 && sel < 16 + ds_list_size(instrument_list)) selection_changeins(instrument_list[| sel - 18])
122+
if (sel = 18 + ds_list_size(instrument_list)) selection_expand()
123+
if (sel = 19 + ds_list_size(instrument_list)) selection_compress()
124+
if (sel = 21 + ds_list_size(instrument_list)) window = w_tremolo
125+
if (sel = 22 + ds_list_size(instrument_list)) window = w_stereo
126+
if (sel = 23 + ds_list_size(instrument_list)) window = w_arpeggio
127+
if (sel = 24 + ds_list_size(instrument_list)) window = w_portamento
128+
if (sel = 25 + ds_list_size(instrument_list)) macro_vibrato()
129+
if (sel = 26 + ds_list_size(instrument_list)) window = w_stagger
130+
if (sel = 27 + ds_list_size(instrument_list)) macro_chorus()
131+
if (sel = 28 + ds_list_size(instrument_list)) macro_velocitylfo()
132+
if (sel = 29 + ds_list_size(instrument_list)) macro_fadein()
133+
if (sel = 30 + ds_list_size(instrument_list)) macro_fadeout()
134+
if (sel = 31 + ds_list_size(instrument_list)) macro_replacekey()
135+
if (sel = 32 + ds_list_size(instrument_list)) window = w_setvelocity
136+
if (sel = 33 + ds_list_size(instrument_list)) window = w_setpanning
137+
if (sel = 34 + ds_list_size(instrument_list)) macro_reset()
138+
if (sel = 35 + ds_list_size(instrument_list)) {
135139
if (question("Transpose selected notes so that they fall within Minecraft's 2 octaves?", "Transpose notes")) selection_transpose()
136140
}
137141
break

scripts/mode_action/mode_action.gml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ switch editmode {
1919
case 2: selection_changevel(-10) break
2020
case 3: selection_changevel(1) break
2121
case 4: selection_changevel(-1) break
22+
case 5: window = w_setvelocity break
23+
case 6: selection_setvel(100) break
2224
}
2325
break
2426
}
@@ -28,6 +30,8 @@ switch editmode {
2830
case 2: selection_changepan(-10) break
2931
case 3: selection_changepan(1) break
3032
case 4: selection_changepan(-1) break
33+
case 5: window = w_setpanning break
34+
case 6: selection_setpan(100) break
3135
}
3236
break
3337
}
@@ -37,6 +41,8 @@ switch editmode {
3741
case 2: selection_changepit(-10) break
3842
case 3: selection_changepit(1) break
3943
case 4: selection_changepit(-1) break
44+
case 5: window = w_setpitch break
45+
case 6: selection_setpit(0) break
4046
}
4147
break
4248
}

scripts/reset/reset.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ stereo_width = 50
129129
times_clipedited = 0
130130
setvel = 100
131131
setpan = 0
132+
setpit = 0
132133

133134
// Saving
134135
save_version = nbs_version

0 commit comments

Comments
 (0)