let soundsGame = [];
let soundsSystem = [];

@Initialize{
	soundsGame = [
		CreateSound(GetCurrentScriptDirectory ~ "se/boss_vanish.wav"),	 			//Siren; 					index = 0
		CreateSound(GetCurrentScriptDirectory ~ "se/boss_vanish2.wav"),	 		//Trance Gauge incr.;		index = 1
		CreateSound(GetCurrentScriptDirectory ~ "se/break.wav"),	 			//Grow;						index = 2
		CreateSound(GetCurrentScriptDirectory ~ "se/charge1.wav"),	 			//Bonus 1;					index = 3
		CreateSound(GetCurrentScriptDirectory ~ "se/charge2.wav"),	 			//Bonus 2;					index = 4
		CreateSound(GetCurrentScriptDirectory ~ "se/charge3.wav"),	 			//MoF spell capture;		index = 5
		CreateSound(GetCurrentScriptDirectory ~ "se/eco.wav"),	 			//Bonus 3;					index = 6
		CreateSound(GetCurrentScriptDirectory ~ "se/enemy_vanish1.wav"),	 			//Bzzt (short);				index = 7
		CreateSound(GetCurrentScriptDirectory ~ "se/failed.wav"),	 			//Bzzt (long);				index = 8
		CreateSound(GetCurrentScriptDirectory ~ "se/fire1.wav"),	 			//PCB border;				index = 9
		CreateSound(GetCurrentScriptDirectory ~ "se/fire2.wav"),	 			//ISC item ready;			index = 10
		CreateSound(GetCurrentScriptDirectory ~ "se/freeze.wav"),	 		//Cancel;					index = 11
		CreateSound(GetCurrentScriptDirectory ~ "se/getspellcard.wav"),	 		//Spell capture;			index = 12
		CreateSound(GetCurrentScriptDirectory ~ "se/getspellcard2.wav"),	 			//Spell declare;			index = 13
		CreateSound(GetCurrentScriptDirectory ~ "se/laser1.wav"),	 			//Cat meow;					index = 14
		CreateSound(GetCurrentScriptDirectory ~ "se/laser2.wav"),	 			//Charge (long);			index = 15
		CreateSound(GetCurrentScriptDirectory ~ "se/laser3.wav"),	 			//Camera ready;				index = 16
		CreateSound(GetCurrentScriptDirectory ~ "se/master.wav"),	 			//Charge (short);			index = 17
		CreateSound(GetCurrentScriptDirectory ~ "se/mecha04.wav"),	 			//Ugly;						index = 18
		CreateSound(GetCurrentScriptDirectory ~ "se/noise20.wav"),			//UFO change;				index = 19
		CreateSound(GetCurrentScriptDirectory ~ "se/nuclear.wav"),	 		//PoFV charge;				index = 20
		CreateSound(GetCurrentScriptDirectory ~ "se/shot1.wav"),	 		//PoFV charge end?;			index = 21
		CreateSound(GetCurrentScriptDirectory ~ "se/shot2.wav"),	 		//PoFV charge end;			index = 22
		CreateSound(GetCurrentScriptDirectory ~ "se/shot3.wav"),	 			//ISC congratulations;		index = 23
		CreateSound(GetCurrentScriptDirectory ~ "se/shot4.wav"),	 		//Boss damage low;			index = 24
		CreateSound(GetCurrentScriptDirectory ~ "se/shot5.wav"),	 		//Boss damage high;			index = 25
		CreateSound(GetCurrentScriptDirectory ~ "se/shot6.wav"),	 			//Raiko thunder;			index = 26
		CreateSound(GetCurrentScriptDirectory ~ "se/stop.wav"),	 			//Down?;					index = 27
		CreateSound(GetCurrentScriptDirectory ~ "se/timecount.wav"),	 			//Enemy death;				index = 28
		CreateSound(GetCurrentScriptDirectory ~ "se/usespellcard.wav"),	 			//Boss death;				index = 29
		CreateSound(GetCurrentScriptDirectory ~ "se/wolf.wav"),	 			//Sun;						index = 30
	];
	
	SetCommonData("SoundScript", GetOwnScriptID);
}

@Event{
	alternative(GetEventType)
	case(EV_USER){
		let arg = GetEventArgument(0);
		ObjSound_Play(soundsGame[arg[0]]);
		ObjSound_SetVolumeRate(soundsGame[arg[0]], arg[1]/2);
	}
}

function CreateSound(path){
	let obj = ObjSound_Create();
	ObjSound_Load(obj, path);
	ObjSound_SetVolumeRate(obj, 100);
	ObjSound_SetLoopEnable(obj, false);
	ObjSound_SetSoundDivision(obj, SOUND_SE);
	return obj;
}