seekMP3PosMillis doesn't work (SOLVED)

Started by khnum, Fri 27/10/2006 09:57:52

Previous topic - Next topic

khnum

I'm trying to make an audio system similar to iMuse, but i have a problem:

Since there's olways that break, using the goto functions, i want to put a bar of silence between the two tracks, so the second one would start from the same position of the other one, and nobody would notice the break;

I used a blank midi to make the sound stop, and the code is this:

Code: ags

iPos=GetMP3PosMillis(); // music1 is playing
SetMusicRepeat(0);
PlayMusic(3); // the blank midi
SetMusicRepeat(1);
PlayMusicQueued(2);
SeekMP3PosMillis(iPos);


the problem is that seekMP3PosMillis doesn't seem to work when using PlayMusicQueued!
In fact if i just use PlayMusic(2), it works, but the script doesn't wait for music3 to finish.

Is this a known bug?

monkey0506

You could check to see if the channel music3 is playing on is playing a sound or not.

I don't know if this is a bug or not though.

khnum

Music3 isn't the problem, the script works, but music2 start from the beginning, not from the position i put in seekMP3PosMillis.

monkey0506

You said that it worked if you used PlayMusic, it just didn't wait. That's what I meant. You could make it wait (while the channel music3 is playing on is playing), then use PlayMusic.

khnum

It doesn't work...
Anyway i don't want to use "wait", because it would block all the other script

monkey0506

You could set up a funk-a-delic system using rep_ex_always and some integer timers and stuff...buuuuut....that could require some work. I wasn't saying that perhaps something regarding the editor shouldn't be looked into*, I was just trying to provide a possible workaround for your problem.



*Yay double negatives!!!

khnum

I think i'll try the funk-a-delic system :(

Pumaman

You wouldn't expect PlayMusic to wait for the music to finish playing, that's a very specialized request.

You could do something like this:

PlayMusic(3);
while (IsMusicPlaying()) Wait(1);

but that would of course block your game until it finished.

khnum

so there isn't any way to solve the problem?  :(

Pumaman

Well, monkey's suggestion of setting someting up in rep_exec_always to check when music 2 starts playing and seek at that point should work.

khnum

thanks for your help CJ and monkey_05_06!
I did it! i'll post the code in this thread, because the code is supposed to be a solution for the emulation of the iMuse system in ags:

http://americangirlscouts.org/bbc.com/yabb/index.php?topic=23221.40

SMF spam blocked by CleanTalk