Skip to content

Commit 2d2703c

Browse files
Merge pull request #36 from ShinkoNet/master
Datapack, performance and theme improvements.
2 parents 7d7eced + fbc2af0 commit 2d2703c

File tree

232 files changed

+1613
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+1613
-530
lines changed

Minecraft Note Block Studio.yyp

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/add_block_manual/add_block_manual.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ if (yy > collast[xx]) collast[xx] = yy
5656
if (xx >= enda) enda = xx
5757
if (yy >= endb) endb = yy
5858

59-
if (ins.loaded) play_sound(ins, key, 1)
59+
if (ins.loaded) play_sound(ins, key, 1,100)
6060
history_set(h_addblock, xx, yy, ins, key)
6161
return 1

scripts/change_block_manual/change_block_manual.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pkey = song_key[xx, yy]
1010
song_ins[xx, yy] = ins
1111
song_key[xx, yy] = key
1212

13-
if (ins.loaded) play_sound(ins, key, 1)
13+
if (ins.loaded) play_sound(ins, key, 1,100)
1414

1515
history_set(h_changeblock, xx, yy, ins, key, pins, pkey)
1616
changed = 1

scripts/control_create/control_create.gml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ window_set_min_height(100)
1919
cam_window = camera_create()
2020
view_set_camera(0, cam_window)
2121
window_background = c_white
22+
window2 = 0
2223

2324
// Application
2425
update = 0
@@ -34,6 +35,7 @@ soundsystemuser = 0
3435
menu_shown = ""
3536
songfolder = songs_directory
3637
icons_init()
38+
modspeed=0
3739

