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

Author Topic: Looping crashes at the 3rd time  (Read 5787 times)

0 Members and 1 Guest are viewing this topic.

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« on: February 01, 2010, 09:35:32 am »
I've got two tracks playing (tried both .wav and .ogg, same thing)
I set both to loop endless, so:
1) First time plays smoothly
2) Transits to the 2nd time seamlessly
3) But crashes at the 3rd time.
Crash can be described as repetitive 0.5sec of a portion of the sound clip. So if song is "You are my sunshine", the program just repeats "You are... You are... You are... You are... ... ..." (Hope this explains clearly)

Info about audio clips:
Both clips have length of 8 seconds.
.wav and .ogg same problem.
if it helps, it's the usual 16bit 44100hz.
Code: [Select]

#include <SFML/Audio.hpp>
#include <iostream>

using namespace std;

int main()
{
cout << "Welcome" << endl;
//Load music
sf::Music musik;
if (!musik.OpenFromFile("rockdrums.ogg"))
return EXIT_FAILURE;
sf::Music musik2;
if (!musik2.OpenFromFile("rocksynth.ogg"))
return EXIT_FAILURE;

musik.SetLoop(true);
musik2.SetLoop(true);

musik.Play();
musik2.Play();

cout << "Playing...";

while(1) { };

cout << "End..." << endl;
return EXIT_SUCCESS;
}
[/code]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Looping crashes at the 3rd time
« Reply #1 on: February 01, 2010, 09:45:16 am »
You should try SFML 1.6, it is available from the SVN repository (there's also a snapshot archive on the downlad page). I made one or two fixes to sf::Music since version 1.5.
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« Reply #2 on: February 01, 2010, 10:09:02 am »
okay I svn-ed the from the /tags/1.6 folder and copied to replace the vc/include/sfml

and i found the lib to be empty, so no action.

Still don't work.

Is it a bug? or my part? :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Looping crashes at the 3rd time
« Reply #3 on: February 01, 2010, 10:18:38 am »
You have to recompile SFML when you retrieve a version from the SVN repository.
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« Reply #4 on: February 01, 2010, 10:47:17 am »
okay recompiled. copied the lib files to vc\lib
(and previously did the includes)

also replace the audio-d.dll of my .exe folder

re-compiled my code and ran.

no joy, still fails at 3rd time. :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Looping crashes at the 3rd time
« Reply #5 on: February 01, 2010, 10:56:43 am »
Can you upload your ogg files so that I can test them?
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« Reply #6 on: February 02, 2010, 02:44:14 am »
http://www.yousendit.com/download/S1VCOU1RMm1xRTNIRGc9PQ


Here's the link with:
RockDrums.wav
RockDrums.ogg
RockSynth.wav
RockSynth.ogg

all 8 seconds, 120tempo, 16bit 44100hz (bounced from Logic Express)

Thanks for help!  :)[/url]

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« Reply #7 on: February 02, 2010, 03:47:10 am »
Hi Laurent,

I tried using LoadFromFile Soundbuffer into Sounds to play,
the loop seems to work well.


I'm just wondering if the nature of my project allows using sounds without overloading the memory.
I'm making a music looper engine with short audio clips such as those uploaded the previous post, and should go up to say 20-30 sounds clips?
How many tracks can SFML play simultaneously?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Looping crashes at the 3rd time
« Reply #8 on: February 02, 2010, 08:11:32 am »
Thanks for the files. I was able to reproduce your problem, I'll try to fix it today.

Quote
I'm making a music looper engine with short audio clips such as those uploaded the previous post, and should go up to say 20-30 sounds clips?
How many tracks can SFML play simultaneously?

There's a software and a hardware limit, but I think you can safely go up to 64 sound sources.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Looping crashes at the 3rd time
« Reply #9 on: February 02, 2010, 08:52:59 am »
I solved the problem. It was caused by your music duration of 8.00 sec, which is an exact multiple of the internal buffer size (1.00 sec) and caused a buffer to have a size of 0 and to be discarded from the streaming queue after each loop. As SFML uses 3 internal buffers for streaming, you were stuck after 2 loops (no more buffer left in the queue).

Anyway, it's now fixed, thans a lot for your help :)
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« Reply #10 on: February 02, 2010, 09:07:09 am »
Woohoo, thanks man!

:?: Btw, I get it from 1.6 or 2?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Looping crashes at the 3rd time
« Reply #11 on: February 02, 2010, 09:12:55 am »
From 1.6 (trunk) ;)
Laurent Gomila - SFML developer

jeremyspk

  • Newbie
  • *
  • Posts: 26
    • View Profile
Looping crashes at the 3rd time
« Reply #12 on: February 02, 2010, 09:28:22 am »
Okay it's confirmed to be working awesome now :D
Thanks once again~

[SOLVED]

 

anything