2014-10-08 2 views
0

나는 나 자신 사운드를 재생하기 위해 열거 소요는 PlaySound라는 방법을 soundbuffers의지도에 약간의 wav 파일을로드 한 후 내가 호출 할 수있는 SoundLoader 클래스가 여기 내 방법입니다SFML 내부 OpenAL에 오류

void SoundLoader::PlaySound(SoundNames soundName) 
{ 

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 != -1) 
     { 
      location = i; 
     } 
    } 

    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(); 
    } 

} 
} 

그러나 나는 내 게임을 테스트하고 분 또는 그래서 모든 좋은 것입니다,하지만 갑자기 나는이 원인이 뭐하는 거지이 오류

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

했습니다? 추신 내 soundloader은 그것의 내 오류를 발견 확인

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

그냥이 문제를 가지고 다른 사람을 돕기 위해, 당신은 결코 확실하지 않습니다 181이

답변

1

에 관한 어떤 확신하지 코드의 60 개 라인을 가지고 메모리에 140 sf :: Sounds 이상이 있거나 이것이 깨집니다. 내 playingSounds.size()가 140과 같을 때 이것은 나를 위해 깨기 시작했습니다