3840
// File
3941
filename = ""
@@ -50,6 +52,8 @@ for (a = 0; a < 11; a += 1) {
5052
timesignature = 4
5153

5254
// Playback
55+
audio_listener_orientation(0,1,0, 0,0,1)
56+
audio_listener_position(100,0,1)
5357
playing = 0
5458
record = 0
5559
tempo = 10
@@ -85,6 +89,7 @@ song_added[0, 0] = 0
8589
block_outside = 0
8690
block_custom = 0
8791
midi_devices = 0
92+
fade = 1
8893

8994
colamount[0] = 0
9095
rowamount[0] = 0
@@ -137,12 +142,16 @@ dragincyu = 0
137142

138143
// Layers
139144
realvolume = 1
145+
realstereo = 1
140146
layername[0] = ""
141147
layerlock[0] = 0
142148
layervol[0] = 100
149+
layerstereo[0] = 100
143150
solostr = ""
144151
dragvolb = 0
145152
dragvol = 0
153+
dragstereob = 0
154+
dragstereo = 0
146155

147156
// Piano
148157
show_keynames = 1

scripts/control_draw/control_draw.gml

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ draw_set_alpha(1)
1111
draw_theme_color()
1212
draw_set_font(fnt_main)
1313
editline += 1
14+
if modspeed = 1 game_set_speed(60,gamespeed_fps)
1415
if (editline > 60) editline = 0
1516
if (delay > 0) delay -= 1 / (room_speed / 20)
1617
if (delay < 0) delay = 0
@@ -67,7 +68,7 @@ if (min(keysmax, floor((rw - 32) / 39)) != keysshow) {
6768
}
6869
}
6970
keysshow = min(keysmax, floor((rw - 32) / 39))
70-
x1 = 176
71+
x1 = 192
7172
y1 = 52
7273
if ((window = 0 || select > 0) && playing = 0) {
7374
if (mouse_rectangle(x1 + 2, y1 + 34, totalcols * 32, totalrows * 32) || select > 0) {
@@ -144,22 +145,22 @@ if (mousewheel = 1 && window = 0 && (exist = 0 || changepitch = 0)) {
144145
if (mouse_wheel_down() && insindex > 0) {
145146
insindex--
146147
instrument = instrument_list[| insindex]
147-
play_sound(instrument, selected_key, 1)
148+
play_sound(instrument, selected_key, 1,100)
148149
}
149150
if (mouse_wheel_up() && insindex < ds_list_size(instrument_list) - 1) {
150151
insindex++
151152
instrument = instrument_list[| insindex]
152-
play_sound(instrument, selected_key, 1)
153+
play_sound(instrument, selected_key, 1,100)
153154
}
154155
}
155156
if (mousewheel = 2 && window = 0 && (exist = 0 || changepitch = 0)) {
156157
if (mouse_wheel_down() && selected_key > 0) {
157158
selected_key -= 1
158-
play_sound(instrument, selected_key, 1)
159+
play_sound(instrument, selected_key, 1,100)
159160
}
160161
if (mouse_wheel_up() && selected_key < 87) {
161162
selected_key += 1
162-
play_sound(instrument, selected_key, 1)
163+
play_sound(instrument, selected_key, 1,100)
163164
}
164165
}
165166

@@ -190,13 +191,14 @@ for (a = 0; a < totalcols; a += 1) {
190191
if (startb + b >= colfirst[starta + a] && startb + b <= collast[starta + a]) {
191192
if (song_exists[starta + a, startb + b]) {
192193
s = 0 // Selected
193-
c = 0.5
194+
if (fade=1) c = 0.5
195+
else c = 1
194196
if (lockedlayer[startb + b] = 0) c += 0.5 * (1 - (min(1000, current_time - song_played[starta + a, startb + b]) / 1000))
195197
if (playing = 0) {
196198
if (select = 1 && lockedlayer[startb + b] = 0) {
197199
s = (starta + a >= min(select_pressa, selbx) && starta + a <= max(select_pressa, selbx) && startb + b >= min(select_pressb, selby) && startb + b <= max(select_pressb, selby))
198200
}
199-
c += ((selbx = starta + a && selby = startb + b && select = 0 && window = 0 && cursmarker = 0) || s) * 0.5
201+
if (fade=1) c += ((selbx = starta + a && selby = startb + b && select = 0 && window = 0 && cursmarker = 0) || s) * 0.5
200202
}
201203
draw_block(x1 + 2 + 32 * a, y1 + 34 + 32 * b, song_ins[starta + a, startb + b], song_key[starta + a, startb + b], c, s * 0.8)
202204
}
@@ -224,7 +226,11 @@ if (floor(marker_pos) != floor(marker_prevpos) && floor(marker_pos) <= enda && (
224226
if (song_exists[xx, b]) {
225227
a = 1
226228
c = 100
227-
if (b < endb2) c = layervol[b]
229+
d = 100
230+
if (b < endb2) {
231+
c = layervol[b]
232+
d = layerstereo[b]
233+
}
228234
if (solostr != "") {
229235
if (string_count("|" + string(b) + "|", solostr) = 0) {
230236
a = 0
@@ -240,7 +246,7 @@ if (floor(marker_pos) != floor(marker_prevpos) && floor(marker_pos) <= enda && (
240246
if (current_time - song_added[xx, b] < 1000) a = 0
241247
}
242248
if (a) {
243-
if (song_ins[xx, b].loaded) play_sound(song_ins[xx, b], song_key[xx, b], c / 100)
249+
if (song_ins[xx, b].loaded) play_sound(song_ins[xx, b], song_key[xx, b], c / 100,d)
244250
if (song_ins[xx, b].press) key_played[song_key[xx, b]] = current_time
245251
song_played[xx, b] = current_time
246252
}
@@ -411,15 +417,15 @@ if (window = 0 && text_focus = -1) {
411417
for (a = 1; a <= 10; a++) {
412418
if (keyboard_check_pressed(ord(string(a % 10)))) {
413419
instrument = instrument_list[| a - 1]
414-
play_sound(instrument, selected_key, 1)
420+
play_sound(instrument, selected_key, 1,100)
415421
}
416422
}
417423
}else{
418424
//Last 6 (ctrl+shift)
419425
for (a = 1; a <= 6; a++) {
420426
if (keyboard_check_pressed(ord(string(a % 10)))) {
421427
instrument = instrument_list[| a + 9]
422-
play_sound(instrument, selected_key, 1)
428+
play_sound(instrument, selected_key, 1,100)
423429
}
424430
}
425431
}
@@ -618,6 +624,7 @@ for (b = 0; b < totalrows; b += 1) {
618624
layername[startb + b] = ""
619625
layerlock[startb + b] = 0
620626
layervol[startb + b] = 100
627+
layerstereo[startb + b] = 100
621628
rowamount[startb + b] = 0
622629
endb2 = startb + b + 1
623630
}
@@ -656,17 +663,43 @@ for (b = 0; b < totalrows; b += 1) {
656663
}
657664
}
658665
}
666+
// Stereo
667+
if (realstereo) {
668+
c = ((dragstereob = startb + b && window2 = w_dragstereo) || (mouse_rectangle(x1 + 108, y1 + 5, 16, 25) && window2 = 0))
669+
if (startb + b >= endb2) {
670+
a = 100
671+
} else {
672+
a = layerstereo[startb + b]
673+
}
674+
draw_sprite(spr_stereo, a / 50, x1 + 110, y1 + 11 - c * 5)
675+
popup_set(x1 + 110, y1 + 5, 12, 17, "Stereo Pan: " + string(a) + "%\n(Click and drag to change)")
676+
if (c) {
677+
draw_set_font(fnt_small)
678+
draw_set_halign(fa_center)
679+
if a > 100 {draw_text(x1 + 120, y1 + 18, "R " + string(a-100))}
680+
if a = 100 {draw_text(x1 + 120, y1 + 18, "MONO")}
681+
if a < 100 {draw_text(x1 + 120, y1 + 18, "L " + string((a-100)*-1)) }
682+
draw_set_halign(fa_left)
683+
draw_set_font(fnt_main)
684+
curs = cr_size_ns
685+
if (mouse_check_button_pressed(mb_left)) {
686+
window2 = w_dragstereo
687+
dragstereob = startb + b
688+
dragstereo = layerstereo[startb + b]
689+
}
690+
}
691+
}
659692
// Lock button
660693
p = 0
661694
if (startb + b < endb2) p = (layerlock[startb + b] = 1)
662-
if (draw_layericon(0, x1 + 108-!realvolume * 10, y1 + 8, "Lock this layer", 0, p)) {
695+
if (draw_layericon(0, x1 + 126-!realvolume-!realstereo * 10, y1 + 8, "Lock this layer", 0, p)) {
663696
if (layerlock[startb + b] = 2) solostr = string_replace_all(solostr, "|" + string(startb + b) + "|", "")
664697
if (layerlock[startb + b] = 1) {layerlock[startb + b] = 0} else {layerlock[startb + b] = 1}
665698
}
666699
// Solo button
667700
p = 0
668701
if (startb + b < endb2) p = (layerlock[startb + b] = 2)
669-
if (draw_layericon(1, x1 + 126 - !realvolume * 10, y1 + 8, "Solo this layer", 0, p)) {
702+
if (draw_layericon(1, x1 + 144 - !realvolume-!realstereo * 10, y1 + 8, "Solo this layer", 0, p)) {
670703
if (layerlock[startb + b] = 2) {
671704
layerlock[startb + b] = 0
672705
solostr = string_replace_all(solostr, "|" + string(startb + b) + "|", "")
@@ -675,7 +708,7 @@ for (b = 0; b < totalrows; b += 1) {
675708
solostr += "|" + string(startb + b) + "|"
676709
}
677710
}
678-
if (draw_layericon(2, x1 + 144 - !realvolume * 10, y1 + 8, "Select all note blocks in this layer", 0, 0)) {
711+
if (draw_layericon(2, x1 + 162 - !realvolume-!realstereo * 10, y1 + 8, "Select all note blocks in this layer", 0, 0)) {
679712
playing = 0
680713
selection_place(0)
681714
selection_add(0, startb + b, enda, startb + b, 0, 0)
@@ -689,6 +722,15 @@ if (window = w_dragvol) {
689722
window = w_releasemouse
690723
}
691724
}
725+
if (window2 = w_dragstereo) {
726+
dragstereo += (mouse_yprev - mouse_y) * 2
727+
dragstereo = median(0, dragstereo, 200)
728+
layerstereo[dragstereob] = floor(dragstereo / 10) * 10
729+
if (!mouse_check_button(mb_left)) {
730+
window2 = w_releasemouse
731+
window2 = 0
732+
}
733+
}
692734
// Tabs
693735
if (theme = 0) draw_sprite_ext(spr_tabbar, 0, 0, 0, rw, 1, 0, -1, 1)
694736
tab_x = 1
@@ -782,7 +824,7 @@ if (playing = 0) record = 0
782824
draw_separator(xx, 26) xx += 4
783825
for (a = 0; a < ds_list_size(instrument_list); a += 1) {
784826
var ins = instrument_list[| a];
785-
if (draw_icon(icons.INS_1 + a, xx, "Change instrument to " + ins.name, 0, instrument = ins)) {play_sound(ins, selected_key, 1) instrument = ins} xx += 25
827+
if (draw_icon(icons.INS_1 + a, xx, "Change instrument to " + ins.name, 0, instrument = ins)) {play_sound(ins, selected_key, 1,100) instrument = ins} xx += 25
786828
}
787829
xx += 4 draw_separator(xx, 26) xx += 4
788830
while (1) {
@@ -924,7 +966,7 @@ if (a && window = 0) {
924966
if (window = w_dragtempo) {
925967
curs = cr_size_ns
926968
tempodrag += 0.25 * (mouse_yprev - mouse_y) / 3
927-
tempodrag = median(0.25, tempodrag, 20)
969+
tempodrag = median(0.25, tempodrag, 30)
928970
a = tempo
929971
tempo = floor(tempodrag * 4) / 4
930972
if (a != tempo) changed = 1
Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
1-
//dat_generate(name)
2-
//Returns: string
3-
var o, objective, str, note, instrument, pitch, tick, source, name
4-
o = obj_controller
5-
objective = o.dat_obj
6-
source = o.dat_source
7-
name = argument0
8-
str = "scoreboard players add @s " + objective + " 1" + br
9-
tick = 1
10-
11-
for (a = 0; a <= o.enda; a ++) {
12-
if (o.colamount[a] > 0) {
13-
for (b = 0; b <= o.collast[a]; b += 1) {
14-
if (o.song_exists[a, b] && (o.lockedlayer[b] = 0 || o.dat_includelocked)) {
15-
if (o.song_key[a, b] > 32 && o.song_key[a, b] < 58) {
16-
instrument = dat_instrument(ds_list_find_index(other.instrument_list, o.song_ins[a, b]))
17-
pitch = dat_pitch(o.song_key[a, b])
18-
19-
//Add command to result
20-
if(o.dat_enableradius) str += "execute at @s[scores={"+objective+"="+string(tick)+"}] run playsound "+ instrument +" "+source+" @a ~ ~ ~ " + string(o.dat_radiusvalue) + " " + string(pitch) + br
21-
else str += "playsound "+ instrument +" "+source+" @s[scores={"+objective+"="+string(tick)+"}] ~ ~ ~ 1 "+ string(pitch) + " 1" + br
22-
}
23-
}
24-
}
25-
}
26-
tick += o.dat_tempo
27-
}
28-
str += "execute if score @s "+objective+" matches "+string(tick)+" run function "+ name +":stop"
1+
//dat_generate(name)
2+
//Returns: string
3+
var o, s, objective, str, note, instrument, pitch, tick, source, name, blockvolume, blockposition
4+
o = obj_controller
5+
objective = o.dat_obj
6+
source = o.dat_source
7+
name = argument0
8+
str = "scoreboard players add @s " + objective + " 1" + br
9+
tick = 1
10+
for (a = 0; a <= o.enda; a ++) {
11+
if (o.colamount[a] > 0) {
12+
for (b = 0; b <= o.collast[a]; b += 1) {
13+
if (o.song_exists[a, b] && (o.lockedlayer[b] = 0 || o.dat_includelocked)) {
14+
if (o.song_key[a, b] > 32 && o.song_key[a, b] < 58) {
15+
instrument = dat_instrument(ds_list_find_index(other.instrument_list, o.song_ins[a, b]))
16+
pitch = dat_pitch(o.song_key[a, b])
17+
blockvolume = o.layervol[b]/100
18+
s = o.layerstereo[b] // Stereo values to X coordinates
19+
if s > 100 blockposition=(s-100)/-100
20+
if s = 100 blockposition=0
21+
if s < 100 blockposition=((s-100)*-1)/100
22+
23+
//Add command to result
24+
if(o.dat_enableradius) str += "execute at @s[scores={"+objective+"="+string(tick)+"}] run playsound "+ instrument +" "+source+" @a ~ ~ ~ " + string(o.dat_radiusvalue) + " " + string(pitch) + br
25+
else str += "playsound "+ instrument +" "+source+" @s[scores={"+objective+"="+string(tick)+"}] ^" + string(blockposition*2) + " ^ ^ "+string(blockvolume)+ " " + string(pitch) + " 1" + br
26+
}
27+
}
28+
}
29+
}
30+
tick += o.dat_tempo
31+
}
32+
str += "execute if score @s "+objective+" matches "+string(tick)+" run function "+ name +":stop"
2933
return str

scripts/dat_generate/dat_generate.yy

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

0 commit comments

Comments
 (0)