Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Game.PlayMusicChannel behaviour  (Read 6224 times)

0 Members and 1 Guest are viewing this topic.

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Game.PlayMusicChannel behaviour
« on: March 04, 2007, 02:31:36 PM »

Hi,

I just found out that Game.PlayMusicChannel() is not affected by the global music volume. Is it supposed to always play at 100%? If I do a crossfade between two channels it uses the global music volume as the aim value, but if I play a track with a simple call of Game.PlayMusicChannel (for example after stopping the backround music) it always plays at 100%. Do I have to set the channel volume acoording to the global music volume explicitly after each call of Game.PlayMusicChannel?

Mac
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.PlayMusicChannel behaviour
« Reply #1 on: March 04, 2007, 07:28:36 PM »

Hi. It normally works.

I am using Game.PlayMusicChannel quite often and I've just tried that Game.SetGlobalMusicVolume(); and it affected all played channels.

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Game.PlayMusicChannel behaviour
« Reply #2 on: March 04, 2007, 09:27:04 PM »

Hi,

I changed the wme_demo project a bit to show you what I mean. First I changed the global music volume to 60 in game.script. I added a second music track that is played in the street scene. On every scene change the volumes of both global music volume and music channel volume of channel 0 are shown using Game.MSG(). Use the space bar to stop the music.

As you will see the demo will start in the room scene with the narco track playing at 100%, though the global music volume is 60%. You leave the room and my added track will crossfade in at 60% (like it should be). If you go back in then, narcos track will be played at 60%. Everything works fine then until you stop the music with space bar. If you change the scene then, the new track should be played at 60% but it will play at 100%, because it's a simple Game.PlayMusicChannel(0,"blah") instead of a crossfade.
To add it up: Crossfading works with the global music volume, while a simple Game.PlayMusicChannel(0,"blah") will always play at 100%.

Here's the link: http://mac-bs.de/temp/wme_demo.rar

Mac
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.PlayMusicChannel behaviour
« Reply #3 on: March 04, 2007, 10:06:37 PM »

it looks to me that it works fine. What wme version do you use?

also there are some errors:

22:07: Runtime error. Script 'scenes\room\scr\scene_init.script', line 61
22:07:   Game.MusicCrossfade: Music crossfade is already in progress.

maybe you caught some transition state since this is not handled?
« Last Edit: March 04, 2007, 10:08:25 PM by metamorphium »
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.PlayMusicChannel behaviour
« Reply #4 on: March 04, 2007, 10:33:36 PM »

Ok, so the problem is not in PlayMusicChannel, but in MusicCrossfade, because it doesn't use the correct target volume. Rather it sets the volume to a percentage of a percenatge, so to say. In this case, after the crossfade the music ends up playing at 60% volume of 60% (global) volume. Gonna fix that for 1.7.2. (the funny thing is it was originally working ok, but I "fixed" it somewhere along the way)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Game.PlayMusicChannel behaviour
« Reply #5 on: March 04, 2007, 11:04:30 PM »

Quote
it looks to me that it works fine. What wme version do you use?

I use 1.7.1. And it seems to work fine for you?

Quote
22:07: Runtime error. Script 'scenes\room\scr\scene_init.script', line 61
22:07:   Game.MusicCrossfade: Music crossfade is already in progress.

I also recognized this. It occurs if you change the scene too fast (while a crossfade is in progress). Is there a way around this? By the way, even if I wait till the crossfading is done, the sound issue occurs.

Quote
In this case, after the crossfade the music ends up playing at 60% volume of 60% (global) volume.
That would explain why the changes of the music volume slider affects the music that MUCH that it does actually in our game. But to get back to the example:  Even if you set the global music volume to say 10%, it's always played "loud" on a single Game.PlayMusicChannel() call. That can't have to do with crossfading, or did I get something wrong?

Mac
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.PlayMusicChannel behaviour
« Reply #6 on: March 04, 2007, 11:32:34 PM »

I am unable to replicate this "loud" behavior. What steps verbatim should I take o achieve your effect?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Game.PlayMusicChannel behaviour
« Reply #7 on: March 04, 2007, 11:39:40 PM »

Just start the demo, hear the narco track. Go outside. Go back in and the narco track is played a lot more silent (for me at least).

Mac
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.PlayMusicChannel behaviour
« Reply #8 on: March 04, 2007, 11:56:21 PM »

yes. that's why the MusicCrossfade is guilty because it affects both: global music volume and channel volume

Look at it this way:

your channel has some volume (0 - 100 %) which is underneath the Global Volume

So if you set GlobalMusicVolume to 50%, then the MusicChannelVolume will be 0-100% of the 50%.
This way you can easily make global music volume slider and still have different volumes for different tracks ingame.

But here is indeed a bug as Mnemonic mentioned and he'll repair it. I never used Crossfade (have my own object for this) so
I never encountered this bug.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.PlayMusicChannel behaviour
« Reply #9 on: March 05, 2007, 08:23:26 AM »

But to get back to the example:  Even if you set the global music volume to say 10%, it's always played "loud" on a single Game.PlayMusicChannel() call. That can't have to do with crossfading, or did I get something wrong?
I didn't try 10%, but in your demo when you restart the music it plays at the correct 60% volume, unlike when you revisit the scene, when it plays at lower volume than it should (after the xfade) (unless I'm missing something else, of course).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Game.PlayMusicChannel behaviour
« Reply #10 on: March 05, 2007, 06:52:20 PM »

Yes, you're right. I tested it with my headphones today and it's definitely the crossfade function as you say.

Mac
Logged
 

Page created in 0.04 seconds with 19 queries.