|
1 | 1 | function control_draw() { |
2 | 2 | // 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; |
4 | 5 |
|
5 | 6 | var checkplaying = playing - playing_prev |
6 | 7 | playing_prev = playing |
@@ -224,40 +225,47 @@ function control_draw() { |
224 | 225 | } |
225 | 226 | } |
226 | 227 | } |
227 | | - if (mousewheel = 1 && window = 0 && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) { |
228 | | - var insindex = ds_list_find_index(current_song.instrument_list, current_song.instrument) |
229 | | - if (mouse_wheel_down_dynamic() && insindex > 0) { |
230 | | - insindex-- |
231 | | - current_song.instrument = current_song.instrument_list[| insindex] |
232 | | - selected_vel = 100 |
233 | | - selected_pan = 100 |
234 | | - selected_pit = 0 |
235 | | - play_sound(current_song.instrument, selected_key, 100 ,100, 0) |
236 | | - } |
237 | | - if (mouse_wheel_up_dynamic() && insindex < ds_list_size(current_song.instrument_list) - 1) { |
238 | | - insindex++ |
239 | | - current_song.instrument = current_song.instrument_list[| insindex] |
240 | | - selected_vel = 100 |
241 | | - selected_pan = 100 |
242 | | - selected_pit = 0 |
243 | | - play_sound(current_song.instrument, selected_key, 100 ,100, 0) |
244 | | - } |
245 | | - } |
246 | | - if (mousewheel = 2 && window = 0 && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) { |
247 | | - if (mouse_wheel_down_dynamic() && selected_key > 0) { |
248 | | - selected_key -= 1 |
249 | | - selected_vel = 100 |
250 | | - selected_pan = 100 |
251 | | - selected_pit = 0 |
252 | | - play_sound(current_song.instrument, selected_key, 100 ,100, 0) |
253 | | - } |
254 | | - if (mouse_wheel_up_dynamic() && selected_key < 87) { |
255 | | - selected_key += 1 |
256 | | - selected_vel = 100 |
257 | | - selected_pan = 100 |
258 | | - selected_pit = 0 |
259 | | - play_sound(current_song.instrument, selected_key, 100 ,100, 0) |
260 | | - } |
| 228 | + |
| 229 | + // scroll to change the instument or key if enabled. Also check if user scrolled before continue |
| 230 | + if (window = 0 && (mouse_wheel_down_dynamic() || mouse_wheel_up_dynamic()) && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) { |
| 231 | + |
| 232 | + selected_vel = 100 |
| 233 | + selected_pan = 100 |
| 234 | + selected_pit = 0 |
| 235 | + |
| 236 | + var insindex = ds_list_find_index(current_song.instrument_list, current_song.instrument) |
| 237 | + |
| 238 | + if (mouse_wheel_down_dynamic()) { |
| 239 | + if (mousewheel = 1 && insindex > 0) { |
| 240 | + insindex-- |
| 241 | + current_song.instrument = current_song.instrument_list[| insindex] |
| 242 | + } |
| 243 | + |
| 244 | + if (mousewheel = 2 && selected_key > 0) { |
| 245 | + selected_key -= 1 |
| 246 | + } |
| 247 | + } |
| 248 | + |
| 249 | + if (mouse_wheel_up_dynamic()) { |
| 250 | + if (mousewheel = 1 && insindex < ds_list_size(current_song.instrument_list) - 1) { |
| 251 | + insindex++ |
| 252 | + current_song.instrument = current_song.instrument_list[| insindex] |
| 253 | + } |
| 254 | + |
| 255 | + if (mousewheel = 2 && selected_key < 87) { |
| 256 | + selected_key += 1 |
| 257 | + } |
| 258 | + } |
| 259 | + |
| 260 | + preview_vol = |
| 261 | + (selby >= 0 && selby <= current_song.endb && layerhov_vppreview) |
| 262 | + ? (songs[song].layervol[selby] / 100 ) * selected_vel : 100 |
| 263 | + |
| 264 | + preview_pan = |
| 265 | + (selby >= 0 && selby <= current_song.endb && layerhov_vppreview) |
| 266 | + ? (songs[song].layerstereo[selby] + selected_pan) / 2 : 100 |
| 267 | + |
| 268 | + play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, 0) |
261 | 269 | } |
262 | 270 |
|
263 | 271 | // Draw note blocks |
@@ -475,12 +483,15 @@ function control_draw() { |
475 | 483 | selected_vel = current_song.song_vel[selbx, selby] |
476 | 484 | selected_pan = current_song.song_pan[selbx, selby] |
477 | 485 | selected_pit = current_song.song_pit[selbx, selby] |
| 486 | + |
| 487 | + preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel |
| 488 | + preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2 |
478 | 489 | } else { |
479 | 490 | selected_vel = 100 |
480 | 491 | selected_pan = 100 |
481 | 492 | selected_pit = 0 |
482 | 493 | } |
483 | | - play_sound(current_song.instrument, selected_key, selected_vel, selected_pan, selected_pit) |
| 494 | + play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, selected_pit) |
484 | 495 | } |
485 | 496 |
|
486 | 497 | } |
|
0 commit comments