1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 // static char *VB_Name = "modSound";
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;
31 DSBUFFERDESC bufferDesc;
32 WAVEFORMATEX waveFormat;
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++)
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);
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);
70 for (i = 0; i <= 1; i++)
72 if (! IS_NOTHING(&ZonkFX[i], sizeof(ZonkFX[i])))
74 if (ZonkFX[i].GetStatus() != DSBSTATUS_PLAYING)
76 ZonkFX[i].Play DSBPLAY_DEFAULT;
94 for (i = 0; i <= 1; i++)
96 if (! IS_NOTHING(&BugFX[i], sizeof(BugFX[i])))
98 if (BugFX[i].GetStatus() != DSBSTATUS_PLAYING)
100 BugFX[i].Play DSBPLAY_DEFAULT;
109 void subSoundFXInfotron()
118 for (i = 0; i <= 1; i++)
120 if (! IS_NOTHING(&InfotronFX[i], sizeof(InfotronFX[i])))
122 if (InfotronFX[i].GetStatus() != DSBSTATUS_PLAYING)
124 InfotronFX[i].Play DSBPLAY_DEFAULT;
133 void subSoundFXExplosion()
142 for (i = 0; i <= 1; i++)
144 if (! IS_NOTHING(&ExplosionFX[i], sizeof(ExplosionFX[i])))
146 if (ExplosionFX[i].GetStatus() != DSBSTATUS_PLAYING)
148 ExplosionFX[i].Play DSBPLAY_DEFAULT;
157 void subSoundFXBase()
164 if (IS_NOTHING(&BaseFX, sizeof(BaseFX)))
167 if (BaseFX.GetStatus() != DSBSTATUS_PLAYING)
169 BaseFX.Play DSBPLAY_DEFAULT;
175 void subSoundFXPush()
182 if (IS_NOTHING(&PushFX, sizeof(PushFX)))
185 if (PushFX.GetStatus() != DSBSTATUS_PLAYING)
187 PushFX.Play DSBPLAY_DEFAULT;
193 void subSoundFXExit()
200 if (IS_NOTHING(&ExitFX, sizeof(ExitFX)))
203 if (ExitFX.GetStatus() != DSBSTATUS_PLAYING)
205 ExitFX.Play DSBPLAY_DEFAULT;