I'm using something like this to start a looping sound:
if (m_pSource == OS_INVALID_SOUND)
{
alGenSources(1, &m_pSource);AL_CHECK
alSourcei(m_pSource, AL_BUFFER, m_pBuffer);
if (Is3D())
{
SetMinDistance(m_minDistance);
SetMaxDistance(m_maxDistance);
}
if (IsLooping() && !IsStreamming())
{
alSourcei(m_pSource, AL_LOOPING, AL_TRUE);
}
}
if (m_pSource != OS_INVALID_SOUND)
{
alSourcePlay(m_pSource);AL_CHECK
}
then at some point I use:
alSourcePause(m_pSource);AL_CHECK
to stop the sound and then:
alSourcePlay(m_pSource);AL_CHECK
once again to restart it. Everything works as expected except the sound is not restarting after the last play. Anyone has any idea what can cause this ? or if I do something wrong ?
Thanks.
I found the issue, it seems that even if I delete the source, the minDistance, maxDistance, pitch modifier and other parameters are saved somewhere (when I create a new source sometimes has set up some of the parameters previously set). So the best way is to set everything right after the source is created.