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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Nugsy

Pages: [1]
1
Audio / Re: Creating an instance of any audio object causes fps drop.
« on: April 18, 2013, 04:18:58 pm »
I have updated the above post with a fix for this issue, you posted just as i was updating that one haha.

Thanks for the help. :)

2
Audio / Re: Creating an instance of any audio object causes fps drop.
« on: April 18, 2013, 03:34:28 pm »
I have just done a minimal code test and i am still getting the same problem as last night.

Here is the code that i used for testing:

Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

#include <iostream>
#include <sstream>

template <class T>
inline std::string ToString(const T& t)
{
    std::stringstream ss;
    ss << t;
    return ss.str();
}

int main()
{
int frameCounter;
int fps;
sf::Clock clock;

sf::RenderWindow Win(sf::VideoMode(200, 200), "test");
Win.setFramerateLimit(60);

//sf::SoundBuffer buf; //uncommenting this line will cause an fps drop

while (Win.isOpen())
{
sf::Event Event;
while (Win.pollEvent(Event))
{
if (Event.type == sf::Event::Closed)
{
Win.close();
}
}

        if (clock.getElapsedTime().asMilliseconds() >= 1000)
        {
            fps = frameCounter;
            frameCounter = 0;
            clock.restart().asMilliseconds();
        }
        else
        {
            frameCounter++;
        }


Win.clear();

sf::Text t;
t.setString(ToString(fps));
Win.draw(t);

Win.display();
}

return 0;
}

Line 26 is the problematic line.
I have also uploaded a compiled version of this program for easier testing, and in the hope that it will help us to resolve this issue faster.

7Zip archive: http://www.mediafire.com/?0qd2r39ensd0g1g
ZIP archive:  http://www.mediafire.com/?zansd2bsrba8x6b

Both archives contain the same files however i have provided both in the event that someone does not have 7Zip.



------------------------------------------------UPDATE------------------------------------------------

I have found the issue and have fixed it, i'll post what i did here incase anyone stumbles across this thread in the future.

It was a problem with the openal32.dll included with the SFML RC2 download. I replaced this file with another version of the same dll from a game installed on my system. Both my main project and the test project now run completely fine.

Here is a link to the .dll that i have used, again incase anyone stumbles across this thread:
http://www.mediafire.com/?l2qlp27hh5334hz

Cheers,
Nugsy.

3
Audio / Re: Creating an instance of any audio object causes fps drop.
« on: April 18, 2013, 02:44:43 am »
I actually just came back to edit some of that information into my original post but you beat me to it haha.

Im using the RC of SFML2 (downloaded from the main website), the problem occurs in both the Debug and Release versions of the project, and it doesn't matter whether SFML is statically or dynamically linked.
All graphics and audio drivers are up-to-date.

I've tried the project with the OpenAL32.dll and libsndfile-1.dll libraries included with SFML RC2 and with the latest freshly downloaded versions.

I'm not using my own laptop at the momet, but a minimal code reproduction of the problem would be along the lines of:

Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

#include <iostream>

int main()
{
    sf::SoundBuffer* buf = new sf::SoundBuffer; //if this is commented out, the fps will be higher

    int frameCounter;
    int fps;
    sf::Clock clock;

    sf::RenderWindow win;
    win.setFramerateLimit(60)
    while (win.isOpen())
    {
        //poll events...

        //attempt at an in-browser fps counter
        if (clock.getElapsedTime().asMilliseconds() >= 1000)
        {
            fps = frameCounter;
            frameCounter = 0;
            clock.restart().asMilliseconds();
        }
        else
        {
            frameCounter++;
        }

        std::cout << fps << "\n";

    }
   
    delete buf;
    return 0;
}

That may not compile, as i've just written it in the reply. I'll have to give this example a go tomorrow and see if this gives me the fps drop as well as my actual project.

In hindsight i probably should have done this hours ago, but i was prett stressed so i wasn't thinking clearly haha.

Thanks for the speedy reply :).

4
Audio / Creating an instance of any audio object causes fps drop.
« on: April 18, 2013, 02:14:30 am »
I have been trying to solve this all day with no luck unfortunately.
No matter where i create an instance of either a sf::Sound or an sf::SoundBuffer, there is a noticeable drop in the framerate of my project.

With no sound objects:
Uncapped framerate = 500+.
Capped framerate    = 60.

With at least one sound object:
Uncapped framerate = 500+.
Capped framerate    = 50.

I'm pretty sure this isn't an issue with my code as i've tried a large amount of tests over the course of today. Personally i believe it's an issue with either SFML or one of the libraries linked to by the Audio module. I'm not saying it definitely isn't my code 100% however haha.

I should also mention that when i ran the project on another system, the capped framerate of the project with a sound object is 60. So this could be an issue with my laptop, rather than an issue with either of the things i mentioned above.

I can provide minimal code if anyone needs it, however it is currently 1:15am and i really need to sleep!

Any help is greatly appreciated.

Thanks,
Nugsy.

Pages: [1]