I have one more issue to this forum.I like to play two mp3 files one after other, once I tried that I got both the files playing at the same time.
Is it something wrong with my coding?
If I play two files sequentially what will be the time lag between the two files?
Thanx to the forum
- Anonymous asked 14 years ago
I play MP3’s sequentially. To do that, I constantly (once every 2 seconds) check to see if the current time is greater or equal to the end time of the file. If it is, I stop all the old one, and start the new one. This creates up to a two-second delay between songs, which I don’t much care about.
I would guess the best way is to set up a callback function. This is a function you create that FMOD calls at the end of a song. You can then start the next one with virtually no delay. It looked a bit complicated, so I didn’t bother.
[quote="MBro":9w9s6n9f]I would guess the best way is to set up a callback function. This is a function you create that FMOD calls at the end of a song. You can then start the next one with virtually no delay. It looked a bit complicated, so I didn’t bother.[/quote:9w9s6n9f]
It’s not that hard at all, at least with VC++…:
signed char endcallback (FSOUND_STREAM * stream, void * buf, int len, int param)
// Little trick to access all object members with just one paramter…
// The called method has to be public of course…
YourClass object = (YourClass)param;
YourClass::Play( … )
FOUND_STREAM *stream = FSOUND_Stream_Open( “file.mp3”, mode, 0, 0 );
There’s a small gap (I think about 0.1-0.2s) between the tracks, because the new file has to be opened, scanned, buffered, …
- Mort answered 14 years ago
Please login first to submit.