DirectSound problem
Hi,
I created a soundbuffer wrapper for DirectSound that is able to load a wave file and keep it in a number of soundbuffers (for simultaneous playback of the same sample). On loading a wave file it takes the DirectSound interface object as a parameter. Now here is the problem: it works fine with loading ONE sample this way (in any number of copies), however when I create another wavewrapper object it fails while trying to load the sample. If you can find any explanation of this please tell me what I'm doing wrong.
http://www.moviecodec.com/cpp/wavewrapper.cpp
http://www.moviecodec.com/cpp/wavewrapper.h
(The function to load a wave file into sound buffer comes from André LaMothes "trick of the windows game programming gurus").
When creaing object this works:
explosionWave1 = new WaveWrapper();
if (!explosionWave1->LoadWAVE("wav\\EXP0.WAV",NUM_XPLO_FX_CHAN,myDSInterface))
FatalError("Error LoadWAVE");
and this works:
fireWave1 = new WaveWrapper();
if (!fireWave1->LoadWAVE("wav\\11kcannon.wav",NUM_FIRE_FX_CHAN,myDSInterface))
FatalError("Error LoadWAVE");
BUT this does NOT work:
explosionWave1 = new WaveWrapper();
if (!explosionWave1->LoadWAVE("wav\\EXP0.WAV",NUM_XPLO_FX_CHAN,myDSInterface))
FatalError("Error LoadWAVE");
fireWave1 = new WaveWrapper();
if (!fireWave1->LoadWAVE("wav\\11kcannon.wav",NUM_FIRE_FX_CHAN,myDSInterface))
FatalError("Error LoadWAVE");
Weird
[edited by - beowulf on October 2, 2002 6:27:18 AM]
And the solution was even more weird! Now I have a memory leak, I commented out "free(snd_buffer);" in the load wave function and now it works; but now it has a memory leak
Hi, I am just tampering in that area too, looking for something similiar. - Created a class with a few soundbuffers (channels) - but had the problem just to have one pipeline. What I did (which is not a solution, but just a circumvention of the problem) was that I used the duplicate methode after my main buffer had read in the file.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement