diff --git a/scripts/add_block_manual/add_block_manual.gml b/scripts/add_block_manual/add_block_manual.gml index ae1a48df..d2f3aae0 100644 --- a/scripts/add_block_manual/add_block_manual.gml +++ b/scripts/add_block_manual/add_block_manual.gml @@ -68,7 +68,7 @@ function add_block_manual(argument0, argument1, argument2, argument3, argument4, if (xx >= songs[song].enda) songs[song].enda = xx if (yy >= songs[song].endb) songs[song].endb = yy - if (ins.loaded) play_sound(ins, key, vel, pan, pit) + if (ins.loaded) play_sound(ins, key, (songs[song].layervol[yy] / 100 ) * vel, (songs[song].layerstereo[yy] + pan) / 2, pit) history_set(h_addblock, xx, yy, ins, key, vel, pan, pit) var insname = songs[song].instrument_list[| ds_list_find_index(songs[song].instrument_list, ins)].name diff --git a/scripts/change_block_manual/change_block_manual.gml b/scripts/change_block_manual/change_block_manual.gml index 71b18227..c5d1bce4 100644 --- a/scripts/change_block_manual/change_block_manual.gml +++ b/scripts/change_block_manual/change_block_manual.gml @@ -25,7 +25,7 @@ function change_block_manual(argument0, argument1, argument2, argument3, argumen songs[song].song_pit[xx, yy] = pit } - if (ins.loaded) play_sound(ins, key, vel, pan, pit) + if (ins.loaded) play_sound(ins, key, (songs[song].layervol[yy] / 100 ) * vel, (songs[song].layerstereo[yy] + pan) / 2, pit) var insname = songs[song].instrument_list[| ds_list_find_index(songs[song].instrument_list, ins)].name if (insname = "Tempo Changer") { diff --git a/scripts/control_create/control_create.gml b/scripts/control_create/control_create.gml index 6ebaa1d9..bb951dc2 100644 --- a/scripts/control_create/control_create.gml +++ b/scripts/control_create/control_create.gml @@ -395,6 +395,7 @@ function control_create() { mousewheel = 0 changepitch = 1 + layerhov_vppreview = 0 keynames = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]; keynames_flat = 0 diff --git a/scripts/control_draw/control_draw.gml b/scripts/control_draw/control_draw.gml index 74314265..5cafcb1c 100644 --- a/scripts/control_draw/control_draw.gml +++ b/scripts/control_draw/control_draw.gml @@ -1,6 +1,7 @@ function control_draw() { // control_draw() - 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; + 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, + preview_pan = 100, preview_vol = 100; var checkplaying = playing - playing_prev playing_prev = playing @@ -224,40 +225,47 @@ function control_draw() { } } } - if (mousewheel = 1 && window = 0 && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) { - var insindex = ds_list_find_index(current_song.instrument_list, current_song.instrument) - if (mouse_wheel_down_dynamic() && insindex > 0) { - insindex-- - current_song.instrument = current_song.instrument_list[| insindex] - selected_vel = 100 - selected_pan = 100 - selected_pit = 0 - play_sound(current_song.instrument, selected_key, 100 ,100, 0) - } - if (mouse_wheel_up_dynamic() && insindex < ds_list_size(current_song.instrument_list) - 1) { - insindex++ - current_song.instrument = current_song.instrument_list[| insindex] - selected_vel = 100 - selected_pan = 100 - selected_pit = 0 - play_sound(current_song.instrument, selected_key, 100 ,100, 0) - } - } - if (mousewheel = 2 && window = 0 && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) { - if (mouse_wheel_down_dynamic() && selected_key > 0) { - selected_key -= 1 - selected_vel = 100 - selected_pan = 100 - selected_pit = 0 - play_sound(current_song.instrument, selected_key, 100 ,100, 0) - } - if (mouse_wheel_up_dynamic() && selected_key < 87) { - selected_key += 1 - selected_vel = 100 - selected_pan = 100 - selected_pit = 0 - play_sound(current_song.instrument, selected_key, 100 ,100, 0) - } + + // scroll to change the instument or key if enabled. Also check if user scrolled before continue + if (window = 0 && (mouse_wheel_down_dynamic() || mouse_wheel_up_dynamic()) && (exist = 0 || changepitch = 0) && !isplayer && !volume_scroll) { + + selected_vel = 100 + selected_pan = 100 + selected_pit = 0 + + var insindex = ds_list_find_index(current_song.instrument_list, current_song.instrument) + + if (mouse_wheel_down_dynamic()) { + if (mousewheel = 1 && insindex > 0) { + insindex-- + current_song.instrument = current_song.instrument_list[| insindex] + } + + if (mousewheel = 2 && selected_key > 0) { + selected_key -= 1 + } + } + + if (mouse_wheel_up_dynamic()) { + if (mousewheel = 1 && insindex < ds_list_size(current_song.instrument_list) - 1) { + insindex++ + current_song.instrument = current_song.instrument_list[| insindex] + } + + if (mousewheel = 2 && selected_key < 87) { + selected_key += 1 + } + } + + preview_vol = + (selby >= 0 && selby <= current_song.endb && layerhov_vppreview) + ? (songs[song].layervol[selby] / 100 ) * selected_vel : 100 + + preview_pan = + (selby >= 0 && selby <= current_song.endb && layerhov_vppreview) + ? (songs[song].layerstereo[selby] + selected_pan) / 2 : 100 + + play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, 0) } // Draw note blocks @@ -475,12 +483,15 @@ function control_draw() { selected_vel = current_song.song_vel[selbx, selby] selected_pan = current_song.song_pan[selbx, selby] selected_pit = current_song.song_pit[selbx, selby] + + preview_vol = (songs[song].layervol[selby] / 100 ) * selected_vel + preview_pan = (songs[song].layerstereo[selby] + selected_pan) / 2 } else { selected_vel = 100 selected_pan = 100 selected_pit = 0 } - play_sound(current_song.instrument, selected_key, selected_vel, selected_pan, selected_pit) + play_sound(current_song.instrument, selected_key, preview_vol, preview_pan, selected_pit) } } diff --git a/scripts/draw_window_preferences/draw_window_preferences.gml b/scripts/draw_window_preferences/draw_window_preferences.gml index 4f95e7e0..9d980171 100644 --- a/scripts/draw_window_preferences/draw_window_preferences.gml +++ b/scripts/draw_window_preferences/draw_window_preferences.gml @@ -532,6 +532,7 @@ function draw_window_preferences() { if (draw_radiobox(x1 + 40, y1 + 110 + (theme = 3) * 22, mousewheel = 1, "Use mouse wheel to change instrument", "Use the mouse wheel to toggle between\nthe available instruments.")) mousewheel = 1 if (draw_radiobox(x1 + 40, y1 + 130 + (theme = 3) * 22, mousewheel = 2, "Use mouse wheel to change key", "Use the mouse wheel to toggle\nbetween the keys on the piano.")) mousewheel = 2 if (draw_checkbox(x1 + 40, y1 + 158 + (theme = 3) * 22, changepitch, "Change note properties when scrolling over notes", "Whether scrolling when hovering over a note should change its key,\nvelocity, panning or pitch, according to the currently selected edit mode.")) changepitch=!changepitch + if (draw_checkbox(x1 + 40, y1 + 178 + (theme = 3) * 22, layerhov_vppreview , "Apply hovered layer's volume and panning to note preview sounds", "Whether the preview sound's volume and panning should be\nrelative to the layer the mouse is hovering over.")) layerhov_vppreview =!layerhov_vppreview //draw_text_dynamic(x1 + 40, y1 + 178, "Tip: Hold Shift while scrolling over a note to change a whole octave,\nor fine-tune its velocity, panning or pitch.") if (theme = 3) draw_theme_font(font_info_med) draw_areaheader(x1 + 22, y1 + 220 + (theme = 3) * 22, 456, 105, "Piano") @@ -549,6 +550,7 @@ function draw_window_preferences() { if (draw_radiobox(x1 + 40, y1 + 110 + (theme = 3) * 22, mousewheel = 1, "使用鼠标滚轮改变音色", "使用鼠标滚轮切换可用音色。")) mousewheel = 1 if (draw_radiobox(x1 + 40, y1 + 130 + (theme = 3) * 22, mousewheel = 2, "使用鼠标滚轮改变音调", "使用鼠标滚轮改变目前使用的音调。")) mousewheel = 2 if (draw_checkbox(x1 + 40, y1 + 158 + (theme = 3) * 22, changepitch, "当在音符上使用鼠标滚轮改变音符属性", "在音符上使用鼠标滚轮时是否根据目前模式改变其音调、音量、声道或音高。")) changepitch=!changepitch + if (draw_checkbox(x1 + 40, y1 + 178 + (theme = 3) * 22, layerhov_vppreview , "将悬停图层的音量和声像调整应用于音符预览声音", "预览声音的音量和声像定位是否应与鼠标悬停的图层相关。")) layerhov_vppreview =!layerhov_vppreview //draw_text_dynamic(x1 + 40, y1 + 178, "Tip: Hold Shift while scrolling over a note to change a whole octave,\nor fine-tune its velocity, panning or pitch.") if (theme = 3) draw_theme_font(font_info_med) draw_areaheader(x1 + 22, y1 + 220 + (theme = 3) * 22, 456, 105, "琴键") diff --git a/scripts/load_settings/load_settings.gml b/scripts/load_settings/load_settings.gml index 9a74191f..eb327ba8 100644 --- a/scripts/load_settings/load_settings.gml +++ b/scripts/load_settings/load_settings.gml @@ -47,6 +47,7 @@ function load_settings() { show_outofrange = ini_read_real( "preferences", "show_outofrange", show_outofrange) mousewheel = ini_read_real( "preferences", "mousewheel", mousewheel) changepitch = ini_read_real( "preferences", "change_pitch", changepitch) + layerhov_vppreview = ini_read_real( "preferences", "layerhov_vppreview", layerhov_vppreview) select_lastpressed = ini_read_real( "preferences", "select_lastpressed", select_lastpressed) marker_follow = ini_read_real( "preferences", "marker_follow", marker_follow) marker_pagebypage = ini_read_real( "preferences", "marker_pagebypage", marker_pagebypage) diff --git a/scripts/save_settings/save_settings.gml b/scripts/save_settings/save_settings.gml index 3c1f210d..8ea34215 100644 --- a/scripts/save_settings/save_settings.gml +++ b/scripts/save_settings/save_settings.gml @@ -45,6 +45,7 @@ function save_settings() { ini_write_real_clean("preferences", "show_outofrange", show_outofrange) ini_write_real_clean("preferences", "mousewheel", mousewheel) ini_write_real_clean("preferences", "change_pitch", changepitch) + ini_write_real_clean("preferences", "layerhov_vppreview", layerhov_vppreview) ini_write_real_clean("preferences", "select_lastpressed", select_lastpressed) ini_write_real_clean("preferences", "marker_follow", marker_follow) ini_write_real_clean("preferences", "marker_pagebypage", marker_pagebypage)