Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Internal OpenAL error  (Read 4100 times)

0 Members and 2 Guests are viewing this topic.

Canvas

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Internal OpenAL error
« on: October 08, 2014, 10:29:21 pm »
Hello there,

I have myself a SoundLoader class which loads some wav files into a map of soundbuffers and then I can call a method called PlaySound which takes an enum to play the sound, here is my method

if (playingSounds.size() == 0)
        {
                playingSounds.push_back(sf::Sound());
                playingSounds.at(0).setBuffer(Sounds[soundName]);
                playingSounds.at(0).play();
        }
        else
        {
                int location = -1;
                for (int i = 0; i < playingSounds.size(); i++)
                {
                        if (!playingSounds.at(i).getStatus() == sf::Sound::Playing)
                        {
                                location = i;
                        }
                       
                        if (location != -1)
                        {
                                break;
                        }
                }

                if (location != -1)
                {
                        playingSounds.at(location).setBuffer(Sounds[soundName]);
                        playingSounds.at(location).play();
                }
                else
                {
                        playingSounds.push_back(sf::Sound());
                        playingSounds.at(playingSounds.size()-1).setBuffer(Sounds[soundName]);
                        playingSounds.at(playingSounds.size() - 1).play();
                }

        }

However I was testing my game and for a minute or so it is all going fine, but then all of a sudden I got this error

An internal OpenAL call failed in SoundSource.cpp (181) : AL_INVALID_NAME, an unacceptable name has been specified

What am I doing to cause this? P.S. my soundloader only has 60 lines of code so not sure what the 181 is relating to

UPDATE

I have just coded my enemy to spam its firing which plays one sound, this worked for a few seconds then an error was shown and my game continued for about 3 seconds then I got this error in visual studio

Unhandled exception at 0x56455365 (sfml-system-d-2.dll) in SpaceDestroyer.exe: 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x07B52FFC).

then it shows in Err.cpp

virtual int overflow(int character)
    {
        if ((character != EOF) && (pptr() != epptr()))
        {
            // Valid character
            return sputc(static_cast<char>(character));
        }
        else if (character != EOF)
        {
            // Not enough space in the buffer: synchronize output and try again
            sync();
            return overflow(character);
        }
        else
        {
            // Invalid character: synchronize output
            return sync();
        }
    }
 

sfml-system-d-2.dll!`anonymous namespace'::DefaultErrStreamBuf::overflow(int character) Line 61 C++

UPDATE

It's ok I found it, I just changed my line to check location to be this

if (playingSounds.at(i).getStatus() != sf::Sound::Playing && location == -1)
                        {
                                location = i;
                        }

but just to let everyone else know, make sure when you are playing sounds never reach more than 140 sounds in memory, this will throw the "Internal OpenAL error", this error happened to me when my playingSounds.size() was equal to 140
« Last Edit: October 08, 2014, 10:59:35 pm by Canvas »

 

anything