summaryrefslogtreecommitdiff
path: root/sound.bmx
blob: 2dce3a012da7a42bf7bf031a9bf8e9ea1b04ebd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
' Missile Lock
'
' Copyright (C) 2006  Ian Cowburn (ianc@noddybox.co.uk)
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
'
' -------------------------------------------------------------------------
'
' $Id$
'
Strict
Import brl.audio
Import brl.oggloader
Import brl.freeaudioaudio

Incbin "SFX/alert.ogg"
Incbin "SFX/missile_explode.ogg"
Incbin "SFX/missile_launch.ogg"
Incbin "SFX/ship_explode.ogg"
Incbin "SFX/ship_hit.ogg"

Type SFX
	Global sfx_alert:TSound
	Global sfx_missile_explode:TSound
	Global sfx_missile_launch:TSound
	Global sfx_ship_explode:TSound
	Global sfx_ship_hit:TSound
	
	Function SafeLoadSound:TSound(p:String, loop:Int=False)
		Local i:TSound=LoadSound(p,loop)
		Assert i,"Failed to load " + p
		Return i
	End Function
	
	Function Init()
		sfx_alert=SafeLoadSound("incbin::SFX/alert.ogg")
		sfx_missile_explode=SafeLoadSound("incbin::SFX/missile_explode.ogg")
		sfx_missile_launch=SafeLoadSound("incbin::SFX/missile_launch.ogg")
		sfx_ship_explode=SafeLoadSound("incbin::SFX/ship_explode.ogg")
		sfx_ship_hit=SafeLoadSound("incbin::SFX/ship_hit.ogg")
	End Function
	
	Function Alert()
		PlaySound(sfx_alert)
	End Function
	
	Function MissileExplode()
		PlaySound(sfx_missile_explode)
	End Function
	
	Function MissileLaunch()
		PlaySound(sfx_missile_launch)
	End Function
	
	Function ShipHit()
		PlaySound(sfx_ship_hit)
	End Function
	
	Function ShipExplode()
		PlaySound(sfx_ship_explode)
	End Function
End Type