2022-01-26 05:40 EST


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002725FSSCPsoundpublic2014-06-26 22:57
ReporterMjnMixael 
Assigned ToMageKing17 
PriorityhighSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformPCOSWindowsOS VersionWin7
Product Version3.6.15 
Target Version3.7.2Fixed in Version 
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.
Attached Files
  • log file icon fs2_open.log (64,194 bytes) 2012-11-18 21:02
  • ? file icon longbeam.fs2 (4,086 bytes) 2014-06-09 05:30
  • patch file icon sound.patch (3,532 bytes) 2014-06-11 22:19 -
    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);
    
    patch file icon sound.patch (3,532 bytes) 2014-06-11 22:19 +

-Relationships
+Relationships

-Notes

~0014035

Goober5000 (administrator)

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

~0014055

iss_mneur (developer)

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

~0014058

MjnMixael (manager)

Issue still exists (revision 9357).

~0014061

iss_mneur (developer)

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.

~0015820

MageKing17 (developer)

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

~0015821

niffiwan (developer)

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

~0015822

MageKing17 (developer)

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

~0015827

niffiwan (developer)

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)

~0015829

MageKing17 (developer)

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)?

~0015830

niffiwan (developer)

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.

~0015833

MageKing17 (developer)

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

~0015834

MageKing17 (developer)

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

~0015835

MageKing17 (developer)

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

~0015836

Zacam (administrator)

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.

~0015837

niffiwan (developer)

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.

~0015838

MageKing17 (developer)

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.

~0015839

Zacam (administrator)

Last edited: 2014-06-11 01:49

View 3 revisions

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.

~0015841

MageKing17 (developer)

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.

~0015842

MageKing17 (developer)

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

~0015850

Zacam (administrator)

Fix committed to trunk@10798.
+Notes

+Related Changesets

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