View Issue Details

IDProjectCategoryView StatusLast Update
0002725FSSCPsoundpublic2014-06-27 02:57
ReporterMjnMixael Assigned ToMageKing17  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPCOSWindowsOS VersionWin7
Product Version3.6.15 
Target Version3.7.2 
Summary0002725: Beam sounds not panning correctly
DescriptionSimply put, beam sounds do not fade from channel to channel in the soundscape. Instead they jump from channel to channel.
Steps To ReproducePick a mission with beams. Put the beam on the left. Rotate your fighter so the beam moves to the right. The sound will jump from the left speaker to the right speaker with no crossfading.
Additional InformationThis issue was first reported when the new sound code was added, in this thread:
http://www.hard-light.net/forums/index.php?topic=68146.220

"I'm using a pair of 5.1 headphones and when I maneuver around a beam the sound jumps from one side to the other ignoring the center channel. The beams windup and winddown for instance goes left, center, right, but the beam itself jumps from left to right. Beams are the only thing I've noticed this behavior with since it's such a drawn out effect."
TagsNo tags attached.

Activities

Goober5000

2012-11-12 06:28

administrator   ~0014035

This, along with 0002702, are must-fix issues for 3.6.16. Asking Zacam for delegation assistance.

iss_mneur

2012-11-18 23:05

developer   ~0014055

I am unable to reproduce this issue with current trunk (revision 9357), retail assets, and stereo headphones. Please confirm that this issue still exists.

MjnMixael

2012-11-18 23:21

manager   ~0014058

Issue still exists (revision 9357).

MjnMixael

2012-11-19 02:02

manager  

fs2_open.log (64,194 bytes)

iss_mneur

2012-11-19 05:59

developer   ~0014061

After working with MjnMixael on #SCP, it appears that this issue is an environmental issue and/or hardware issue, related to the use of OpenALSoft, wxLauncher, and sound card drivers.

Specifically the fact that if OpenALSoft is installed in the Freespace2 directory (the recommended location) then wxLauncher doesn't load it, resulting in wxLauncher being unable to "see" the same sound cards as the 5.5g launcher or FSO. This meant that MjnMixael was unable to select a sound card driver that doesn't cause issues.

MageKing17

2014-06-09 04:47

developer   ~0015820

As this bug seems well-known (I'm unable to find anybody for whom beam panning works correctly), I'm reopening it.

niffiwan

2014-06-09 04:49

developer   ~0015821

And here's an example of the issue :)
https://www.youtube.com/watch?v=4dBHG5F6Ps0

MageKing17

2014-06-09 05:09

developer   ~0015822

After poking around the sound code, I've made a patch that seems to fix the issue on my end.

niffiwan

2014-06-09 09:30

developer  

longbeam.fs2 (4,086 bytes)

niffiwan

2014-06-09 09:53

developer   ~0015827

I've attached my hacky test mission. Actually... the patch makes things worse on my end :D

Without the patch:
Beam firing sound seems to be mono (??)
Beam warmup/cooldown sound seems to pan abruptly.

With the patch:
Both the beam firing and warmup/cooldown sounds seem to pan abruptly.


I then tried with the -no_3d_sound flag:

With patch and without the patch are the same.
Beam firing pans correctly
Beam warmup/cooldown has correct pan at the instant it starts, but it doesn't change the pan if you move after the sound has started playing.


My setup is:
Stereo Headphones
SB Audigy (ooooold card)
OpenAL Soft 1.14 (Linux Mint 17 / Ubuntu 14.04)

MageKing17

2014-06-09 13:14

developer   ~0015829

Well, I did say "seems to" fix... ;)

I'll take another look at this when I get home, but you're saying that the warmup/cooldown sounds aren't working right for you (even without the patch)?

niffiwan

2014-06-09 21:19

developer   ~0015830

Yeah, that seems to be the case, although I'll admit that it's fairly hard to hear exactly what's going on since the sounds are playing so close to each other. Maybe two custom beams would help, one with an empty firing sound, and one with an empty warmup/cooldown.

MageKing17

2014-06-10 03:12

developer   ~0015833

