Skip to content

Commit 439c6f8

Browse files
committed
note preview when changing the key, vol and pan by scrolling over a note no longer ignores layer vol/pan
Resolves #449
1 parent 0984072 commit 439c6f8

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

scripts/add_block_manual/add_block_manual.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function add_block_manual(argument0, argument1, argument2, argument3, argument4,
6868
if (xx >= songs[song].enda) songs[song].enda = xx
6969
if (yy >= songs[song].endb) songs[song].endb = yy
7070

71-
if (ins.loaded) play_sound(ins, key, vel, pan, pit)
71+
if (ins.loaded) play_sound(ins, key, (songs[song].layervol[yy] / 100 ) * vel, (songs[song].layerstereo[yy] + pan) / 2, pit)
7272
history_set(h_addblock, xx, yy, ins, key, vel, pan, pit)
7373

7474
var insname = songs[song].instrument_list[| ds_list_find_index(songs[song].instrument_list, ins)].name

scripts/change_block_manual/change_block_manual.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function change_block_manual(argument0, argument1, argument2, argument3, argumen
2525
songs[song].song_pit[xx, yy] = pit
2626
}
2727

28-
if (ins.loaded) play_sound(ins, key, vel, pan, pit)
28+
if (ins.loaded) play_sound(ins, key, (songs[song].layervol[yy] / 100 ) * vel, (songs[song].layerstereo[yy] + pan) / 2, pit)
2929

3030
var insname = songs[song].instrument_list[| ds_list_find_index(songs[song].instrument_list, ins)].name
3131
if (insname = "Tempo Changer") {

scripts/control_draw/control_draw.gml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function control_draw() {
22
// control_draw()
3-
var a, b, c, d, e, f, g, p, l, s, exist, str, str2, m, xx, x1, y1, x2, y2, iconcolor, showmenu, totalcols, totalrows, compx, prev, colr, note_offset;
3+
var a, b, c, d, e, f, g, p, l, s, exist, str, str2, m, xx, x1, y1, x2, y2, iconcolor, showmenu, totalcols, totalrows, compx, prev, colr, note_offset,
4+
preview_pan = 100, preview_vol = 100;
45

56
var checkplaying = playing - playing_prev
67
playing_prev = playing
@@ -232,15 +233,23 @@ function control_draw() {
232233
selected_vel = 100
233234
selected_pan = 100
234235
selected_pit = 0
235-
play_sound(current_song.instrument, selected_key, 100 ,100, 0)
236+
237+
preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel
238+
preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2
239+
240+
play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, 0)
236241
}
237242
if (mouse_wheel_up_dynamic() && insindex < ds_list_size(current_song.instrument_list) - 1) {
238243
insindex++
239244
current_song.instrument = current_song.instrument_list[| insindex]
240245
selected_vel = 100
241246
selected_pan = 100
242247
selected_pit = 0
243-
play_sound(current_song.instrument, selected_key, 100 ,100, 0)
248+
249+
preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel
250+
preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2
251+
252+
play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, 0)
244253
}
245254
}
246255
if (mousewheel = 2 && window = 0 && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) {
@@ -249,14 +258,22 @@ function control_draw() {
249258
selected_vel = 100
250259
selected_pan = 100
251260
selected_pit = 0
252-
play_sound(current_song.instrument, selected_key, 100 ,100, 0)
261+
262+
preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel
263+
preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2
264+
265+
play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, 0)
253266
}
254267
if (mouse_wheel_up_dynamic() && selected_key < 87) {
255268
selected_key += 1
256269
selected_vel = 100
257270
selected_pan = 100
258271
selected_pit = 0
259-
play_sound(current_song.instrument, selected_key, 100 ,100, 0)
272+
273+
preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel
274+
preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2
275+
276+
play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, 0)
260277
}
261278
}
262279

@@ -475,12 +492,15 @@ function control_draw() {
475492
selected_vel = current_song.song_vel[selbx, selby]
476493
selected_pan = current_song.song_pan[selbx, selby]
477494
selected_pit = current_song.song_pit[selbx, selby]
495+
496+
preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel
497+
preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2
478498
} else {
479499
selected_vel = 100
480500
selected_pan = 100
481501
selected_pit = 0
482502
}
483-
play_sound(current_song.instrument, selected_key, selected_vel, selected_pan, selected_pit)
503+
play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, selected_pit)
484504
}
485505

486506
}

0 commit comments

Comments
 (0)