SFML内部OpenAL错误
SFML Internal OpenAL error
我有一个SoundLoader类,它将一些wav文件加载到声音缓冲区的映射中,然后我可以调用一个名为PlaySound的方法,该方法使用枚举来播放声音,这是我的方法
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
我是怎么造成的?附言:我的声音加载器只有60行代码,所以不确定181与有关
还好我发现了错误
if (playingSounds.at(i).getStatus() != sf::Sound::Playing && location == -1)
{
location = i;
}
为了帮助其他有这个问题的人,请确保你的记忆中的sf::声音永远不会超过140,否则就会崩溃。当我的playingounds.size()等于140 时,这对我来说是个突破
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 捕获音频时出现 OpenAL 错误
- OpenAL alGenBuffers 错误代码 40964 解决方案
- SFML内部OpenAL错误
- 试图在Mac上使用Eclipse编译OpenAL,结果在符号(s)中找不到架构x86_64错误
- OpenAL取消排队错误代码,不完整的文档