I just downloaded the new 3.2 final version of AGS which converted all my "PlayMusic()"s in my rooms into "aMusic().Play"s automatically. Along with this (and with the removal of the room music drop-down in the editor for each room) the music now restarts every time my character enters a new room, even if it is supposed to be continuing the same song.
I tried fiddling with moving the Music.Play command from the "before fade in" part of the room script to the "after fade in" part and this didn't change anything. I also tried fiddling with music priorities and number of channels, but it didn't help anything. Adding more channels just got the same song stacking on top of itself when I entered a new room.
I liked the old way a song would just continue playing if the new room had the same song set to play as the last room. Is there any way to make this happen again?
It is still that way, just don't add aMusic.Play() at the start of each room.
But sometimes there is an adjoining room with different music, so when I transition the music between rooms I have to put the aMusicPlay, right? I only want the music to restart when the songs actually change though. Some rooms share music, some rooms have different music.
Exactly, only put the aMusic.Play() in the rooms that actually change music. And it should be fine.
But a room can be next to a room with the same music and a room with different music at the same time. Say Room B sits between Room A and Room C, and Room B and A both play Music 1, but Room C plays Music 2. I want the music to change when going from Room C to B, but not from Room B to A, since they share music.
If I put the aMusic1.Play in Room B it will restart the music even when coming from Room A. I guess I'll have to put the aMusic.Play in the "when player leaves room" script of Room C instead of the "after fade in" script of Room A.
Thanks for your replies.
I always put the following in the Room_Load area. For such things:
if (cEgo.PreviousRoom == 40) aMusic.Play()
That type of thing :)
Ah, that helps. Thank you. :)
Something like this should work:
// Global.ash
import void ChangeMusicTo(AudioClip*clip);
// Global.asc
AudioChannel*main_music;
void ChangeMusicTo(AudioClip*clip) {
if (!main_music.IsPlaying || main_music.PlayingClip != clip) main_music = clip.Play();
}
Now call
ChangeMusicTo(aMusic);
in the room's before fadein.
Untested!