SFML community forums

Help => Audio => Topic started by: IsThisTheRealLife on November 08, 2015, 12:56:35 pm

Title: Bug on Music.Stop
Post by: IsThisTheRealLife on November 08, 2015, 12:56:35 pm
Hello, i'm using last release of csfml (https://github.com/SFML/CSFML) (in fact, i use the binaries provided by this page) in windows xp. When i load an ogg file, set it to play and stop, it sounds like the program was stuck in that segment. The file i'm using is 'cave.ogg', the music track you can find in spelunky http://www.spelunkyworld.com/original.html

My question is, is this some bug resolved in 2.4?

EDIT:
CODE HERE (http://en.sfml-dev.org/forums/index.php?topic=19320.msg139357#msg139357)
Title: Re: Bug on Music.Stop
Post by: eXpl0it3r on November 08, 2015, 02:48:12 pm
Can you provide more information on this?

When i load an ogg file, set it to play and stop, it sounds like the program was stuck in that segment.
What does that even mean? What segment? What is stuck in your opinion?

Also, what compiler do you use?
Title: Re: Bug on Music.Stop
Post by: IsThisTheRealLife on November 08, 2015, 03:02:19 pm
Can you provide more information on this?

When i load an ogg file, set it to play and stop, it sounds like the program was stuck in that segment.
What does that even mean? What segment? What is stuck in your opinion?

Also, what compiler do you use?

I dont know how to explain it, it is a phenomenon pretty common when you are listening to music and for some reason the program playing it crashes or the computer runs out of resources, like it reproduces the last thing it was playing at the moment.

Im using mingw-w64. I dont have this issue if i pause the music and then stop it.
Title: Re: Bug on Music.Stop
Post by: zsbzsb on November 09, 2015, 01:13:59 am
What version of CSFML and SFML do you have? Just linking to the repo doesn't tell me anything because there is no binaries available there. Also writing a complete and minimal example would be helpful (I kinda doubt it is an issue in CSFML as it is just a wrapper around SFML).
Title: Re: Bug on Music.Stop
Post by: IsThisTheRealLife on November 09, 2015, 11:13:55 am
I got the binaries from here http://www.sfml-dev.org/download/csfml/ (2.3 | Visual C++ / GCC - 32-bit)

Minimal example:
Code: [Select]
#include "SFML/Audio.h"

int main(int argc, char * argv[])
{
    sfMusic* music = sfMusic_createFromFile("cave.ogg");
    sfMusic_play(music);
    sleep(5);
    sfMusic_stop(music);
    sfMusic_play(music);
    sleep(5);
    printf("Done\n");
    return 0;
}

Compiled with:
Code: [Select]
gcc ex.c -o ex.exe -g3 -Wall -Wextra -pedantic -IC:csfml\include -LC:csfml\lib\gcc -lcsfml-audio
xp32
Title: Re: Bug on Music.Stop
Post by: IsThisTheRealLife on November 10, 2015, 10:24:14 am
Do i need to post anything else? It seems to me that problem happens with every audio file used, not just the one i put.
Title: Re: Bug on Music.Stop
Post by: IsThisTheRealLife on November 17, 2015, 05:39:14 pm
What version of CSFML and SFML do you have? Just linking to the repo doesn't tell me anything because there is no binaries available there. Also writing a complete and minimal example would be helpful (I kinda doubt it is an issue in CSFML as it is just a wrapper around SFML).
I'm sorry if i'm being annoying. Is this all the information you need? I dont know if you saw my post.
Title: Re: Bug on Music.Stop
Post by: zsbzsb on November 17, 2015, 09:47:21 pm
I tested your code and everything works as expected (even downloaded your game and pulled out the cave.ogg). The music plays for 5 seconds, then starts playing again from the beginning for 5 seconds and then the program exits.

When i load an ogg file, set it to play and stop, it sounds like the program was stuck in that segment.

I'm not sure what you mean by this, can you explain in more detail what is happening/what you are hearing and what you expect to happen?
Title: Re: Bug on Music.Stop
Post by: Jesper Juhl on November 17, 2015, 10:19:44 pm
If I was to guess, I'd guess that this is a case of either
1) mixing debug and release builds of the library (and/or dependencies) and the application; which usually leads to crashes or random weird results (like what you are experiencing).
2) mixing a build of the library (and/or dependencies) with one compiler version with a build of the application with a different compiler version; which often leads to crashes or random weird results (like what you are experiencing).
Title: Re: Bug on Music.Stop
Post by: IsThisTheRealLife on November 18, 2015, 05:27:44 pm
I tested your code and everything works as expected (even downloaded your game and pulled out the cave.ogg). The music plays for 5 seconds, then starts playing again from the beginning for 5 seconds and then the program exits.

When i load an ogg file, set it to play and stop, it sounds like the program was stuck in that segment.

I'm not sure what you mean by this, can you explain in more detail what is happening/what you are hearing and what you expect to happen?

I found the way to record my problem, this is what i hear.