eastern-flames/eastern flames/scripts/music_set/music_set.gml

24 lines
640 B
Plaintext
Raw Normal View History

2022-08-07 21:14:04 +00:00
function music_set(music, face=MUSFACE.FRONT, swaptype=MUSSWAP.INSTANT) {
if music == global.playingmusic {
global.playingmusictime = audio_sound_get_track_position(global.playingmusicdata);
audio_stop_sound(global.playingmusicdata);
global.playingmusicdata = audio_play_sound(music.audio[face], 0, true);
audio_sound_set_track_position(global.playingmusicdata, global.playingmusictime);
} else {
global.playingmusic = music;
audio_stop_sound(global.playingmusicdata);
global.playingmusicdata = audio_play_sound(music.audio[face], 0, true);
}
}
enum MUSSWAP {
INSTANT,
FADE,
GLITCH,
}
enum MUSFACE {
FRONT,
BACK,
}