New version of patch that makes -no_3d_sound work on my end (3D audio still works here).

MageKing17

2014-06-10 04:19

developer   ~0015834

Current patch breaks playership sound effects (they sound like they're coming from wherever you started the mission).

MageKing17

2014-06-10 04:57

developer   ~0015835

Come around circuitously to a patch only slightly different from the first patch; seems to work with both 2D and 3D sound.

Zacam

2014-06-10 07:46

administrator   ~0015836

Prelim test with OpenAL Soft (as soft_oal.dll enhancement and as OpenAL32.dll in FSO dir) currently tests okay with sound3.patch and provided mission, still have yet to try the commandline parameters in testing though.

niffiwan

2014-06-10 10:57

developer   ~0015837

After a reasonable amount of testing, I think the patch fixes the sound panning issue on my end, even when using openAL soft 1.14.

I think the issue I had in my previous testing is different, and it's quite hard to describe. So, I took a video of it!
https://www.youtube.com/watch?v=g7oJ6EKdyPA

Note:
*) rolling while almost facing the source pans oddly - it's like there's a large discontinuity in volume at certain points in the arc. I'd expect in this orientation to have very little (if any) difference in sound as you pan. Also note that if your ship is facing almost directly away from the source then the sound is as you'd expect, practically no change in left/right balance as you roll.
*) rolling while at approx 90 degrees orientation to the source pans correctly

The patch also work correctly with -no_3d_sound, but your ship needs to be either facing the sound source or parallel to the beam to hear it correctly - I guess that makes sense for stereo rather than 3D sound.

MageKing17

2014-06-11 01:03

developer   ~0015838

Incorporated one last check from the old sound code that seemed appropriate; if there's no pan in ds_play(), set the position to 0.0f, 0.0f, 0.0f. Should work better with surround speaker setups. Given the positive testing results I got from the previous patch, I'm thinking this is ready for code review.

Zacam

2014-06-11 05:44

administrator   ~0015839

Last edited: 2014-06-11 05:49

sound4.patch confirmed good with and without "-no_3d_sound" using OpenAL Soft 1.15.1 on a Quadraphonic 4.1 surround sound on Direct Hardware.

I set the target Release for this as being 3.7.2, since I don't think there is any reason why we should not be able to include it at release for that build cycle and it does fix an immersion problem.

Though, the only thing stopping ME from committing this code, is that there is a new Int3() being added and I'd rather not see us propagating usage of that any further than we absolutely have to.

MageKing17

2014-06-11 14:29

developer   ~0015841

Ah, yes, probably not the best. I just copied the sound boilerplate from the start of snd_get_3d_vol_and_pan() since it wasn't being called anymore (and I needed the min and max range). If no one else gets to it before I get home, I'll replace the Int3()s in both functions with proper Error()s.

MageKing17

2014-06-12 02:19

developer  

sound.patch (3,532 bytes)   
Index: code/sound/ds.cpp
===================================================================
--- code/sound/ds.cpp	(revision 10793)
+++ code/sound/ds.cpp	(working copy)
@@ -1587,7 +1587,12 @@
 		return -1;
 	}
 
-	OpenAL_ErrorPrint( alSource3f(Channels[ch_idx].source_id, AL_POSITION, pan, 0.0f, 0.0f) );
+	if (pan) {
+		OpenAL_ErrorPrint( alSource3f(Channels[ch_idx].source_id, AL_POSITION, pan, 0.0f, 1.0f) );
+	} else {
+		OpenAL_ErrorPrint( alSource3f(Channels[ch_idx].source_id, AL_POSITION, 0.0f, 0.0f, 0.0f) );
+	}
+
 	OpenAL_ErrorPrint( alSource3f(Channels[ch_idx].source_id, AL_VELOCITY, 0.0f, 0.0f, 0.0f) );
 
 	OpenAL_ErrorPrint( alDopplerFactor(0.0f) );
