Changing Background Music Levels

Started by greg, Sun 31/07/2005 14:56:07

Previous topic - Next topic

greg

Hi, I'm trying to set backgroung music levels via GUI.  I've read the threads in the archive about the subject, but it doesn't seem that they've come to any real resolution.

Rather than using SetMasterMusicVolume(), which can't control background music independently of the room-based SetMusicVolume(), I'm trying to manipulate the music directly via SetChannelVolume(0, desiredVolume).

This controls the music volume accurately (i.e. 0 silences the music, and 255 makes it really loud), but, whenever a character speaks, the background music reverts to its previous level.  Do you know why this would be?

In any event, here are excerpts from my script for reference...

function game_start() {
  if (IsMusicVoxAvailable() == 0) {
    ...
  } else {
     SetChannelVolume(0, 128); // set initial volume level
  }
}

// in the GUI code
    ...
    } else if (button == 12) { // player presses OK, change volume levels
      SetDigitalMasterVolume(GetSliderValue(SOUND, 6));
      SetSpeechVolume(GetSliderValue(SOUND, 0));
      SetChannelVolume(0, GetSliderValue(SOUND, 1)); // background music
      SetSoundVolume(GetSliderValue(SOUND, 4));
      SetVoiceMode(GetGlobalInt(98));
      GUIOff(SOUND);
    }
    ...

Thanks for your help!

Greg

Pumaman

The music volume does get automatically reset at various points, so using SetChannelVolume on it won't work very well.

I have to admit, the whole volume thing in AGS is rather a mess with several different volume commands that are all sort of relative to each other. I'd love to completely re-do it, but it's a matter of finding a way to do so that doesn't break backwards compatibility.

Etcher Squared Games

I personally have no issues with making a future version of AGS that is not back compatible.  I think in order to make the software the best it can be you should occassionally break stuff.  As you said yourself about the music how you'd like to redo it.

You'd just have to keep publicly posted the "benchmark" versions.

Say 2.7 is a benchmark.  Keep that posted
Then in 3.0 you revamp the music as you'd like to.  Ok, that becomes a new benchmark. 

Hopefully the # of benchmarks is kept to a minimum, but if something just isn't quite right, I say, go for it, make the change.
Just have a note on the page and maybe even put a check in the software ..."You are trying to upgrade accross benchmarks.  Your game WILL break.  You have been warned!!!"

something like that.

That's my opinion
website: http://www.etcher2games.com/
email: etcher2games@yahoo.com
forum: http://www.etcher2games.com/forums

Anyone want to make my website for free?

Rui 'Trovatore' Pires

Yikes. No way! Backward compatibility is one of the reasons we love AGS' method! Things don't disappear until after a long time, when we're sure no one's using them. Backward compatibility makes everyone happy. Heck, with backward compatibility I can start downloading and using betas right away and provide CJ with actual user feedback! And with BC I don't have to start on a whole new game!!! I'd hate to be 50 rooms into a game, find I need a feature, have a new AGS version with THAT feature out just then by happy coincidence, and then not be able to USE the new version!

I trust CJ will find a way to do it. It'll take him some time, but it will get done. In the meantime, there's always a way to get around every problem. Even Greg's, I'm sure, though I don't really know what that way might be.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Pumaman

Ok, well how would people like volume control to work?

At the moment there are three different controls:

SetMusicVolume
SetMusicMasterVolume
SetDigitalMasterVolume

Now, perhaps the best solution would be:

* SetDigitalMasterVolume -- keep the same, controls overall sound output volume
* SetMusicVolume -- should be equivalent to SetChannelVolume(Music_Channel) and allows setting music volume within the overall volume
* SetRoomVolume -- like the old SetMusicVolume, applies a modifier to the room channel volume

As far as I understand it, the main problem with the current setup is that you can't silence the music since SetMusicMasterVolume(0) doesn't make it quiet enough. Is that the case?

greg

Quote from: Pumaman on Wed 03/08/2005 18:12:33
Ok, well how would people like volume control to work?

At the moment there are three different controls:

SetMusicVolume
SetMusicMasterVolume
SetDigitalMasterVolume

Now, perhaps the best solution would be:

* SetDigitalMasterVolume -- keep the same, controls overall sound output volume
* SetMusicVolume -- should be equivalent to SetChannelVolume(Music_Channel) and allows setting music volume within the overall volume
* SetRoomVolume -- like the old SetMusicVolume, applies a modifier to the room channel volume

As far as I understand it, the main problem with the current setup is that you can't silence the music since SetMusicMasterVolume(0) doesn't make it quiet enough. Is that the case?

Your proposed solution sounds great.  (In answer to your question, yes, the main problem is the inability to make background music silent using the volume slider.)

strazer

Sorry for the bump.

Quote from: Pumaman on Wed 03/08/2005 18:12:33
Ok, well how would people like volume control to work?

I just wanted to say that I hope you won't drop the idea because of lack of feedback. Your solution sounds good to me and I'm sure most people agree.

Anyway, I have updated the tracker entry with your comments.

Akumayo

I definately agree, especially with the SetMusicMasterDigitalVolume(x);

I think that's a really good idea, it'd be just like the person changing their speaker volume!  Excellent!  I would like to have something like that anyway, and I rarely use music.
"Power is not a means - it is an end."

simulacra

Would SetMusicMasterDigitalVolume affect video playback as well? I have noticed some annoying sound volume changes when using video (i.e. video gets much louder than rest of the game).

strazer

#9
Sorry to bump this again but I feel this issue really needs to be addressed.

I tried to work around it using SetChannelVolume on the music channel 0 but that's not really practical since its volume gets automatically reset at various points in the game, as CJ said.
I then tried to use it in combination with SetMusicVolume(-3) and that seems to work alright, but how would I revert it to the room's preset volume adjustment when music is re-enabled since I haven't found a way to retrieve this information from a room.

Surely, there must be an easier way to give players the option to disable digital music without manually having to set a flag and check that before playing each music track? Especially since that would also make the "Play music on room load" option useless.

Edit:

Hm, unless of course you check the flag and immediately call StopMusic in on_event...but still.

Pumaman

The main difficulty in implementing this change is to ensure backwards compatibility, so it needs some thought. It's certainly something I'll think about for 2.72.

As for disabling music I agree -- this tracker entry is still outstanding:
http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=362

Traveler

How about leaving the current sound functions as they are (so they will keep working with older code.) Later on you can phase them out (over, say 2 versions down the road.) They would reset as they do new in game, so current behavior is intact.

For the new sound management method, introduce a global Sound object that has all the methods to deal with sound (like setting/retrieving master sound settings and sound settings for the current room, etc.) It should have methods to explicitly reset these properties from game script, too.

The Sound object should have a property to reset room-related properties when a room change happens or it should have a room event in which the room script code can reset it explicitly, when there is a need. If the room doesn't reset the room-related sound properties, everything stays as they were in the previous room.

I don't have a lot of experience with sound programming, so this idea may have some technical limits.

If it would work, at the introduction of the new Sound object, you could start telling people to not to use the old sound methods anymore, because they're going away in 2 versions. This would give time to everyone to prepare for it.

SMF spam blocked by CleanTalk