Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Problems with volume setting  (Read 3401 times)

0 Members and 1 Guest are viewing this topic.

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • View Profile
    • MDNA Games
Problems with volume setting
« on: June 06, 2008, 01:30:55 PM »

This is driving me crazy. I don't remember having any problems whatsover with this thing before, but now I simply can't get it to work. I'm probably just missing the obvious.

When I initialize the playing of a sound file, and immedeately want to set the volume to let's say 40, I put it down like this:

Game.SetMusicChannelVolume(1, 40);
Game.PlayMusicChannel(1, "sounds\soundfile.ogg", true);

What happens is that the sound file starts playing at 100 regardless of how I try to change the code. Changing it to 40 using the first line in whatever piece of code after the sound file has started to play always works for me though.

Whjat am I doing wrong?

Thanks in advance,

Mikael
Logged

manarius

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 27
  • node it. node it all together my brethren :)
    • View Profile
    • Thats one of our Games :-)
Re: Problems with volume setting
« Reply #1 on: June 06, 2008, 01:55:58 PM »

i dont use the soundchannel right now (our project is currently at milestone 1 of 6) :)
i think you can handle this by doing this:
Game.SetMusicVolume = 0;
Game.PlayMusic("filename");
Game.SetMusicVolume = 40;

so just setting the MusicVolume to 0 before you start playing the music.
dont know if there is a higher sophisticated way to do that.

hope i could be of help.
greetings
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: Problems with volume setting
« Reply #2 on: June 06, 2008, 02:16:33 PM »

Mikael, you must switch those lines. From my experience volume can be set after the channel plays.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • View Profile
    • MDNA Games
Re: Problems with volume setting
« Reply #3 on: June 06, 2008, 03:19:35 PM »

Thanks the both of you. But unfortunately, none of the methods work. The sound starts playing at 100 no matter what. Metamorphium, it indeed seems like the volume can be set only after the channel plays (as opposed to the Game.PlaySound command, where I set the volume in the first line all constantly, with no problem), but it doesn't even seem to be possible to set it in the the same block of code. I even used the sleep command between my two lines of code just to see what happens, but the sound still keeps playing on 100.

In my game, you will approach a river, and the sound volume from the river must increase as you are getting closer. As it seems now, the only thing you can do with this command is to decrease the volume? (And then increase it after that).

Of course, I can make separate sound files in different volumes and switch between them, but I really hope that there is a more convenient solution.

Thanks,

Mikael
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5679
    • View Profile
    • Dead:Code Site
Re: Problems with volume setting
« Reply #4 on: June 06, 2008, 03:22:54 PM »

Is there any reason for not using PlaySound for this purpose?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Problems with volume setting
« Reply #5 on: June 06, 2008, 03:43:42 PM »

There's  something fishy with your code. I use this always and it works for me well. Can't it be there's some code which interferes with your Game.PlayMusicChannel?

As I really heavily rely on music channels, I never run into problems like this.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • View Profile
    • MDNA Games
Re: Problems with volume setting
« Reply #6 on: June 06, 2008, 06:25:13 PM »

I donät think using PlaySound is possible, since I use that all over the scene for other sounds, like lifting and dropping things, etc. As I understand it PlaySound only relies on one channel.

Or is there some way I can use PlaySound over several channels? That would be terrific.

Meta, I don't understand where the fishiness could possible lie.

Thanks,

Mikael
« Last Edit: June 06, 2008, 06:35:27 PM by Mikael »
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: Problems with volume setting
« Reply #7 on: June 06, 2008, 07:32:54 PM »

You can of course play as many sounds as you like. Simply create entity (or use some in the scene editor) and call
entity.PlaySound();

or make a global entity:

global sound = Game.CreateEntity();

and

sound.PlaySound() allows you to have the sound playing even while changing scenes.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • View Profile
    • MDNA Games
Re: Problems with volume setting
« Reply #8 on: June 07, 2008, 06:07:53 PM »

So that's how it's done. Thanks.

Mikael
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: Problems with volume setting
« Reply #9 on: June 08, 2008, 10:14:32 AM »

I don't want to push it but ...

http://res.dead-code.org/doku.php/wmebook:ch10
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.574 seconds with 23 queries.