1 |
var timeslooped; |
2 |
if (typetext == " frames") |
3 |
{ |
4 |
solotimer = audio_sound_get_track_position(solo_music) * 30; |
5 |
timeslooped = floor(audio_sound_get_track_position(solo_music) / backing_audio_length); |
6 |
backingtimer = (audio_sound_get_track_position(backing_music) * 30) + (backing_audio_length * timeslooped * 30); |
7 |
} |
8 |
if (typetext == " seconds") |
9 |
{ |
10 |
solotimer = audio_sound_get_track_position(solo_music); |
11 |
timeslooped = floor(audio_sound_get_track_position(solo_music) / backing_audio_length); |
12 |
backingtimer = audio_sound_get_track_position(backing_music) + (backing_audio_length * timeslooped); |
13 |
} |
14 |
draw_set_halign(fa_right); |
15 |
draw_set_halign(fa_left); |
16 |
draw_set_color(c_red); |
17 |
if (partfocus == 0) |
18 |
draw_set_color(c_yellow); |
19 |
draw_text(0, 20, "Solo: " + string(solotimer) + string(typetext)); |
20 |
draw_set_color(c_red); |
21 |
if (partfocus == 1) |
22 |
draw_set_color(c_yellow); |
23 |
draw_text(0, 40, "Backing: " + string(backingtimer) + typetext + "(times looped: " + string(timeslooped) + ")"); |
24 |
draw_set_halign(fa_left); |
25 |
draw_set_color(c_white); |
26 |
draw_text(0, 60, "Press left/right arrow key to make track skip backwards/forwards"); |
27 |
draw_text(0, 80, "Press up/down arrow key to change track selected"); |
28 |
draw_text(0, 100, "Press R to reset"); |
29 |
draw_text(0, 120, "Press Z to change frame count to second count"); |
30 |
draw_text(0, 140, "Press X to sync solo to backing track"); |
31 |
draw_text(0, 160, "Length1 " + string(backing_audio_length) + " Length2 " + string(main_audio_length)); |
32 |
draw_text(0, 180, string(main_audio_length / backing_audio_length)); |
33 |
partmode = -1; |
34 |
var realign = 0; |
35 |
if (partmode == -1) |
36 |
{ |
37 |
if (keyboard_check_pressed(ord("R"))) |
38 |
room_restart(); |
39 |
if (keyboard_check_pressed(ord("Z"))) |
40 |
{ |
41 |
if (typetext == " frames") |
42 |
typetext = " seconds"; |
43 |
else |
44 |
typetext = " frames"; |
45 |
} |
46 |
if (keyboard_check_pressed(ord("X"))) |
47 |
realign = 1; |
48 |
if (keyboard_check(vk_right)) |
49 |
{ |
50 |
if (partfocus == 0) |
51 |
audio_sound_set_track_position(solo_music, audio_sound_get_track_position(solo_music) + (1/30)); |
52 |
if (partfocus == 1) |
53 |
audio_sound_set_track_position(backing_music, audio_sound_get_track_position(backing_music) + (1/30)); |
54 |
} |
55 |
if (keyboard_check(vk_left)) |
56 |
{ |
57 |
if (partfocus == 0) |
58 |
audio_sound_set_track_position(solo_music, audio_sound_get_track_position(solo_music) - (1/30)); |
59 |
if (partfocus == 1) |
60 |
audio_sound_set_track_position(backing_music, audio_sound_get_track_position(backing_music) - (1/30)); |
61 |
} |
62 |
if (keyboard_check_pressed(vk_up)) |
63 |
partfocus -= 1; |
64 |
if (keyboard_check_pressed(vk_down)) |
65 |
partfocus++; |
66 |
if (partfocus < 0) |
67 |
partfocus = 1; |
68 |
if (partfocus > 1) |
69 |
partfocus = 0; |
70 |
} |
71 |
loopbuffer--; |
72 |
if (loopbuffer < 0) |
73 |
{ |
74 |
if (remlooped != timeslooped) |
75 |
{ |
76 |
realign = 1; |
77 |
loopbuffer = 10; |
78 |
} |
79 |
} |
80 |
if (realign) |
81 |
{ |
82 |
backingtimer = ceil((audio_sound_get_track_position(backing_music) * 30) + (backing_audio_length * timeslooped * 30)); |
83 |
audio_sound_set_track_position(solo_music, (backingtimer / 30) * 0.9992); |
84 |
if (timeslooped == 0) |
85 |
audio_sound_set_track_position(solo_music, 0); |
86 |
if (timeslooped == 0) |
87 |
audio_sound_set_track_position(backing_music, 0); |
88 |
scr_debug_print("realigned" + string(timeslooped)); |
89 |
} |
90 |
remlooped = timeslooped; |