Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Mikael on March 12, 2007, 10:31:48 PM

Title: Problems with continuous music
Post by: Mikael on March 12, 2007, 10:31:48 PM
I've just started playing around with WME. I'm extremely impressed by the seemingly endless possibilities, but I've decided to explore the basics thoroughly to begin with.

I'm sure that I will come up with lots of questions, and the first one has to do with music.

Let's say that I have a scene where you can walk around in a series of scenes, with the same music in all scenes. If I set the music to play like this: "Game.PlayMusicChannel(0, "music\FirstChannel.ogg", true);" in the first scene, the music will go on playing in the rest of the scenes, off course. When I return to the first scene, however, the music will start from the beginning. How do I do to make the music play seamlessly, and only start again when it's not playing? I also want the music to start playing in the rest of the scenes, when a player loads a saved game from any other scene than the first one. I guess that this means that I have to set the music just like in the first scene in all the others. That is no problem, except for the fact that when I do it, the music starts playing from the beginning in all scenes.

Thanks in advance for any possible help!
Title: Re: Problems with continuous music
Post by: Mnemonic on March 12, 2007, 10:37:34 PM
Use something like this:

if(!Game.IsMusicChannelPlaying(0)) Game.PlayMusicChannel(0, "music\FirstChannel.ogg", true);

If you load a saved game, the music will automatically resume from the point where it was playing when you were saving.
Title: Re: Problems with continuous music
Post by: Mikael on March 12, 2007, 11:17:01 PM
Worked perfectly! Thanks!