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

@Initialize{
	soundsGame = [
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_alert.wav"),	 			//Siren; 					index = 0
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_astralup.wav"),	 		//Trance Gauge incr.;		index = 1
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_big.wav"),	 			//Grow;						index = 2
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_bonus.wav"),	 			//Bonus 1;					index = 3
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_bonus2.wav"),	 			//Bonus 2;					index = 4
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_bonus3.wav"),	 			//MoF spell capture;		index = 5
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_bonus4.wav"),	 			//Bonus 3;					index = 6
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_boon00.wav"),	 			//Bzzt (short);				index = 7
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_boon01.wav"),	 			//Bzzt (long);				index = 8
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_border.wav"),	 			//PCB border;				index = 9
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_bun.wav"),	 			//ISC item ready;			index = 10
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_cancel00.wav"),	 		//Cancel;					index = 11
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_cardget.wav"),	 		//Spell capture;			index = 12
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_cat00.wav"),	 			//Spell declare;			index = 13
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_cat01.wav"),	 			//Cat meow;					index = 14
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ch00.wav"),	 			//Charge (long);			index = 15
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ch01.wav"),	 			//Camera ready;				index = 16
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ch02.wav"),	 			//Charge (short);			index = 17
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ch03.wav"),	 			//Ugly;						index = 18
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_changeitem.wav"),			//UFO change;				index = 19
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_charge00.wav"),	 		//PoFV charge;				index = 20
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_charge01b.wav"),	 		//PoFV charge end?;			index = 21
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_chargeup.wav"),	 		//PoFV charge end;			index = 22
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_cong.wav"),	 			//ISC congratulations;		index = 23
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_damage00.wav"),	 		//Boss damage low;			index = 24
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_damage01.wav"),	 		//Boss damage high;			index = 25
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_don00.wav"),	 			//Raiko thunder;			index = 26
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_down.wav"),	 			//Down?;					index = 27
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_enep00.wav"),	 			//Enemy death;				index = 28
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_enep01.wav"),	 			//Boss death;				index = 29
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_enep02.wav"),	 			//Sun;						index = 30
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_etbreak.wav"),	 		//Bullet delete;			index = 31
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_eterase.wav"),			//Bullet delete 2;			index = 32
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_exattack.wav"),			//PoFV Ex attack;			index = 33
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_extend.wav"),	 			//Extend;					index = 34
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_extend2.wav"),	 		//Ugly;						index = 35
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_fault.wav"), 				//Spell fail;				index = 36
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_focus.wav"),	 			//Camera focus;				index = 37
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_focusfix.wav"),	 		//Camera focus fail;		index = 38
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_focusfix2.wav"),	 		//Camera focus fail 2;		index = 39
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_focusin.wav"),	 		//???;						index = 40
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_focusrot.wav"),	 		//???;						index = 41
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_goast1.wav"),	 			//ISC ghost lantern;		index = 42
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_goast2.wav"),				//ISC ghost latern end;		index = 43
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_gosp.wav"),	 			//Bubbles;					index = 44
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_graze.wav"),	 			//Graze;					index = 45
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_gun00.wav"),	 			//Big laser;				index = 46
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_heal.wav"),	 			//Yoshika heal;				index = 47
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_hint.wav"),	 			//Hint;						index = 48
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ice.wav"),	 			//Freeze;					index = 49
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ice2.wav"),	 			//Ice break;				index = 50
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_invalid.wav"),	 		//DENIED;					index = 51
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_item00.wav"),	 			//Item get;					index = 52
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_item01.wav"),	 			//Many items get;			index = 53
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_kira00.wav"),	 			//Sparkle;					index = 54
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_kira01.wav"),	 			//Sparkle 2;				index = 55
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_kira02.wav"),	 			//Sparkle 3;				index = 56
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lazer00.wav"),	 		//Laser 1;					index = 57
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lazer01.wav"),	 		//Laser 2;					index = 58
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lazer02.wav"),	 		//Marisa laser;				index = 59
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lgods1.wav"),	 			//Note;						index = 60
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lgods2.wav"),	 			//Note 2;					index = 61
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lgods3.wav"),	 			//Note 3;					index = 62
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lgods4.wav"),	 			//Rest;						index = 63
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_lgodsget.wav"),	 		//Divine spirit get;		index = 64
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_life1.wav"),	 			//PoFV last life;			index = 65
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_msl.wav"),	 			//Marisa missle;			index = 66
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_msl2.wav"),	 			//Marisa missile hit;		index = 67
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_msl3.wav"),	 			//Marisa missile hit 2;		index = 68
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_nep00.wav"),	 			//Master Spark;				index = 69
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_nice.wav"),	 			//StB clap;					index = 70
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_nodamage.wav"),	 		//Invincible;				index = 71
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_noise.wav"),	 			//Noise;					index = 72
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_notice.wav"),	 			//ISC message;				index = 73
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ok00.wav"),	 			//Confirm;					index = 74
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ophide.wav"),	 			//IN option hide;			index = 75
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_opshow.wav"),	 			//IN option show;			index = 76
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_option.wav"),	 			//Spawn optiom;				index = 77
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_pause.wav"),	 			//Pause;					index = 78
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_pin00.wav"),	 			//Weird electric sound;		index = 79
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_pin01.wav"),	 			//Weird electric sound 2;	index = 80
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_piyo.wav"),	 			//UFO item spawn;			index = 81
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_playerdead.wav"),	 		//Explosion;				index = 82
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_pldead00.wav"),	 		//Player death;				index = 83
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_pldead01.wav"),	 		//Player death 2;			index = 84
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_plst.wav"),	 			//Player shot;				index = 85
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_power0.wav"),	 			//Charge (long);			index = 86
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_power1.wav"),	 			//Power wave;				index = 87
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_powerup.wav"),	 		//Power level up;			index = 88
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_poyon.wav"),	 			//Poyon;					index = 89
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_release.wav"),	 		//Season Release;			index = 90
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_select00.wav"),	 		//Select;					index = 91
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_shutter.wav"),	 		//Camera shutter;			index = 92
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_slash.wav"),	 			//Slash;					index = 93
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_small.wav"),	 			//Shrink;					index = 94
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_tan00.wav"),	 			//Bullet;					index = 95
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_tan01.wav"),	 			//Bullet 2;					index = 96
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_tan02.wav"),	 			//Bullet 3;					index = 97
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_tan03.wav"),	 			//Electric bullet;			index = 98
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_timeout.wav"),	 		//Timeout;					index = 99
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_timeout2.wav"),	 		//Timeout 2;				index = 100
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_timestop.wav"),	 		//Time stop;				index = 101
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_trophy.wav"),	 			//ISC trophy;				index = 102
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ufo.wav"),	 			//UFO spawn;				index = 103
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_ufoalert.wav"),	 		//UFO alert;				index = 104
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_warning.wav"),	 		//Lily warning;				index = 105
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_warp_l.wav"),	 			//Warp left;				index = 106
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_warp_n.wav"),	 			//Warp neutral;				index = 107
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_warp_r.wav"),	 			//Warp right;				index = 108
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_water.wav"),	 			//Water;					index = 109
		CreateSound(GetCurrentScriptDirectory ~ "../SE/se_wolf.wav"),	 			//Wolf;						index = 110
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_boing.wav"),		//Boing;					index = 111
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_bounce.wav"),		//Sheep bounce;				index = 112
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_psychexplode.wav"),	//Psychic explosion;		index = 113
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_sheep.wav"),		//Sheep;					index = 114
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_transform.wav"),	//Transformation;			index = 115
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_dream_00.wav"),		//Dream blob 1;				index = 116
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_dream_01.wav"),		//Dream blob 2;				index = 117
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_glasscrack_00.wav"),//Glass crack;				index = 118
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_glasscrack_01.wav"),//Glass crack some more;	index = 119
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_glasscrack_02.wav"),//Glass crack a lot;		index = 120
		CreateSound(GetCurrentScriptDirectory ~ "../SE/Extra/se_glassshatter.wav"),	//Glass shatter;			index = 121
	];
	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;
}