Jibble

A redesign of the AGS site is now ready to be implemented! Please help us with art and content.

Author Topic: How to play a music just after the previous song is ended?  (Read 290 times)

Hi,

Let's assume there is a room in the game that has so-called intro-music that is played, when the player enters to the room. When the intro-music is ended, the "main" music starts and loops as long as the player is in the room.

Is there a useful way in AGS to implement this kind of functionality? To check, if "previous" music is ended, and just then start the new one, and let it loop, until the player leaves the room?

It should be something like this:

Code: Adventure Game Studio
  1. aIntroMusic.Play(eAudioPriorityNormal, eOnce);
  2. aMainMusic.PlayQueued(eAudioPriorityNormal, eRepeat);

Correct, however this will only work as expected if there's only one channel available for the sound type. That might be the default for music anyway, just thought I'd point it out.

Trumgottist

  • Game maker (considering starting to use AGS)
    • I can help with making music
Correct, however this will only work as expected if there's only one channel available for the sound type. That might be the default for music anyway, just thought I'd point it out.
Does this mean that this sort of thing is not possible to setup if you want more than one music channel? I'm assuming that is a setting that can't be changed while running the game.

I have found the "crossfade tracks" setting in the audio properties. That would possibly solve that problem (since transitions are the main thing I imagine I'd want to use multiple music channels for), but only if it can be toggled by a script, and I haven't found how to do that. Is that possible? I want to crossfade the music in general, but I also want the ability to do a hard cut between scenes.

Take a look at the manual's section for SetGameOption (in Global functions (general section)).

Code: Adventure Game Studio
  1.   SetGameOption(OPT_CROSSFADEMUSIC, 0); // turn off cross fading
  2.   SetGameOption(OPT_CROSSFADEMUSIC, 1); // slow cross fading
  3.                               // or 2, 3
  4.   SetGameOption(OPT_CROSSFADEMUSIC, 4); // fast fading