SFML community forums

Help => Audio => Topic started by: Mbass on February 17, 2017, 05:16:12 pm

Title: Unsupported File
Post by: Mbass on February 17, 2017, 05:16:12 pm
Hey,
i tried to play a file but its printing me, that my file is a invalid or unsupported file.
I'm tried .mp3 and .wav but it isnt working.

I also move already the libsndfile-1dll.dll and openal32.dll in the ordner with the .exe.
Is this right? or do i have to make something else to play sounds?
Title: Re: Unsupported File
Post by: Mario on February 17, 2017, 07:05:01 pm
SFML doesn't support mp3 files, wav depends on the actual encoding. Can you post/attach the wav file you've tried? Or try using ogg.
Title: Unsupported File
Post by: eXpl0it3r on February 17, 2017, 07:19:43 pm
Also, if you're using an SFML version that still uses libsndfile, you should upgrade SFML.
Title: Re: Unsupported File
Post by: Mbass on February 18, 2017, 03:01:43 pm
Hey,
i'm using now .ogg files and its working. (btw. i'm using the newest version of SFML, i just thought, that i have to use the libsndfile, because of some old threads :p)

But i got a new problem. If i create a SoundBuffer, it takes 3300ms to create it.
I guess thats not how it suppose to be. 

        clock_t zeit1, zeit2;
        zeit1 = clock();

        sf::SoundBuffer soundBuffer;

        zeit2 = clock();
        std::cout << "time: : " << (zeit2 - zeit1) << "\n"; //3300ms

 

I dont even load any sound into it anymore. :/
Title: Unsupported File
Post by: eXpl0it3r on February 18, 2017, 03:08:40 pm
And what is clock_t and clock() supposed to be? Do they actually do what you think they should?
Title: Re: Unsupported File
Post by: Mbass on February 18, 2017, 03:44:01 pm
It's just to count the time, so i know how long it takes to create a SoundBuffer.
Title: Re: Unsupported File
Post by: Laurent on February 18, 2017, 06:16:49 pm
If it prints "3300" then it's most likely not 3300 milliseconds. Read the documentation of this function before assuming anything ;)
Title: Re: Unsupported File
Post by: Mbass on February 18, 2017, 08:59:41 pm
@Laurent
I dont really get what you mean. Do i use the clock function of c++ wrong?

But i guess it's pretty off topic.

It takes a lot of time to create the SoundBuffer for me.
Any ideas?
Title: Re: Unsupported File
Post by: Hapax on February 18, 2017, 11:11:14 pm
Do i use the clock function of c++ wrong?

But i guess it's pretty off topic.
I think it's actually the point of the topic. If you're misunderstanding the value given to you by a clock reading, the amount of time that sound buffer is actually taking is not known.

Apart from your programatic timing, how long do you think sound buffer actually takes? Does your program freeze for a number of seconds? It might be something else causing that delay...
Title: Re: Unsupported File
Post by: Laurent on February 19, 2017, 10:57:46 am
Quote
I dont really get what you mean. Do i use the clock function of c++ wrong?
Where did you read that std::clock() was returning milliseconds?

Quote
But i guess it's pretty off topic.
If it's 3300 microseconds instead of 3300 milliseconds then there's no problem, so to me it's exactly on topic.
Title: Re: Unsupported File
Post by: Mbass on February 23, 2017, 01:24:18 pm
Its 3300 milliseconds. I guess i can feel the difference between 3300 microseconds ans 3300 milliseconds.

But nvm i hope i will find a way to fix it


Title: Re: Unsupported File
Post by: Laurent on February 23, 2017, 03:08:36 pm
Quote
I guess i can feel the difference between 3300 microseconds ans 3300 milliseconds.
Ok, so there is something wrong somewhere. However... if it outputs 3300 and these are microseconds, then the problem may be elsewhere. So be sure that you correctly interpret what std::clock() gives you.