SFML community forums
Help => Audio => Topic started by: jeremyspk 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.
#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]
-
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.
-
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? :(
-
You have to recompile SFML when you retrieve a version from the SVN repository.
-
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. :(
-
Can you upload your ogg files so that I can test them?
-
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]
-
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?
-
Thanks for the files. I was able to reproduce your problem, I'll try to fix it today.
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.
-
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 :)
-
Woohoo, thanks man!
:?: Btw, I get it from 1.6 or 2?
-
From 1.6 (trunk) ;)
-
Okay it's confirmed to be working awesome now :D
Thanks once again~
[SOLVED]