@@ -1725,8 +1730,8 @@
 	OpenAL_ErrorCheck( alGetSourcei(Channels[channel].source_id, AL_SOURCE_STATE, &state), return );
 
 	if (state == AL_PLAYING) {
-		OpenAL_ErrorPrint( alSourcei(Channels[channel].source_id, AL_SOURCE_RELATIVE, AL_TRUE) );
-		OpenAL_ErrorPrint( alSource3f(Channels[channel].source_id, AL_POSITION, pan, 0.0f, 0.0f) );
+		//OpenAL_ErrorPrint( alSourcei(Channels[channel].source_id, AL_SOURCE_RELATIVE, AL_TRUE) );
+		OpenAL_ErrorPrint( alSource3f(Channels[channel].source_id, AL_POSITION, pan, 0.0f, 1.0f) );
 	}
 }
 
Index: code/sound/ds3d.cpp
===================================================================
--- code/sound/ds3d.cpp	(revision 10793)
+++ code/sound/ds3d.cpp	(working copy)
@@ -88,7 +88,7 @@
 int ds3d_update_listener(vec3d *pos, vec3d *vel, matrix *orient)
 {
 	if (Cmdline_no_3d_sound) {
-		nprintf(("Sound", "Aborting ds3d_update_buffer due to Cmdline_no_3d_sound..."));
+		nprintf(("Sound", "Aborting ds3d_update_listener due to Cmdline_no_3d_sound..."));
 		return -1;
 	}
 
Index: code/sound/sound.cpp
===================================================================
--- code/sound/sound.cpp	(revision 10793)
+++ code/sound/sound.cpp	(working copy)
@@ -685,16 +685,42 @@
 // update the given 3d sound with a new position
 void snd_update_3d_pos(int soundnum, game_snd *gs, vec3d *new_pos, float radius, float range_factor)
 {
-	float vol, pan;
-	
-	// get new volume and pan vals
-	snd_get_3d_vol_and_pan(gs, new_pos, &vol, &pan, radius, range_factor);
+	if (Cmdline_no_3d_sound) {
+		float vol, pan;
+		
+		// get new volume and pan vals
+		snd_get_3d_vol_and_pan(gs, new_pos, &vol, &pan, radius, range_factor);
 
-	// set volume
-	snd_set_volume(soundnum, vol);
+		// set volume
+		snd_set_volume(soundnum, vol);
 
-	// set pan
-	snd_set_pan(soundnum, pan);
+		// set pan
+		snd_set_pan(soundnum, pan);
+	} else {
+		// MageKing17 - It's a 3D sound effect, we should use the function for setting the position of a 3D sound effect.
+		sound *snd;
+
+		if (!ds_initialized)
+			return;
+
+		Assertion( gs == NULL, "*gs was NULL in snd_update_3d_pos(); get a coder!\n" );
+
+		if ( gs->id == -1 ) {
+			gs->id = snd_load(gs);
+		}
+
+		if (gs->id == -1)
+			return;
+
+		snd = &Sounds[gs->id];
+		if ( !(snd->flags & SND_F_USED) )
+			return;
+
+		float min_range = (float) (fl2i( (gs->min) * range_factor));
+		float max_range = (float) (fl2i( (gs->max) * range_factor + 0.5f));
+
+		ds3d_update_buffer(soundnum, min_range, max_range, new_pos, NULL);
+	}
 }
 
 // ---------------------------------------------------------------------------------------
@@ -728,10 +754,7 @@
 	if (!ds_initialized)
 		return -1;
 
-	if (gs == NULL) {
-		Int3();
-		return -1;
-	}
+	Assertion( gs == NULL, "*gs was NULL in snd_get_3d_vol_and_pan(); get a coder!\n" );
 
 	if ( gs->id == -1 ) {
 		gs->id = snd_load(gs);
sound.patch (3,532 bytes)   

MageKing17

2014-06-12 02:19

developer   ~0015842

Cleaned out old patches; latest patch replaces the Int3()-ing if-statements with Assertions.

Zacam

2014-06-13 02:03

administrator   ~0015850

Fix committed to trunk@10798.

Related Changesets

fs2open: trunk r10798

2014-06-12 21:21

Zacam


Ported: N/A

Details Diff
Fix for Mantis 2725: Beam sounds not panning correctly Affected Issues
0002725
mod - /trunk/fs2_open/code/sound/ds.cpp Diff File
mod - /trunk/fs2_open/code/sound/ds3d.cpp Diff File
mod - /trunk/fs2_open/code/sound/sound.cpp Diff File

Issue History

Date Modified Username Field Change
2012-11-12 06:25 MjnMixael New Issue
2012-11-12 06:27 Goober5000 Assigned To => Zacam
2012-11-12 06:27 Goober5000 Priority normal => high
2012-11-12 06:27 Goober5000 Severity minor => major
2012-11-12 06:27 Goober5000 Status new => acknowledged
2012-11-12 06:27 Goober5000 Target Version => 3.6.16
2012-11-12 06:27 Goober5000 Additional Information Updated
2012-11-12 06:28 Goober5000 Note Added: 0014035
2012-11-18 23:05 iss_mneur Note Added: 0014055
2012-11-18 23:05 iss_mneur Assigned To Zacam => iss_mneur
2012-11-18 23:05 iss_mneur Status acknowledged => feedback
2012-11-18 23:21 MjnMixael Note Added: 0014058
2012-11-18 23:21 MjnMixael Status feedback => assigned
2012-11-19 02:02 MjnMixael File Added: fs2_open.log
2012-11-19 05:59 iss_mneur Note Added: 0014061
2012-11-19 05:59 iss_mneur Status assigned => closed
2012-11-19 05:59 iss_mneur Resolution open => no change required
2014-06-09 04:47 MageKing17 Note Added: 0015820
2014-06-09 04:47 MageKing17 Status closed => feedback
2014-06-09 04:47 MageKing17 Resolution no change required => reopened
2014-06-09 04:49 niffiwan Note Added: 0015821
2014-06-09 05:09 MageKing17 File Added: sound.patch
2014-06-09 05:09 MageKing17 Note Added: 0015822
2014-06-09 09:30 niffiwan File Added: longbeam.fs2
2014-06-09 09:53 niffiwan Note Added: 0015827
2014-06-09 13:14 MageKing17 Note Added: 0015829
2014-06-09 21:19 niffiwan Note Added: 0015830
2014-06-10 03:11 MageKing17 File Added: sound2.patch
2014-06-10 03:12 MageKing17 Note Added: 0015833
2014-06-10 04:19 MageKing17 Note Added: 0015834
2014-06-10 04:56 MageKing17 File Added: sound3.patch
2014-06-10 04:57 MageKing17 Note Added: 0015835
2014-06-10 07:46 Zacam Note Added: 0015836
2014-06-10 10:57 niffiwan Note Added: 0015837
2014-06-11 01:02 MageKing17 File Added: sound4.patch
2014-06-11 01:02 MageKing17 Assigned To iss_mneur => MageKing17
2014-06-11 01:02 MageKing17 Status feedback => assigned
2014-06-11 01:03 MageKing17 Note Added: 0015838
2014-06-11 01:03 MageKing17 Status assigned => code review
2014-06-11 05:44 Zacam Note Added: 0015839
2014-06-11 05:44 Zacam Target Version 3.6.16 => 3.7.2
2014-06-11 05:45 Zacam Note Edited: 0015839
2014-06-11 05:49 Zacam Note Edited: 0015839
2014-06-11 14:29 MageKing17 Note Added: 0015841
2014-06-12 02:18 MageKing17 File Deleted: sound.patch
2014-06-12 02:18 MageKing17 File Deleted: sound2.patch
2014-06-12 02:18 MageKing17 File Deleted: sound3.patch
2014-06-12 02:18 MageKing17 File Deleted: sound4.patch
2014-06-12 02:19 MageKing17 File Added: sound.patch
2014-06-12 02:19 MageKing17 Note Added: 0015842
2014-06-13 02:03 Zacam Changeset attached => fs2open trunk r10798
2014-06-13 02:03 Zacam Note Added: 0015850
2014-06-13 02:03 Zacam Status code review => resolved
2014-06-27 02:57 MageKing17 Status resolved => feedback
2014-06-27 02:57 MageKing17 Status feedback => resolved
2014-06-27 02:57 MageKing17 Resolution reopened => fixed