2018-10-17 02:57 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0003150FSSCPSEXPspublic2015-04-10 20:18
ReporterAxem 
Assigned Toniffiwan 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.7.2 RC5 
Target VersionFixed in Version 
Summary0003150: Adjusting music volume doesn't work with sexps
DescriptionIn the sexp_adjust_audio_volume() function (line 10487ish) there's a lookup function to see what selected option corresponds with its integer index. Music is 0, Effects is 1, Voice is 2. The issue occurs after the look up when we get...

if (option > 0)

Which won't include music (0). *Sadfaec*

Can we get an extra equals sign up in there?
TagsNo tags attached.
Attached Files
  • patch file icon mantis3150-svn.patch (1,234 bytes) 2015-03-18 06:18 -
    Index: code/parse/sexp.cpp
    ===================================================================
    --- code/parse/sexp.cpp	(revision 11284)
    +++ code/parse/sexp.cpp	(working copy)
    @@ -10490,7 +10490,7 @@
     
     	if (n > 0) {
     		int option = audio_volume_option_lookup(CTEXT(n));
    -		if (option > 0) {
    +		if (option >= 0) {
     			n = CDR(n);
     
     			float target_volume = 1.0f;
    Index: code/sound/sound.cpp
    ===================================================================
    --- code/sound/sound.cpp	(revision 11284)
    +++ code/sound/sound.cpp	(working copy)
    @@ -12,6 +12,7 @@
     #include "render/3d.h"
     #include "sound/sound.h"
     #include "sound/audiostr.h"
    +#include "gamesnd/eventmusic.h"
     #include "cmdline/cmdline.h"
     #include "osapi/osapi.h"
     #include "globalincs/vmallocator.h"
    @@ -1518,6 +1519,12 @@
     	//apply change
     	*volume_now = data->start_volume + (data->delta * done);
     	CLAMP(*volume_now, 0.0f, 1.0f);
    +
    +	// if setting music volume, trigger volume change in playing tracks
    +	// done here in order to avoid setting music volume in every frame regardless if it changed or not
    +	if (&aav_music_volume == volume_now) {
    +		audiostream_set_volume_all(Master_event_music_volume * aav_music_volume, ASF_EVENTMUSIC);
    +	}
     }
     
     void snd_aav_init()
    
    patch file icon mantis3150-svn.patch (1,234 bytes) 2015-03-18 06:18 +

-Relationships
+Relationships

-Notes

~0016566

MageKing17 (developer)

Seems straightforward enough.

~0016567

niffiwan (developer)

Seems fine to me, I just haven't tested running the sexp

~0016569

MageKing17 (developer)

Actually, I'm unassigning this from me because it's really Axem's fix; I just turned it into a .patch file.

~0016570

niffiwan (developer)

Last edited: 2015-03-18 06:20

View 3 revisions

I've tested the change and I think there's another issue here. I set the music volume to 0% at 5 secs, then back to 100% at 20 secs with "$Event Music: 5: Deuteronomy". The music doesn't change volume at 5 secs, and it fades away completely just before 20 secs and doesn't return (ever!) unless I modify the volume in the F2 Options screen, or press escape, or take some other action.

Anyway, I'm poking around further to see if I can figure out what's going on.

Update: music from play-sound-from-file also doesn't change volume. I suspect that there's nothing (re)setting the music volume except when a track starts, e.g. when event music switches, or a loop restarts.

Update2: I think I've found the issue and have added code to trigger a volume change for all music when the music volume is changed. See attached patch mantis3150-svn.patch. I've tested this with event music and play-sound-from-file. Could you give it a test to see if it works as expected in your test case(s) as well?

~0016583

niffiwan (developer)

Here's a binary to test with: http://www.mediafire.com/download/icrdaaa73rrpi93/fs2_open_3_7_1_SSE2_mantis3150.7z

~0016612

Axem (reporter)

The build didn't seem to have the patch applied since it didn't fix the problem.

But I took the patch and applied it to my own stuff here and the resulting build fixed all the issues.

Hooray!

~0016638

niffiwan (developer)

:headdesk:
I have really got to test those Windows builds before publishing them... regardless, thanks for testing!

~0016639

niffiwan (developer)

Fix committed to trunk@11299.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2015-03-17 22:42 Axem New Issue
2015-03-17 23:42 MageKing17 Note Added: 0016566
2015-03-17 23:42 MageKing17 Assigned To => MageKing17
2015-03-17 23:42 MageKing17 Status new => code review
2015-03-17 23:45 MageKing17 File Added: sexp.cpp.patch
2015-03-18 00:09 niffiwan Note Added: 0016567
2015-03-18 02:12 MageKing17 Note Added: 0016569
2015-03-18 02:12 MageKing17 Assigned To MageKing17 =>
2015-03-18 05:13 niffiwan Note Added: 0016570
2015-03-18 05:59 niffiwan Note Edited: 0016570 View Revisions
2015-03-18 06:18 niffiwan File Added: mantis3150-svn.patch
2015-03-18 06:20 niffiwan Note Edited: 0016570 View Revisions
2015-03-18 18:02 MageKing17 File Deleted: sexp.cpp.patch
2015-03-18 18:02 MageKing17 Assigned To => niffiwan
2015-03-18 18:02 MageKing17 Status code review => assigned
2015-03-18 18:03 MageKing17 Status assigned => code review
2015-03-28 00:16 niffiwan Note Added: 0016583
2015-04-07 21:39 Axem Note Added: 0016612
2015-04-10 20:17 niffiwan Note Added: 0016638
2015-04-10 20:18 niffiwan Changeset attached => fs2open trunk r11299
2015-04-10 20:18 niffiwan Note Added: 0016639
2015-04-10 20:18 niffiwan Status code review => resolved
2015-04-10 20:18 niffiwan Resolution open => fixed
+Issue History