[ACS] SetMusicVolume

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: Developers

[ACS] SetMusicVolume

Postby NeuralStunner » Tue Aug 21, 2012 9:26 pm

[Local]SetMusicVolume (fixed Volume[, fixed FadeTime[, int FadeType]])

Sets the relative volume of the background music. This would be a multiplier to the user's snd_musicvolume setting: 1.0 to the function is considered normal volume.

FadeTime: How many seconds to fade the music across. Use 0 (the default) to instantly change the volume.
FadeType: Linear or Logarithmic. (Not vital, choose the best option and use that.)

When used repeatedly in a script with steadily lower/higher values, this can be used to fade music out/in. (Blzut suggested building the fade feature directly into the function, particularly in Zandronum's case it would allow the server to send a single packet for fading the volume.)

The song can be gracefully faded to silence before a special event, or quieted in certain situations (E.G. character dialog).

LocalSetMusicVolume would affect only the activator.
Last edited by NeuralStunner on Thu Jun 06, 2013 5:31 pm, edited 1 time in total.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: [ACS] SetMusicVolume

Postby Ral22 » Thu Aug 23, 2012 9:06 pm

Personally, I would find this to be very helpful, and a neat feature.

I always thought the unused parameter in SetMusic would be for something like this.
User avatar
Ral22
stoneshipMapper
 
Joined: 05 Sep 2010
Location: Lone Isle

Re: [ACS] SetMusicVolume

Postby Kate » Thu Aug 23, 2012 9:09 pm

It was intended as a duration for cross-fading from the previous track, but that was never actually implemented.

Thinking about it, that would be fine, if 0 was changed to mean "use the previous volume level", since I'm pretty sure the default is 0 anyway, so if the default was full volume, it would keep compatibility with existing scripts. There's no real reason you'd want 0-volume music anyway since you can just SetMusic ("");, and if you want to keep the music running, it's be fine to set it to something really super low like (int)1 which would be close enough to inaudible that it shouldn't matter.
User avatar
Kate
Will love and tolerate THE SHIT out of you
 
Joined: 15 Jul 2003
Location: New Jersey, US

Re: [ACS] SetMusicVolume

Postby DavidPH » Fri Aug 24, 2012 4:34 pm

For what it's worth, I would prefer to see a separate function. Smaller, more specialized instructions tend to be more useful and generalized in the long run than trying to push too much into one function. Not to drop names, but A_SpawnItemEx.

Plus, 0 should mean 0 whenever possible. And in this case, I think it would be algorithmically detrimental for 0 to be a special case.

Also: I believe NeuralStunner meant multiplicative, not additive. And if not, he should have meant that. :P
DavidPH
<shamelessplug>
 
Joined: 28 Aug 2009

Re: [ACS] SetMusicVolume

Postby NeuralStunner » Fri Aug 24, 2012 5:27 pm

I meant "in addition to", meaning it wouldn't affect the user setting itself. But yes, multiplicative. :P
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: [ACS] SetMusicVolume

Postby NeuralStunner » Thu Jun 06, 2013 5:32 pm

Was discussing this with Blzut, and decided to make a couple additions.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: [ACS] SetMusicVolume

Postby Watermelon » Fri Jun 07, 2013 10:44 am

This would be pretty awesome. I don't know if it can be done for MIDI's, but hopefully it can be done for WAV/OGG/MP3/other standard music types.
Watermelon
 
Joined: 19 Jan 2012

Re: [ACS] SetMusicVolume

Postby Nash » Fri Jun 07, 2013 11:51 am

How about crossfading between two songs? That would be an amazing feature to have.

However, crossfading MIDIs aren't fundamentally possible... you can't crossfade between 2 MIDIs that don't share the same amount of tracks or program mapping. It's just illogical.
User avatar
Nash
http://twitter.com/ISurvivorGame
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: [ACS] SetMusicVolume

Postby Gez » Fri Jun 07, 2013 1:12 pm

You could crossfade between two MIDIs actually. The obvious way would be to have two instances of the MIDI synth.

Then there's whatever method LucasArts' iMUSE used.
Gez
 
Joined: 06 Jul 2007

Re: [ACS] SetMusicVolume

Postby NeuralStunner » Fri Jun 07, 2013 1:49 pm

Watermelon wrote:This would be pretty awesome. I don't know if it can be done for MIDI's, but hopefully it can be done for WAV/OGG/MP3/other standard music types.
Well, if the engine has an internal volume for a music type, (it does for MIDI,) it would presumably work.

IIRC the issue with crossfading (I.E. why we don't have it yet) is that ZDoom only supports one music stream. So that would need an overhaul.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: [ACS] SetMusicVolume

Postby Major Cooke » Sun Jun 09, 2013 11:33 am

Nash wrote:How about crossfading between two songs? That would be an amazing feature to have.


Called it: Right off of Painkiller, am I right? I so approve of this. :D
User avatar
Major Cooke
That's how my uncle stole christmas three times in a row in a single year. -DBT
 
Joined: 28 Jan 2007


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest