Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: MCF on Tue 16/12/2003 03:59:17

Title: MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: MCF on Tue 16/12/2003 03:59:17
I have an MP3 playing in one room.  If the player interacts with object x, they are sent to another room.  I have music in the new room.  Currently, the music crossfades.  Can you specify the song to cut out instantly in this one occurance?

Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: Gilbert on Tue 16/12/2003 04:12:31
Put the following line:
StopMusic()
before the room change
Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: MCF on Tue 16/12/2003 05:02:52
That is what I have and it doesn't work.  The music is still fading out when the new room loads.  


Is there a wait function I need to put in?
Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: Gilbert on Tue 16/12/2003 05:39:38
In that case I'm not quite sure about that, probably when crossfade is on, even StopMusic() won't stop the music immediately but fade to silence instead.

I don't see any way to change the crossfade method in game (maybe I overlooked)), in that case a "trick" that may work is when you want the music to stop, temporilarly mute the music channel, then wait for a few game loops and turn it on again (which will cause a delay unfortunately):

StopMusic();
SetMusicVolume(-3);
Wait(40);
SetMusicVolume(0);

Or maybe, instead, try using the StopChannel() function and see if it makes any difference:

StopChannel(0); //channel 0 is music
Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: Scummbuddy on Tue 16/12/2003 15:12:39
On the first tab, the game options, in that, on the bottom on the left, there is a crossfade music selection,make sure its on no, or fast. try it out.
Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: MCF on Tue 16/12/2003 16:07:37
Problem is I want all the music, aside from this one time, to crossfade.  Looks like it may not be possible.
Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: juncmodule on Tue 16/12/2003 17:20:00
SetGameOption will solve your problems

Change it to not crossfade tracks just between the room change.

EDIT: To be more specific:

SetGameOption(OPT_CROSSFADEMUSIC, 0); // Crossfade off music should stop instantly

SetGameOption(OPT_CROSSFADEMUSIC,3); // Medium crossfade(or whatever your setting is)

After that, just use StopMusic();
Title: Re:MusicOff Function - Anyway to override global slow crossfade and quick cut?
Post by: Pumaman on Tue 16/12/2003 18:35:34
Yep, as junc says disable crossfading, stop the music, then re-enable it. For example:

SetGameOption(OPT_CROSSFADEMUSIC, 0);
StopMusic();
SetGameOption(OPT_CROSSFADEMUSIC, 2);