1 import "Sound.dll" {
2 int Sound_Init()
3 int Sound_Catch(int)
4 Sound_Free(int)
5 int Sound_Exist(int)
6 int Sound_Load(int)
7 Sound_Play(int,int)
8 Sound_SetFrequency(int,int)
9 Sound_SetPan(int,int)
10 Sound_SetVolume(int,int)
11 Sound_Stop(int)
12 }
13
14 include {
15 "defines.g"
16 }
17
18 type Sound <inherit = GAPI_Object>{
19 int Freq
20 int Vol
21 int Pan
22 }
23
24 func SoundInitialize <entry> {
25 Sound_Init()
26 }
27
28 method int Sound.Catch(int Mem){
29 this.Freq = -1
30 this.Pan = 0
31 this.Vol = 100
32 this.id = Sound_Catch(Mem)
33 return this.id
34 }
35 method Sound.Free(){
36 Sound_Free(this.id)
37 }
38 property int Sound.Exist{
39 return Sound_Exist(this.id)
40 }
41 method int Sound.Load(str FileName){
42 this.Freq = -1
43 this.Pan = 0
44 this.Vol = 100
45 return Sound_Load(FileName.ptr())
46 }
47 method Sound.Play(){
48 Sound_Play(this.id,0)
49 }
50 method Sound.PlayLoop(){
51 Sound_Play(this.id,1)
52 }
53 property int Sound.Frequency{
54 return this.Freq
55 }
56 property Sound.Frequency(int f){
57 Sound_SetFrequency(this.id,f)
58 }
59 property int Sound.Pan{
60 return this.Pan
61 }
62 property Sound.Pan(int p){
63 Sound_SetPan(this.id,p)
64 }
65 property int Sound.Volume{
66 return this.Vol
67 }
68 property Sound.Volume(int v){
69 Sound_SetVolume(this.id,v)
70 }
71 method Sound.Stop(){
72 Sound_Stop(this.id)
73 }
74
Редактировать