ID:146152
 
Code:
src << sound('whatever.mid',1)





spawn() src << sound('whatever.mid',1)



When I play midis for background music, set to loop, I am having a bit of a problem. Whenever it switches music, you lag for a second or so. Now I know if the sounds arent all downloaded youll have some lag downloading the songs, but even after everything downloads, you have some lag. Just testing locally on my PC, it lags for about a second when playing sounds. I've tried both methods above, with and without the spawn(). I've also tried clearing the sound before playing the next file: sound(), it doesn't help. When I comment out the line with sound, it doesn't lag. Now, these aren't incredibly huge midis, 8k -25k, but they all have some lag. Is there something I'm missing? Something I can do differently? I've played other games that do what i'm doing and see no lag between switching sounds. Thanks

-Lutelian
It all really depends on the MID.

Also, are you doing it like..
world<<sound('whatever.mid')

or
var/T=input("Play something")as sound
world<<sound(T)


Also, it can also depend on the size, obusually, it would take alot longer for a 10 minute mid than a 50 second one.

Try clean compiling, that could be your problem, but that's just really an assumption.
In response to Flame Sage
The midis are about 30 seconds to 1.5 minutes long, but like I said, they are short files. 8k to 25k (tops). I wouldn't imagine it should cause lag once they are downloaded, thats easy to load into memory a file that size. And more specifically, I am doing it like this (as I said before):



src << sound('whatever.mid',1)



Ive also tried:
spawn() src << sound('whatever.mid',1)

Other places (it lags too) I've done something like:
proc/AfterEnter(mob/M)
if (!M)
M = usr
M << sound('whatever.mid',1)

And Ive also done that with the spawn()
proc/AfterEnter(mob/M)
if (!M)
M = usr
spawn() M << sound('whatever.mid',1)


It lags, no matter how I do it, it lags when it tries to play the music.


-Lutelian