Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/GameMaker2Projects/v17/.suo
Binary file not shown.
7 changes: 7 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\H:\\GameMaker2Projects",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
13 changes: 7 additions & 6 deletions Minecraft Note Block Studio.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion options/main/options_main.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/windows/options_windows.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rooms/rm_app/rm_app.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions scripts/control_draw/control_draw.gml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,28 @@ function control_draw() {
}
}
}


//FollowAlong music control
if(variable_global_exists("followalongPlayingSound")&&!is_undefined("followalongPlayingSound")){
if(!variable_global_exists("followalongPaused")) global.followalongPaused = 0
if(!variable_global_exists("followalongPlayingSound")) global.followalongPlayingSound = undefined
if(playing = 1 && global.followalongPaused = 0){
if(is_undefined(global.followalongPlayingSound)){
global.followalongPlayingSound = audio_play_sound(global.followalongSound,10,false)
audio_sound_set_track_position(global.followalongPlayingSound, marker_pos/tempo);
}
}else{
if(!is_undefined(global.followalongPlayingSound)){
audio_stop_sound(global.followalongPlayingSound);
global.followalongPlayingSound = undefined;
}
}
}




if (window = w_dragselection) {
selection_x = starta + floor((mouse_x - (x1 + 2)) / 32) - select_pressa
selection_y = startb + floor((mouse_y - (y1 + 34)) / 32) - select_pressb
Expand Down Expand Up @@ -700,6 +722,12 @@ function control_draw() {
marker_prevpos = 0
}
if (keyboard_check_pressed(vk_space)) toggle_playing(totalcols) timestoloop = real(loopmax)

//followalong keybind
if (keyboard_check(vk_shift) && !keyboard_check_pressed(ord("`"))) {
pause_followalong()
}

if (keyboard_check_pressed(vk_f1)) {
if (language != 1) open_url("http://www.youtube.com/playlist?list=PL7EA4F0D271DA6E86")
else open_url("https://www.bilibili.com/video/BV1Mx411a76p")
Expand Down Expand Up @@ -942,6 +970,8 @@ function control_draw() {
timestoloop --
starta = loopstart
marker_pos = starta


metronome_played = -1
sb_val[scrollbarh] = starta
if loopmax != 0 {
Expand All @@ -950,6 +980,17 @@ function control_draw() {
timestoloop = real(loopmax)
}
}

if(variable_global_exists("followalongPlayingSound")&&!is_undefined("followalongPlayingSound")){
if(!variable_global_exists("followalongPaused")) global.followalongPaused = 0
if(!variable_global_exists("followalongPlayingSound")) global.followalongPlayingSound = undefined
if(playing = 1 && global.followalongPaused=0){
if(!is_undefined(global.followalongPlayingSound)){
audio_sound_set_track_position(global.followalongPlayingSound, marker_pos/tempo);
}
}
}

}
if (marker_pos > enda + totalcols) {
marker_pos = enda + totalcols
Expand Down Expand Up @@ -1466,6 +1507,33 @@ function control_draw() {
if (draw_tab("Help")) {
show_menu_ext("help", 109 - 30 * isplayer, 19, icon(icons.HELP) + "Tutorial videos|\\|Part 1: Composing note block music|Part 2: Opening MIDI files|Part 3: Importing songs into Minecraft|Part 4: Editing songs made in Minecraft |-|F1$View all|/|-|" + icon(icons.INTERNET) + "Website...|GitHub...|Discord server...|Report a bug...|-|Changelist...|About...")
}

if (draw_tab("FollowAlong")) {
//magic code that seems important
str = ""
customstr = ""
insmenu = 3
for (a = 0; a < ds_list_size(instrument_list); a++) {
var ins = instrument_list[| a];
if (ins.user)
customstr += check(instrument = ins) + clean(ins.name) + "|"
else{
if(a < 9){
str += check(instrument = ins) + "Ctrl+" + string((a + 1) % 10) + "$" + clean(ins.name) + "|"
}else{
str += check(instrument = ins) + " Ctrl+Shift+" + string((a + 2) % 10) + "$" + clean(ins.name) + "|"
}
}
if (a % 25 == 0 && a > 1 && a < ds_list_size(instrument_list) - 1) {
customstr += "-|More...|\\|"
insmenu++
}
}
//end magic

//menu
show_menu_ext("followalong", 149 - 30 * isplayer, 19, icon(icons.OPEN) + "Open mp3/ogg/wav|"+icon(icons.PLAY)+"Shift+`$Pause playback"/* + "Download youtube video as mp3"*/)
}
} else {
if (draw_tab("文件")) {
str = ""
Expand Down
58 changes: 58 additions & 0 deletions scripts/load_followalong_song/load_followalong_song.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
function load_followalong_song() {
// load_song(fn [, backup])
var fn, file_ext, f, str
fn = argument[0]
if (fn = "") {
fn = string(get_open_filename_ext("Mp3 Files (*.mp3)|*.mp3|Wav Files (*.wav)|*.wav|Ogg Files (*.ogg)|*.ogg", "", songfolder, condstr(language != 1, "Load song", "打开歌曲")))
}
if (fn = "" || !file_exists_lib(fn)) return 0

file_ext = filename_ext(fn)
if (file_ext = ".mp3" || file_ext = ".wav" || file_ext = ".ogg") {
var ret = audio_file_decode(fn, temp_file);
if (ret < 0) {
if (language != 1) message("Couldn't load the file " + fn + "! Error: " + string(ret), "Error")
else message("找不到文件" + fn + "!错误代码:" + string(ret), "错误")
return 0
}

log("buffer_load")
sound_buffer_temp = buffer_load(temp_file)
sound_buffer = buffer_create(buffer_get_size(sound_buffer_temp), buffer_fixed, 2)
buffer_copy(sound_buffer_temp, 0, buffer_get_size(sound_buffer_temp), sound_buffer, 0)
global.followalongSound = audio_create_buffer_sound(sound_buffer, buffer_s16, 44100, 0, buffer_get_size(sound_buffer), audio_stereo)
buffer_delete(sound_buffer_temp)
//audio_play_sound(followalongSound, 1, false);


// file = file_bin_open(fn,0);
// size = file_bin_size(file);
// audio_buff = buffer_create(size, buffer_u8, 1);

// for(var i = 0; i < size; i++;)
// {
// buffer_write(audio_buff, buffer_u8, file_bin_read_byte(file));
// }
// file_bin_close(file);

// audio = audio_create_buffer_sound(audio_buff, buffer_u8, 44100, 0, size, audio_mono);
// audio_play_sound(audio, 1, true);




//file = file_bin_open(fn,0);
//var size = file_bin_size(file);
//var gameTransfer = buffer_create(1024, buffer_u8, 1);
//for(var i=0;i<size;i+=1;){
// buffer_write(gameTransfer,buffer_u8,file_bin_read_byte(file));
//}
//result = audio_create_buffer_sound(gameTransfer,buffer_u8,44100,0,size,audio_stereo);
//show_debug_message(size);
//audio_play_sound(result, 10, false);

//file_bin_close(file)
return 1
}
return 0
}
12 changes: 12 additions & 0 deletions scripts/load_followalong_song/load_followalong_song.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions scripts/menu_click/menu_click.gml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,29 @@ function menu_click(argument0) {
if (sel = 11) window = w_about
break
}
case "followalong": {
//if (sel = 0) load_followalong_song("")
if (sel = 0) load_followalong_song("")
if (sel = 1) pause_followalong()

/*if (language != 1) {
if (sel = 2) open_url("https://yt5s.com/en61/youtube-to-mp3")

temp solution
i would like to have it download the file and start it inside nbs but somethin something laws
and it seems to not be exactly easy to implement
(maybe run https://github.com/ytdl-org/youtube-dl somehow)

} else {
if (sel = 2) open_url("")

smth similiar here for bilibili i guess?
if they upload songs there

}*/

break
}
case "section": {
if (sel = 0) {
section_exists = 0
Expand Down
10 changes: 10 additions & 0 deletions scripts/pause_followalong/pause_followalong.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function pause_followalong(){
if(!variable_global_exists("followalongPaused")) global.followalongPaused = 0
global.followalongPaused = !global.followalongPaused

if(global.followalongPaused=1){
toggle_followalong(0,0)
}else{

}
}
12 changes: 12 additions & 0 deletions scripts/pause_followalong/pause_followalong.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions scripts/toggle_followalong/toggle_followalong.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function toggle_followalong(){
if(!variable_global_exists("followalongPaused")) global.followalongPaused = 0

if(variable_global_exists("followalongSound")){
if(global.followalongPaused=0){
var start = argument[0]
var starttime = argument[1]
if(!variable_global_exists("followalongPlayingSound")) global.followalongPlayingSound = undefined
if(!is_undefined(global.followalongPlayingSound)){
audio_stop_sound(global.followalongPlayingSound);
global.followalongPlayingSound = undefined;
}
if(start = 1){
global.followalongPlayingSound = audio_play_sound(global.followalongSound,10,false)
audio_sound_set_track_position(global.followalongPlayingSound, starttime);
}
}
}
}
12 changes: 12 additions & 0 deletions scripts/toggle_followalong/toggle_followalong.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions scripts/toggle_playing/toggle_playing.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function toggle_playing(argument0) {
// toggle_playing(cols)
var xx, a, b, c, d, e;
playing=!playing
toggle_followalong(playing,marker_pos/tempo)
if (playing = 1) {
if (marker_pos = enda + argument0) marker_pos = 0
if (marker_start && section_exists) marker_pos = section_start
Expand Down Expand Up @@ -47,6 +48,7 @@ function toggle_playing(argument0) {
if (song_ins[xx, b].loaded) play_sound(song_ins[xx, b], song_key[xx, b], c , d, e)
if (song_ins[xx, b].press) key_played[song_key[xx, b]] = current_time
song_played[xx, b] = current_time

}
}
}
Expand Down
Loading