Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: khnum on Fri 27/10/2006 09:57:52

Title: seekMP3PosMillis doesn't work (SOLVED)
Post by: khnum on Fri 27/10/2006 09:57:52
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:


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?
Title: Re: seekMP3PosMillis doesn't work
Post by: monkey0506 on Fri 27/10/2006 10:20:57
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.
Title: Re: seekMP3PosMillis doesn't work
Post by: khnum on Fri 27/10/2006 10:23:19
Music3 isn't the problem, the script works, but music2 start from the beginning, not from the position i put in seekMP3PosMillis.
Title: Re: seekMP3PosMillis doesn't work
Post by: monkey0506 on Fri 27/10/2006 10:24:34
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.
Title: Re: seekMP3PosMillis doesn't work
Post by: khnum on Fri 27/10/2006 11:49:25
It doesn't work...
Anyway i don't want to use "wait", because it would block all the other script
Title: Re: seekMP3PosMillis doesn't work
Post by: monkey0506 on Fri 27/10/2006 19:11:56
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!!!
Title: Re: seekMP3PosMillis doesn't work
Post by: khnum on Sun 29/10/2006 08:50:35
I think i'll try the funk-a-delic system :(
Title: Re: seekMP3PosMillis doesn't work
Post by: Pumaman on Sun 29/10/2006 15:20:19
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.
Title: Re: seekMP3PosMillis doesn't work
Post by: khnum on Sun 29/10/2006 18:41:14
so there isn't any way to solve the problem?  :(
Title: Re: seekMP3PosMillis doesn't work
Post by: Pumaman on Sun 29/10/2006 22:49:49
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.
Title: Re: seekMP3PosMillis doesn't work
Post by: khnum on Wed 01/11/2006 15:23:41
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