Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mantra of Doom on Sat 22/11/2008 19:15:40

Title: music coding (solved)
Post by: Mantra of Doom on Sat 22/11/2008 19:15:40
I think I need some expert help here. I'm using AGS 3.0 and I'm trying to queue up some music to start during a cutscene. The song that starts in the cutscene is called Music5.mid. It should play once and then go back into the normal music called Music4.mid which will play until an action sequence later in the game.

It seems like I'm doing this right, and this works flawlessly in an earlier part of the game, but in this bit, as soon as the cutscene starts, Music5 is skipped and it goes back to Music4.


    StopMusic(); //stops current music
    PlayMusic(5); //starts's the Date Theme
    SetMusicRepeat(1); //loop the Explore music
    PlayMusicQueued(4); //plays the Explore music


I've tried several variations, and the only way I got this to work is to comment out the playing the explore music... but that would leave silence if the player didn't know where they were supposed to go and didn't get to the next part before the song ended.

Any ideas?
Title: Re: music coding
Post by: RickJ on Sun 23/11/2008 14:48:53
I think you need to use the PlayeMusicQueued() function.

http://www.adventuregamestudio.co.uk/manual/PlayMusicQueued.htm (http://www.adventuregamestudio.co.uk/manual/PlayMusicQueued.htm)
Title: Re: music coding (solved)
Post by: Mantra of Doom on Sun 23/11/2008 18:07:52
Thank's RickJ. Again, I think this might be the wrong approach but I finally got things to work.


    StopMusic();
    PlayMusic(5);
    SetMusicRepeat(0);
    PlayMusicQueued(5);
    SetMusicRepeat(1);
    PlayMusicQueued(4);



Since it kept skipping over the PlayMusic(5), and changing that PlayMusic(5) to PlayMusicQueued(5) didn't work, I just added the extra line and it worked.

Title: Re: music coding (solved)
Post by: on Tue 05/04/2011 23:48:46
I have the same question, but you guys solved it. Weird to think the answer came from a game I wrote the music for! Was there ever a reason for this? It's just one music queued out of the lot of them. Weird. Oh well. Good old 2.72. Sorry to drag up an old thread. It was just too co-incidental not too. I'll just add my 2 cents and say the above solution by Andrea works well!