2019-12-10 03:08 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002623Spring engineGeneralpublic2011-09-09 10:15
Reporterabma 
Assigned TojK 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusresolvedResolutionfixed 
Product Version 
Target Version83.0Fixed in Version 
Summary0002623: (master) 3d sound isn't 3d
Descriptionwhen zooming out, sound is as loud as zoomed in...

its 2d-sound!
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
related to 0002622closedjK (master) sound sometimes overdriven 
+Relationships

-Notes

~0007279

jK (developer)

it's intentionally, else you wouldn't hear anything at normal zoom levels!
https://github.com/spring/spring/blob/b2bc2ed66012b844eee69007f145ed4ba5b853c4/rts/System/Sound/Sound.cpp#L440

~0007281

abma (administrator)

Last edited: 2011-08-25 01:29

hmm, make that configureable? i don't want to hear sounds at low zoom-levels so loud. imo it even sounds better with some air absorption.

forum thread related to this report: http://springrts.com/phpbb/viewtopic.php?p=498471#p498471

~0007292

jK (developer)

enable air absorption?

~0007306

hoijui (reporter)

i just enabled sound again.. as it was not working for me in master before i updated my whole system. now it does work again. :-)

this really is a bug.
Even though jk is right, that it should be only marginally or not at all quieter when zooming out, it should be quieter when moving away (in maps 2D space). it currently does not, as in... it is actually 0D (if that makes any sense) -> always the same volume.
it works correctly in release.

~0007339

jK (developer)

Last edited: 2011-09-08 07:42

k, could reproduce it.
Possibly it is a bug in the OpenALsoft+Linux, cause I couldn't remember such a bug when I wrote the code (and I tested a lot).

Explanation what changed between 82.7.1 and master:

First we use the following sound distance model:
alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);

And OpenAL docs say for it:
// gain = 0..1
distance = max(distance,AL_REFERENCE_DISTANCE);
distance = min(distance,AL_MAX_DISTANCE);
gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance ÔÇô AL_REFERENCE_DISTANCE));

So what I did (in contrast to 82.7.1) is to introduce a scale factor to transform our spring coords (elmos) into meters that's what OpenAL expects e.g. for DopplerScaling.

with such a scaling coeff. the formula becomes:
float a = GetElmosInMeters();
gain = (AL_REFERENCE_DISTANCE * a) / ((AL_REFERENCE_DISTANCE * a) + AL_ROLLOFF_FACTOR * ((distance * a) ÔÇô (AL_REFERENCE_DISTANCE * a)));
     = (AL_REFERENCE_DISTANCE * a) / [a * (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance ÔÇô AL_REFERENCE_DISTANCE))];
     = (a / a) * AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance ÔÇô AL_REFERENCE_DISTANCE));
     = (a / a) * orig(distance);
     = orig(distance);
--> such a scaling factor doesn't/shouldn't change the sound distance attenuation at all!

But when changing GetElmosInMeters() the distance gain changes strangely , with `1` it is similar/same as 82.7.1 and with `1/8` it seems gain is const >1.

~0007342

Kloot (developer)

your math fails somewhat: http://pastebin.com/DYXFjkyM

~0007343

jK (developer)

Last edited: 2011-09-08 14:06

you have a typo in there:
(REF_DISTANCE * a) / ((REF_DISTANCE * a) + ROLLOFF_FACTOR * ((d - a) - (REF_DISTANCE * a)))
versus
(REF_DISTANCE * a) / ((REF_DISTANCE * a) + ROLLOFF_FACTOR * ((d * a) - (REF_DISTANCE * a)))



Still the bug is found with the help of KittyCat, commit will come soon. And yeah, it wasn't OpenALsoft's fault (I dropped a magic number I better shouldn't).

+Notes

-Issue History
Date Modified Username Field Change
2011-08-24 23:20 abma New Issue
2011-08-24 23:20 abma Description Updated
2011-08-24 23:31 jK Note Added: 0007279
2011-08-25 01:11 abma Note Added: 0007281
2011-08-25 01:11 abma Severity minor => feature
2011-08-25 01:21 abma Relationship added related to 0002622
2011-08-25 01:23 abma Note Edited: 0007281
2011-08-25 01:29 abma Note Edited: 0007281
2011-08-25 19:16 jK Note Added: 0007292
2011-08-27 14:50 hoijui Note Added: 0007306
2011-09-06 03:06 abma Target Version => 0.83.0
2011-09-08 07:34 jK Note Added: 0007339
2011-09-08 07:35 jK Note Edited: 0007339
2011-09-08 07:36 jK Note Edited: 0007339
2011-09-08 07:36 jK Note Edited: 0007339
2011-09-08 07:42 jK Note Edited: 0007339
2011-09-08 07:42 jK Note Edited: 0007339
2011-09-08 13:54 Kloot Note Added: 0007342
2011-09-08 13:54 Kloot Status new => feedback
2011-09-08 14:05 jK Note Added: 0007343
2011-09-08 14:06 jK Note Edited: 0007343
2011-09-08 14:06 jK Note Edited: 0007343
2011-09-08 14:06 jK Note Edited: 0007343
2011-09-09 10:15 jK Status feedback => resolved
2011-09-09 10:15 jK Resolution open => fixed
2011-09-09 10:15 jK Assigned To => jK
+Issue History