let se_alert = GetCurrentScriptDirectory ~ "./../../Sound/se_alert00.wav";
let se_alert2 = GetCurrentScriptDirectory ~ "./../../Sound/se_alert01.wav";
let se_alien = GetCurrentScriptDirectory ~ "./../../Sound/se_alien.wav";
let se_astral = GetCurrentScriptDirectory ~ "./../../Sound/se_astralup.wav";
let se_bexplode = GetCurrentScriptDirectory ~ "./../../Sound/se_bigexplode.wav";
let se_bomb = GetCurrentScriptDirectory ~ "./../../Sound/se_bomb.wav";
let se_bonus = GetCurrentScriptDirectory ~ "./../../Sound/se_bonus.wav";
let se_bonus2 = GetCurrentScriptDirectory ~ "./../../Sound/se_bonus02.wav";
let se_boon = GetCurrentScriptDirectory ~ "./../../Sound/se_boon00.wav";
let se_boon2 = GetCurrentScriptDirectory ~ "./../../Sound/se_boon01.wav";
let se_border = GetCurrentScriptDirectory ~ "./../../Sound/se_border.wav";
let se_cardget = GetCurrentScriptDirectory ~ "./../../Sound/se_cardget.wav";
let se_cat = GetCurrentScriptDirectory ~ "./../../Sound/se_cat.wav";
let se_ch = GetCurrentScriptDirectory ~ "./../../Sound/se_ch00.wav";
let se_ch2 = GetCurrentScriptDirectory ~ "./../../Sound/se_ch01.wav";
let se_chitem = GetCurrentScriptDirectory ~ "./../../Sound/se_changeitem.wav";
let se_chup = GetCurrentScriptDirectory ~ "./../../Sound/se_chargeup.wav";
let se_crystal = GetCurrentScriptDirectory ~ "./../../Sound/se_crystal.wav";
let se_damage = GetCurrentScriptDirectory ~ "./../../Sound/se_damage00.wav";
let se_damage2 = GetCurrentScriptDirectory ~ "./../../Sound/se_damage01.wav";
let se_don = GetCurrentScriptDirectory ~ "./../../Sound/se_don00.wav";
let se_enep1 = GetCurrentScriptDirectory ~ "./../../Sound/se_enep00.wav";
let se_enep2 = GetCurrentScriptDirectory ~ "./../../Sound/se_enep01.wav";
let se_enep3 = GetCurrentScriptDirectory ~ "./../../Sound/se_enep02.wav";
let se_enep4 = GetCurrentScriptDirectory ~ "./../../Sound/se_enep03.wav";
let se_attack = GetCurrentScriptDirectory ~ "./../../Sound/se_exattack.wav";
let se_explode = GetCurrentScriptDirectory ~ "./../../Sound/se_explode.wav";
let se_extend = GetCurrentScriptDirectory ~ "./../../Sound/se_extend.wav";
let se_fault = GetCurrentScriptDirectory ~ "./../../Sound/se_fault.wav";
let se_focus = GetCurrentScriptDirectory ~ "./../../Sound/se_focus.wav";
let se_focusrot = GetCurrentScriptDirectory ~ "./../../Sound/se_focusrot.wav";
let se_getspell = GetCurrentScriptDirectory ~ "./../../Sound/se_getspell.wav";
let se_gosp = GetCurrentScriptDirectory ~ "./../../Sound/se_gosp.wav";
let se_graze = GetCurrentScriptDirectory ~ "./../../Sound/se_graze.wav";
let se_heal = GetCurrentScriptDirectory ~ "./../../Sound/se_heal.wav";
let se_ice = GetCurrentScriptDirectory ~ "./../../Sound/se_ice.wav";
let se_invalid = GetCurrentScriptDirectory ~ "./../../Sound/se_invalid.wav";
let se_item = GetCurrentScriptDirectory ~ "./../../Sound/se_item00.wav";
let se_item2 = GetCurrentScriptDirectory ~ "./../../Sound/se_item01.wav";
let se_kira = GetCurrentScriptDirectory ~ "./../../Sound/se_kira00.wav";
let se_kira2 = GetCurrentScriptDirectory ~ "./../../Sound/se_kira01.wav";
let se_kira3 = GetCurrentScriptDirectory ~ "./../../Sound/se_kira02.wav";
let se_lazer = GetCurrentScriptDirectory ~ "./../../Sound/se_lazer00.wav";
let se_lazer2 = GetCurrentScriptDirectory ~ "./../../Sound/se_lazer01.wav";
let se_lgods1 = GetCurrentScriptDirectory ~ "./../../Sound/se_lgods1.wav";
let se_lgods2 = GetCurrentScriptDirectory ~ "./../../Sound/se_lgods2.wav";
let se_lgods3 = GetCurrentScriptDirectory ~ "./../../Sound/se_lgods3.wav";
let se_lgods4 = GetCurrentScriptDirectory ~ "./../../Sound/se_lgods4.wav";
let se_godsget = GetCurrentScriptDirectory ~ "./../../Sound/se_lgodsget.wav";
let se_nodamage = GetCurrentScriptDirectory ~ "./../../Sound/se_nodamage.wav";
let se_noise = GetCurrentScriptDirectory ~ "./../../Sound/se_noise.wav";
let se_ophide = GetCurrentScriptDirectory ~ "./../../Sound/se_ophide.wav";
let se_opshow = GetCurrentScriptDirectory ~ "./../../Sound/se_opshow.wav";
let se_option = GetCurrentScriptDirectory ~ "./../../Sound/se_option.wav";
let se_pagoda = GetCurrentScriptDirectory ~ "./../../Sound/se_pagoda.wav";
let se_pause = GetCurrentScriptDirectory ~ "./../../Sound/se_pause.wav";
let se_playershot = GetCurrentScriptDirectory ~ "./../../Sound/se_playershot.wav";
let se_pldead = GetCurrentScriptDirectory ~ "./../../Sound/se_pldead00.wav";
let se_plst = GetCurrentScriptDirectory ~ "./../../Sound/se_plst00.wav";
let se_power = GetCurrentScriptDirectory ~ "./../../Sound/se_power0.wav";
let se_power2 = GetCurrentScriptDirectory ~ "./../../Sound/se_power1.wav";
let se_schutter = GetCurrentScriptDirectory ~ "./../../Sound/se_shutter.wav";
let se_slash = GetCurrentScriptDirectory ~ "./../../Sound/se_slash.wav";
let se_spell = GetCurrentScriptDirectory ~ "./../../Sound/se_spellcard.wav";
let se_tan = GetCurrentScriptDirectory ~ "./../../Sound/se_tan00.wav";
let se_tan2 = GetCurrentScriptDirectory ~ "./../../Sound/se_tan01.wav";
let se_tan3 = GetCurrentScriptDirectory ~ "./../../Sound/se_tan02.wav";
let se_tan4 = GetCurrentScriptDirectory ~ "./../../Sound/se_tan03.wav";
let se_timeout = GetCurrentScriptDirectory ~ "./../../Sound/se_timeout.wav";
let se_timeout2 = GetCurrentScriptDirectory ~ "./../../Sound/se_timeout2.wav";
let se_timestop = GetCurrentScriptDirectory ~ "./../../Sound/se_timestop0.wav";
let se_ufo = GetCurrentScriptDirectory ~ "./../../Sound/se_ufo.wav";
let se_ufoalert = GetCurrentScriptDirectory ~ "./../../Sound/se_ufoalert.wav";
let se_warpl = GetCurrentScriptDirectory ~ "./../../Sound/se_warpl.wav";
let se_water = GetCurrentScriptDirectory ~ "./../../Sound/se_water.wav";
let se_wind = GetCurrentScriptDirectory ~ "./../../Sound/se_wind.wav";
let se_ok = GetCurrentScriptDirectory ~ "./../../Sound/se_ok00.wav";
let se_select = GetCurrentScriptDirectory ~ "./../../Sound/se_select00.wav";
let se_cancel = GetCurrentScriptDirectory ~ "./../../Sound/se_cancel00.wav";

