let se_bexplode = GetCurrentScriptDirectory ~ "./se/se_bigexplode.wav";
let se_bomb = GetCurrentScriptDirectory ~ "./se/se_bomb.wav";
let se_bonus = GetCurrentScriptDirectory ~ "./se/se_bonus.wav";
let se_bonus2 = GetCurrentScriptDirectory ~ "./se/se_bonus02.wav";
let se_boon2 = GetCurrentScriptDirectory ~ "./se/se_boon01.wav";
let se_ch = GetCurrentScriptDirectory ~ "./se/se_ch00.wav";
let se_ch2 = GetCurrentScriptDirectory ~ "./se/se_ch01.wav";
let se_crystal = GetCurrentScriptDirectory ~ "./se/se_crystal.wav";
let se_enep1 = GetCurrentScriptDirectory ~ "./se/se_enep00.wav";
let se_enep2 = GetCurrentScriptDirectory ~ "./se/se_enep01.wav";
let se_enep3 = GetCurrentScriptDirectory ~ "./se/se_enep02.wav";
let se_enep4 = GetCurrentScriptDirectory ~ "./se/se_enep03.wav";
let se_explode = GetCurrentScriptDirectory ~ "./se/se_explode.wav";
let se_extend = GetCurrentScriptDirectory ~ "./se/se_extend.wav";
let se_fault = GetCurrentScriptDirectory ~ "./se/se_fault.wav";
let se_getspell = GetCurrentScriptDirectory ~ "./se/se_getspell.wav";
let se_graze = GetCurrentScriptDirectory ~ "./se/se_graze.wav";
let se_ice = GetCurrentScriptDirectory ~ "./se/se_ice.wav";
let se_item = GetCurrentScriptDirectory ~ "./se/se_item00.wav";
let se_item2 = GetCurrentScriptDirectory ~ "./se/se_item01.wav";
let se_kira = GetCurrentScriptDirectory ~ "./se/se_kira00.wav";
let se_kira2 = GetCurrentScriptDirectory ~ "./se/se_kira01.wav";
let se_kira3 = GetCurrentScriptDirectory ~ "./se/se_kira02.wav";
let se_lazer = GetCurrentScriptDirectory ~ "./se/se_lazer00.wav";
let se_lazer2 = GetCurrentScriptDirectory ~ "./se/se_lazer01.wav";
let se_pause = GetCurrentScriptDirectory ~ "./se/se_pause.wav";
let se_spell = GetCurrentScriptDirectory ~ "./se/se_spellcard.wav";
let se_tan = GetCurrentScriptDirectory ~ "./se/se_tan00.wav";
let se_tan2 = GetCurrentScriptDirectory ~ "./se/se_tan01.wav";
let se_tan3 = GetCurrentScriptDirectory ~ "./se/se_tan02.wav";
let se_tan4 = GetCurrentScriptDirectory ~ "./se/se_tan03.wav";
let se_timeout = GetCurrentScriptDirectory ~ "./se/se_timeout.wav";
let se_timeout2 = GetCurrentScriptDirectory ~ "./se/se_timeout2.wav";
let se_timestop = GetCurrentScriptDirectory ~ "./se/se_timestop0.wav";
let se_slash = GetCurrentScriptDirectory ~ "./se/se_slash.wav";
let se_water = GetCurrentScriptDirectory ~ "./se/se_water.wav";
let se_ok = GetCurrentScriptDirectory ~ "./se/se_ok00.wav";
let se_select = GetCurrentScriptDirectory ~ "./se/se_select00.wav";
let se_cancel = GetCurrentScriptDirectory ~ "./se/se_cancel00.wav";
let se_moon = GetCurrentScriptDirectory ~ "./se/se_moon.wav";

let array_sounds = [se_bexplode,se_bomb,se_bonus,se_bonus2,se_boon2,
		se_ch,se_ch2,se_crystal,se_enep1,se_enep2,se_enep3,se_enep4,se_explode,se_extend,se_fault,
		se_getspell,se_graze,se_ice,se_item,se_item2,se_kira,se_kira2,se_kira3,
		se_lazer,se_lazer2,se_pause,se_spell,se_slash,se_spell,se_tan,
		se_tan2,se_tan3,se_tan4,se_timeout,se_timeout2,se_timestop,
		se_water,se_ok,se_select,se_cancel,se_moon];

//BGM
let night1 = GetCurrentScriptDirectory ~ "./bgm/night1.ogg";
let night2 = GetCurrentScriptDirectory ~ "./bgm/night2.ogg";

let array_music = [night1,night2];

task LoadSounds{
	let se = ObjSound_Create();
	ascent(i in 0..length(array_sounds)){
		ObjSound_Load(se, array_sounds[i]);}}
		
task LoadMusic{
	let bgm = ObjSound_Create();
	ascent(i in 0..length(array_music)){
		ObjSound_Load(bgm, array_music[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;}

task BGM(path,start,end){
	let bgm = ObjSound_Create();
	ObjSound_Load(bgm, path);
	ObjSound_SetLoopEnable(bgm,true);
	ObjSound_SetLoopSampleCount(bgm,start,end);
	ObjSound_SetVolumeRate(bgm, 100);
	ObjSound_SetSoundDivision(bgm, SOUND_BGM);
	while(GetCommonData("MUSIC",0) == 0){yield;}
	ObjSound_Play(bgm);}