I recently upgraded my version of FMOD to the latest one, however I have noticed a big problem.
I am using the standard FMUSIC functions to load and playback a MIDI file, and every second I am checking to see if the MIDI has stopped playing, so that I can load the next song. Here’s where the problem is.
Every time I make a call to FMUSIC_isPlaying, or FMUSIC_isFinished, it seems to stop my whole program for a split second, just enough to make a noticable jerk. Since I am doing this every second it is unacceptable.
This did not happen in the last version I used, playback was completely smooth.
Anyone know why this is happening, or have any ideas?
I thought about doing the isPlaying checks in a different thread, so it doesnt pause the main one, but before I do that I would like to fix it in a normal way.
- nakedostrich asked 14 years ago
I got the same problem and analyzed it a bit:
Using this code-snippet (PB):
count + 1
If ElapsedMilliseconds() – last >= 1000 ; wait 1 second
Print(count) ; display number of loop-iterations
count = 0
last = ElapsedMilliseconds()
Playing a .MID file this loop just loops about 10 times per second. So an event-handling inside the same thread is nearly unpossible.
A .S3M loops about 500000 times.
A similar loop for FSOUND_Stream_Open… and FSOUND_IsPlaying loops about 800000 times.
This is the same behaviour with FMUSIC_IsFinished()
So it seems that the call to FMUSIC_IsPlaying() / FMUSIC_IsFinished() need a lot of time when playing a MIDI-file.
I think this couldn’t be solved in another way than using a seperate thread for it ?
btw: I tried it with fmod ex, and all works fine. Using FMOD_Channel_IsPlaying(channel, @playing) on a MIDI-file loops about 500000 times per second, too.
I guess noone knows the answer to that one, oh well. If anyone does know how to stop it then I would be quite interested.
I did manage to stop the skipping, by checking FMUSIC_isPlaying in a different thread, that seems to work completely smoothly.
- nakedostrich answered 14 years ago
Please login first to submit.