Hello,
I get an AL error, but I have no idea what I did wrong in my code. I really don't think it's a memory problem, I have RAM 16 GB and create new sounds only if there are less than 100 sounds in the vector (I read that it can works until 256).
The first error I get is:
An internal OpenAL call failed in SoundSource.cpp(37).
Expression:
alGenSources(1, &m_source)
Error description:
AL_OUT_OF_MEMORY
There is not enough memory left to execute the command.
And then, every new sound created implies this error:
An internal OpenAL call failed in SoundSource.cpp(37).
Expression:
alSourcei(m_source, AL_BUFFER, 0)
Error description:
AL_INVALID_NAME
A bad name (ID) has been specified.
It's probably because of my sound manager, so here is it:
for (std::vector<sSoundManager*>::iterator iteratorSounds = m_soundManager.begin(); iteratorSounds != m_soundManager.end() ; )
{
if ((*iteratorSounds)->m_bPlayed == false // Play the sound if not played yet
&& (*iteratorSounds)->m_iTimeDelay <= 0)
{
(*iteratorSounds)->m_bPlayed = true;
(*iteratorSounds)->m_sound.play();
iteratorSounds++;
}
else if ((*iteratorSounds)->m_bPlayed == true // Purge played sounds
&& ((*iteratorSounds)->m_sound.getStatus() == sf::Sound::Status::Stopped
|| ((*iteratorSounds)->m_bTimeToLive_enabled && (*iteratorSounds)->m_iTimeToLive <= 0)))
{
if ((*iteratorSounds)->m_sound.getStatus() != sf::Sound::Status::Stopped)
(*iteratorSounds)->m_sound.stop();
delete(*iteratorSounds);
iteratorSounds = m_soundManager.erase(iteratorSounds);
}
else // Processing sounds
{
(*iteratorSounds)->m_iTimeDelay -= m_DeltaTime;
if ((*iteratorSounds)->m_bTimeToLive_enabled
&& (*iteratorSounds)->m_iTimeDelay <= 0)
(*iteratorSounds)->m_iTimeToLive -= m_DeltaTime;
iteratorSounds++;
}
}
I saw that "erase.()" deletes the element when it want (not instantly)... But I don't think it can be the problem.
Do anybody have an idea where the problem can be ?