View Issue Details

IDProjectCategoryView StatusLast Update
0002878FSSCPscriptingpublic2013-09-02 07:22
Reporterniffiwan Assigned Toniffiwan  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.19 
Target Version3.7.2 
Summary0002878: LUA playMusic ignores players music volume level
DescriptionplayMusic expects a volume to be passed to it, otherwise it defaults to 100%/max volume. This ignores the player set music volume. If the player makes a manual volume change, it overrides the volume the script set.
Steps To ReproduceDownload & install the BtA Demo (seriously, it's good :))
Enter either mission from the tech room
Note the music volume
Press F2 & change the volume
Additional InformationMusic script used by BtA is play-music-from-file-sct.tbm.
http://www.hard-light.net/forums/index.php?topic=78475.0
TagsNo tags attached.

Activities

niffiwan

2013-05-20 09:31

developer  

mantis2878-svn.patch (1,290 bytes)   
Index: code/parse/lua.cpp
===================================================================
--- code/parse/lua.cpp	(revision 9677)
+++ code/parse/lua.cpp	(working copy)
@@ -11026,7 +11026,8 @@
 	return ade_set_args(L, "b", idx > -1);
 }
 
-ADE_FUNC(playMusic, l_Audio, "string Filename, [float volume = 1.0, bool looping = true]", "Plays a music file using FS2Open's builtin music system. Volume should be in the 0.0 - 1.0 range, and is capped at 1.0. Files passed to this function are looped by default.", "number", "Audiohandle of the created audiostream, or -1 on failure")
+extern float Master_event_music_volume;
+ADE_FUNC(playMusic, l_Audio, "string Filename, [float volume = 1.0, bool looping = true]", "Plays a music file using FS2Open's builtin music system. Volume is currently ignored, uses players music volume setting. Files passed to this function are looped by default.", "number", "Audiohandle of the created audiostream, or -1 on failure")
 {
 	char *s;
 	float volume = 1.0f;
@@ -11038,7 +11039,8 @@
 	if(ah < 0)
 		return ade_set_error(L, "i", -1);
 
-	CLAMP(volume, 0.0f, 1.0f);
+	// didn't remove the volume parameter because it'll break the API
+	volume = Master_event_music_volume;
 
 	audiostream_play(ah, volume, loop ? 1 : 0);
 	return ade_set_args(L, "i", ah);
mantis2878-svn.patch (1,290 bytes)   

niffiwan

2013-08-06 02:05

developer   ~0015208

discussion here seems mostly in favour of always using the player set music volume (i.e. ignore the volume set by the script)

http://www.hard-light.net/forums/index.php?topic=84615.0

I'll commit this post 3.7.0 final unless anyone else comments before then

niffiwan

2013-09-02 07:22

developer   ~0015257

Fix committed to trunk@9763.

Related Changesets

fs2open: trunk r9763

2013-09-02 03:36

niffiwan


Ported: N/A

Details Diff
Fix for mantis 2878: LUA playMusic uses players music volume, not the requested volume Affected Issues
0002878
mod - /trunk/fs2_open/code/parse/lua.cpp Diff File

Issue History

Date Modified Username Field Change
2013-05-20 09:29 niffiwan New Issue
2013-05-20 09:29 niffiwan Status new => assigned
2013-05-20 09:29 niffiwan Assigned To => niffiwan
2013-05-20 09:31 niffiwan File Added: mantis2878-svn.patch
2013-05-20 09:31 niffiwan Status assigned => code review
2013-08-06 02:05 niffiwan Note Added: 0015208
2013-08-06 02:05 niffiwan Target Version => 3.7.2
2013-09-02 07:22 niffiwan Changeset attached => fs2open trunk r9763
2013-09-02 07:22 niffiwan Note Added: 0015257
2013-09-02 07:22 niffiwan Status code review => resolved
2013-09-02 07:22 niffiwan Resolution open => fixed