//BGM
let menu = GetCurrentScriptDirectory ~ "./../../Music/Title Theme- Super-Ancient Lifeblood.ogg";
let boss = GetCurrentScriptDirectory ~ "./../../Music/Miyako's Theme- Crystal Flower Lantern's Mysterious Guide ~ Crystal Lantern.ogg";
let stage = GetCurrentScriptDirectory ~ "./../../Music/Extra Stage Theme- Lit Road of the Seven-Coloured Light.ogg";

let array_sounds = [se_alert,se_alert2,se_alien,se_astral,se_bexplode,se_bomb,se_bonus,se_bonus2,se_boon,se_boon2,
		se_border,se_cardget,se_cat,se_ch,se_ch2,se_chitem,se_chup,se_crystal,se_damage,se_damage2,se_don,
		se_enep1,se_enep2,se_enep3,se_enep4,se_attack,se_explode,se_extend,se_fault,se_focus,se_focusrot,
		se_getspell,se_gosp,se_graze,se_heal,se_ice,se_invalid,se_item,se_item2,se_kira,se_kira2,se_kira3,
		se_lazer,se_lazer2,se_lgods1,se_lgods2,se_lgods3,se_lgods4,se_godsget,se_nodamage,se_noise,
		se_ophide,se_opshow,se_option,se_pagoda,se_pause,se_playershot,se_pldead,se_plst,se_power,se_power2,
		se_schutter,se_slash,se_spell,se_tan,se_tan2,se_tan3,se_tan4,se_timeout,se_timeout2,se_timestop,se_ufo,
		se_ufoalert,se_warpl,se_water,se_wind,se_ok,se_select,se_cancel];
let array_musics = [menu,stage,boss];

let musicARRAY = [
	ME("",0,0),
	ME(stage,100452,10672200),
	ME(boss,96000,6793798),
	ME(menu,0,5779584)];

function PlayMusic(id){
	NotifyEventAll(EV_USER+104,id);
	SetAreaCommonData("MUSIC","Song",id);
	SaveCommonDataAreaA1("MUSIC");}
function StopMusic(id){
	NotifyEventAll(EV_USER+1040,id);}
function musicRestartEnable(id,type){ 
	NotifyEventAll(EV_USER+100,[id,type]);}

task LoadSounds{
	let se = ObjSound_Create();
	ascent(i in 0..length(array_sounds)){
		ObjSound_Load(se, array_sounds[i]);}}
		
task LoadMusics{
	let se = ObjSound_Create();
	ascent(i in 0..length(array_musics)){
		ObjSound_Load(se, array_musics[i]);}}

function SE(path){
	let se = ObjSound_Create();
	ObjSound_Load(se, path);
	ObjSound_SetLoopEnable(se, false);
	ObjSound_SetVolumeRate(se, 90);
	ObjSound_SetSoundDivision(se, SOUND_SE);
	ObjSound_Play(se);
	return se;}

function ME(path,start,end){
	let se2 = ObjSound_Create();
	ObjSound_Load(se2, path);
	ObjSound_SetLoopEnable(se2,true);
	ObjSound_SetLoopSampleCount(se2,start,end);
	ObjSound_SetVolumeRate(se2, 100);
	ObjSound_SetSoundDivision(se2, SOUND_BGM);
	return se2;}