rnd-20100313-1-src
[rocksndiamonds.git] / src / game_sp / Sound.c
1 // ----------------------------------------------------------------------------
2 // Sound.c
3 // ----------------------------------------------------------------------------
4
5 #include "Sound.h"
6
7 // static char *VB_Name = "modSound";
8
9 // --- Option Explicit
10
11 int MusicOnFlag;
12 int FXOnFlag;
13
14 #if 0
15
16 DirectSoundBuffer ZonkFX[1 + 1];
17 DirectSoundBuffer InfotronFX[1 + 1];
18 DirectSoundBuffer BugFX[1 + 1];
19 DirectSoundBuffer ExplosionFX[1 + 1];
20 DirectSoundBuffer PushFX;
21 DirectSoundBuffer ExitFX;
22 DirectSoundBuffer BaseFX;
23
24 #endif
25
26 void LoadSoundFX()
27 {
28
29 #if 0
30
31   DSBUFFERDESC bufferDesc;
32   WAVEFORMATEX waveFormat;
33   char *FName;
34   int i;
35
36   bufferDesc.lFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_STATIC;
37   waveFormat.nFormatTag = WAVE_FORMAT_PCM;
38   waveFormat.nChannels = 1;
39   waveFormat.lSamplesPerSec = 8000;
40   waveFormat.nBitsPerSample = 8;
41   waveFormat.nBlockAlign = waveFormat.nBitsPerSample / 8 * waveFormat.nChannels;
42   waveFormat.lAvgBytesPerSec = waveFormat.lSamplesPerSec * waveFormat.nBlockAlign;
43   FName = CAT(App.Path, "/Sound/");
44   for (i = 0; i <= 1; i++)
45   {
46     ZonkFX[i] = DSound.CreateSoundBufferFromFile(CAT(FName, "Zonk.wav"), bufferDesc, waveFormat);
47     InfotronFX[i] = DSound.CreateSoundBufferFromFile(CAT(FName, "Infotron.wav"), bufferDesc, waveFormat);
48     BugFX[i] = DSound.CreateSoundBufferFromFile(CAT(FName, "Bug.wav"), bufferDesc, waveFormat);
49     ExplosionFX[i] = DSound.CreateSoundBufferFromFile(CAT(FName, "Explosion.wav"), bufferDesc, waveFormat);
50   }
51
52   BaseFX = DSound.CreateSoundBufferFromFile(CAT(FName, "Base.wav"), bufferDesc, waveFormat);
53   ExitFX = DSound.CreateSoundBufferFromFile(CAT(FName, "Exit.wav"), bufferDesc, waveFormat);
54   PushFX = DSound.CreateSoundBufferFromFile(CAT(FName, "Push.wav"), bufferDesc, waveFormat);
55   //  FXOnFlag = 0
56
57 #endif
58
59 }
60
61 void subSoundFXZonk()
62 {
63 #if 0
64
65   int i;
66
67   if (FXOnFlag == 0)
68     return;
69
70   for (i = 0; i <= 1; i++)
71   {
72     if (! IS_NOTHING(&ZonkFX[i], sizeof(ZonkFX[i])))
73     {
74       if (ZonkFX[i].GetStatus() != DSBSTATUS_PLAYING)
75       {
76         ZonkFX[i].Play DSBPLAY_DEFAULT;
77         break;
78       }
79     }
80   }
81
82 #endif
83 }
84
85 void subSoundFXBug()
86 {
87 #if 0
88
89   int i;
90
91   if (FXOnFlag == 0)
92     return;
93
94   for (i = 0; i <= 1; i++)
95   {
96     if (! IS_NOTHING(&BugFX[i], sizeof(BugFX[i])))
97     {
98       if (BugFX[i].GetStatus() != DSBSTATUS_PLAYING)
99       {
100         BugFX[i].Play DSBPLAY_DEFAULT;
101         break;
102       }
103     }
104   }
105
106 #endif
107 }
108
109 void subSoundFXInfotron()
110 {
111 #if 0
112
113   int i;
114
115   if (FXOnFlag == 0)
116     return;
117
118   for (i = 0; i <= 1; i++)
119   {
120     if (! IS_NOTHING(&InfotronFX[i], sizeof(InfotronFX[i])))
121     {
122       if (InfotronFX[i].GetStatus() != DSBSTATUS_PLAYING)
123       {
124         InfotronFX[i].Play DSBPLAY_DEFAULT;
125         break;
126       }
127     }
128   }
129
130 #endif
131 }
132
133 void subSoundFXExplosion()
134 {
135 #if 0
136
137   int i;
138
139   if (FXOnFlag == 0)
140     return;
141
142   for (i = 0; i <= 1; i++)
143   {
144     if (! IS_NOTHING(&ExplosionFX[i], sizeof(ExplosionFX[i])))
145     {
146       if (ExplosionFX[i].GetStatus() != DSBSTATUS_PLAYING)
147       {
148         ExplosionFX[i].Play DSBPLAY_DEFAULT;
149         break;
150       }
151     }
152   }
153
154 #endif
155 }
156
157 void subSoundFXBase()
158 {
159 #if 0
160
161   if (FXOnFlag == 0)
162     return;
163
164   if (IS_NOTHING(&BaseFX, sizeof(BaseFX)))
165     return;
166
167   if (BaseFX.GetStatus() != DSBSTATUS_PLAYING)
168   {
169     BaseFX.Play DSBPLAY_DEFAULT;
170   }
171
172 #endif
173 }
174
175 void subSoundFXPush()
176 {
177 #if 0
178
179   if (FXOnFlag == 0)
180     return;
181
182   if (IS_NOTHING(&PushFX, sizeof(PushFX)))
183     return;
184
185   if (PushFX.GetStatus() != DSBSTATUS_PLAYING)
186   {
187     PushFX.Play DSBPLAY_DEFAULT;
188   }
189
190 #endif
191 }
192
193 void subSoundFXExit()
194 {
195 #if 0
196
197   if (FXOnFlag == 0)
198     return;
199
200   if (IS_NOTHING(&ExitFX, sizeof(ExitFX)))
201     return;
202
203   if (ExitFX.GetStatus() != DSBSTATUS_PLAYING)
204   {
205     ExitFX.Play DSBPLAY_DEFAULT;
206   }
207
208 #endif
209 }
210
211 void subSoundFX(int si, int element, int action)
212 {
213   int x = GetX(si);
214   int y = GetY(si);
215
216   PlayLevelSound_SP(x, y, element, action);
217 }
218
219 void subMusicInit()
220 {
221 }