@@ -225,68 +225,47 @@ function control_draw() {
225225 }
226226 }
227227 }
228- if (mousewheel = 1 && window = 0 && (exist = 0 || changepitch = 0 ) && !isplayer && !volume_scroll) {
229- var insindex = ds_list_find_index (current_song.instrument_list , current_song.instrument )
230- if (mouse_wheel_down_dynamic () && insindex > 0 ) {
231- insindex--
232- current_song.instrument = current_song.instrument_list [| insindex]
233- selected_vel = 100
234- selected_pan = 100
235- selected_pit = 0
236-
237- preview_vol = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
238- ? (songs[song].layervol [selby] / 100 ) * selected_vel : 100
239228
240- preview_pan = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
241- ? (songs[song].layerstereo [selby] + selected_pan) / 2 : 100
242-
243- play_sound (current_song.instrument , selected_key, preview_vol, preview_pan, 0 )
244- }
245- if (mouse_wheel_up_dynamic () && insindex < ds_list_size (current_song.instrument_list ) - 1 ) {
246- insindex++
247- current_song.instrument = current_song.instrument_list [| insindex]
248- selected_vel = 100
249- selected_pan = 100
250- selected_pit = 0
251-
252- preview_vol = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
253- ? (songs[song].layervol [selby] / 100 ) * selected_vel : 100
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) {
254231
255- preview_pan = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
256- ? (songs[song].layerstereo [selby] + selected_pan) / 2 : 100
257-
258- play_sound (current_song.instrument , selected_key, preview_vol, preview_pan, 0 )
259- }
260- }
261- if (mousewheel = 2 && window = 0 && (exist = 0 || changepitch = 0 ) && !isplayer && !volume_scroll) {
262- if (mouse_wheel_down_dynamic () && selected_key > 0 ) {
263- selected_key -= 1
264- selected_vel = 100
265- selected_pan = 100
266- selected_pit = 0
267-
268- preview_vol = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
269- ? (songs[song].layervol [selby] / 100 ) * selected_vel : 100
232+ selected_vel = 100
233+ selected_pan = 100
234+ selected_pit = 0
270235
271- preview_pan = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
272- ? (songs[song].layerstereo [selby] + selected_pan) / 2 : 100
273-
274- play_sound (current_song.instrument , selected_key, preview_vol, preview_pan, 0 )
275- }
276- if (mouse_wheel_up_dynamic () && selected_key < 87 ) {
277- selected_key += 1
278- selected_vel = 100
279- selected_pan = 100
280- selected_pit = 0
281-
282- preview_vol = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
283- ? (songs[song].layervol [selby] / 100 ) * selected_vel : 100
236+ var insindex = ds_list_find_index (current_song.instrument_list , current_song.instrument )
284237
285- preview_pan = (selby >= 0 && selby <= current_song.endb && layerhov_vppreview)
286- ? (songs[song].layerstereo [selby] + selected_pan) / 2 : 100
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
287267
288- play_sound (current_song.instrument , selected_key, preview_vol, preview_pan, 0 )
289- }
268+ play_sound (current_song.instrument , selected_key, preview_vol, preview_pan, 0 )
290269 }
291270
292271 // Draw note blocks
0 commit comments