This is likely a case of me not coding things properly, but I'm having a problem when a sound finishes.
After my sounds finish, there is a pop-crackle sound (actually, sounds like flatulence).
These are the same sounds I used previously, making direct calls to DirectX8 via VB6. The crackle sound was not present then.
Thoughts?
My code is below, I don't think I do anything special;
Code: Select all
STDMETHODIMP CSoundObject::PlaySound(BSTR vSoundFile, BOOL vLooped, float vVolume)
{
//The creation of the private sound object from the global engine
//We need to track it so that the class can do things with it.
mSound = gEngine->play2D(_bstr_t(vSoundFile), (bool)vLooped, false, true);
//Automatically set the volume to that passed in.
this->ChangeVolume(vVolume);
return 0;
}
STDMETHODIMP CSoundObject::ChangeVolume(float vNewVolume)
{
//This routine will change the volume
//Make sure the sound object exists first.
if (! mSound)
return(1);
//Make sure it's not greater than 1
if(vNewVolume > 1)
vNewVolume = 1;
//Not less than zero
if(vNewVolume < 0)
vNewVolume = 0;
//Set the sound volume
mSound->setVolume(vNewVolume);
return 0;
}