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

Author Topic: [Solved] Music/Sound causes Major FPS Drop after 1 min  (Read 1894 times)

0 Members and 1 Guest are viewing this topic.

Rutin

  • Newbie
  • *
  • Posts: 5
    • View Profile
[Solved] Music/Sound causes Major FPS Drop after 1 min
« on: March 29, 2018, 07:18:51 am »
I'm dealing with a strange issue using either sf::Sound + Buffer, or just using sf::Music.

My project renders Frames over over 1000+, yet when I load in either a wave or ogg file, it will stutter if I launch through Visual Studio, and sometimes not stutter if I run a debug.exe only, but usually does.

I'm on Windows 10, and I'm statically linking SFML. I'm using SFML 2.4.2.

As the window is in Windowed Mode, I can click and hold on the top bar, which returns the music to playing normally, but if I release it stutters and drops my render frames down to 11 from 1000+. If I also move the window the problem goes away until I stop moving the window very fast. Fullscreen mode also does the same thing. If I remove the audio, my render frames are back to normal.

I simply do this before my game loop:


sf::Music gameMusic;
gameMusic.openFromFile("song.ogg");
gameMusic.play();
 

I've never seen such an issue before, is this a Windows 10 conflict?

EDIT:

I did a quick test and only did this:

sf::Music gameMusic;
 

The program becomes very slow, and is fixed if I comment the line out. So it appears just declaring sf::Music is causing the issue.

I looked at my project again, and it wasn't working because I was using sf::Music prior to sf::RenderWindow. When I move the Audio code after, it works perfectly fine.

The problem still exists though, after exactly 1 MIN of run time the audio stutters and frames drop. If I don't have any audio and just declare sf::Music gameMusic; it still slows in 1 min of run time without playing.

Fixed: Apparently I was either using the wrong .dll for openal32, so I just re-copied it from SFML and it works fine now. Glad this is working now! I was confused why calling sf::Music before sf::RenderWindow would cause any issues as it should make zero difference... Little error, big problem. :D I noticed threads exiting like crazy prior so I thought to confirm the .dll
« Last Edit: March 29, 2018, 03:19:16 pm by Rutin »