I just began working with SFML in my C++ intro class, so I apologize if I'm being a bit dumb here. However, I recently made a simple game and wanted to include some background music and a short clip to play. The sounds play perfectly fine and function exactly as I'd like them to. However, after about 7 minutes (give or take) of runtime, my program crashes. The error says something about an unhandled exception by openal32.dll (which I know handles the audio) and something about an access violation.
Unhandled exception at 0x00007FFF9B7AB20E (openal32.dll) in <PROGRAM_NAME>.exe: 0xC0000005: Access violation reading location 0x00007A3C0000E684.
I'm pretty sure I'm not destroying the buffer or anything simple like that, but I'd like some help with this if possible. Here's the portion of my code that's playing audio:
SoundBuffer buffer;
buffer.loadFromFile("Clip.ogg");
Sound clip;
clip.setBuffer(buffer);
Music music;
music.openFromFile("Music.ogg");
music.setVolume(10);
music.setLoop(true);
music.play();
while (window.isOpen())
{
menu(window, inGame, asX, ai, aiDifficulty);
if (ai)
{
clip.play();
}
That's all I believe is necessary, but let me know if more is needed. I'd appreciate some help if possible so I can make this program reliable, thanks.