mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 05:44:44 +02:00
head penumbra filter tuning with Freddy / filter defaults to on
This commit is contained in:
parent
7a9cf193b4
commit
117a868bcf
2 changed files with 17 additions and 19 deletions
|
@ -321,8 +321,13 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(PositionalAudioStream*
|
||||||
const float TWO_OVER_PI = 2.0f / PI;
|
const float TWO_OVER_PI = 2.0f / PI;
|
||||||
|
|
||||||
const float ZERO_DB = 1.0f;
|
const float ZERO_DB = 1.0f;
|
||||||
const float NEGATIVE_ONE_DB = 0.891f;
|
// const float NEGATIVE_ONE_DB = 0.891f;
|
||||||
const float NEGATIVE_THREE_DB = 0.708f;
|
const float NEGATIVE_THREE_DB = 0.708f;
|
||||||
|
const float NEGATIVE_SIX_DB = 0.501f;
|
||||||
|
|
||||||
|
const float FILTER_GAIN_AT_0 = ZERO_DB; // source is in front
|
||||||
|
const float FILTER_GAIN_AT_90 = NEGATIVE_SIX_DB; // source is incident to left or right ear
|
||||||
|
const float FILTER_GAIN_AT_180 = NEGATIVE_SIX_DB; // source is behind
|
||||||
|
|
||||||
const float FILTER_CUTOFF_FREQUENCY_HZ = 1000.0f;
|
const float FILTER_CUTOFF_FREQUENCY_HZ = 1000.0f;
|
||||||
|
|
||||||
|
@ -334,32 +339,25 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(PositionalAudioStream*
|
||||||
|
|
||||||
// variable gain calculation broken down by quadrent
|
// variable gain calculation broken down by quadrent
|
||||||
if (bearingAngleToSource < -PI_OVER_TWO && bearingAngleToSource > -PI) {
|
if (bearingAngleToSource < -PI_OVER_TWO && bearingAngleToSource > -PI) {
|
||||||
// gainL(-pi/2,0b)->(-pi,-1db)
|
|
||||||
penumbraFilterGainL = TWO_OVER_PI *
|
penumbraFilterGainL = TWO_OVER_PI *
|
||||||
(ZERO_DB - NEGATIVE_ONE_DB) * (bearingAngleToSource + PI_OVER_TWO) + ZERO_DB;
|
(FILTER_GAIN_AT_0 - FILTER_GAIN_AT_180) * (bearingAngleToSource + PI_OVER_TWO) + FILTER_GAIN_AT_0;
|
||||||
// gainR(-pi/2,-3db)->(-pi,-1db)
|
|
||||||
penumbraFilterGainR = TWO_OVER_PI *
|
penumbraFilterGainR = TWO_OVER_PI *
|
||||||
(NEGATIVE_THREE_DB - NEGATIVE_ONE_DB) * (bearingAngleToSource + PI_OVER_TWO) + NEGATIVE_THREE_DB;
|
(FILTER_GAIN_AT_90 - FILTER_GAIN_AT_180) * (bearingAngleToSource + PI_OVER_TWO) + FILTER_GAIN_AT_90;
|
||||||
} else if (bearingAngleToSource <= PI && bearingAngleToSource > PI_OVER_TWO) {
|
} else if (bearingAngleToSource <= PI && bearingAngleToSource > PI_OVER_TWO) {
|
||||||
// gainL(+pi,-1db)->(pi/2,-3db)
|
|
||||||
penumbraFilterGainL = TWO_OVER_PI *
|
penumbraFilterGainL = TWO_OVER_PI *
|
||||||
(NEGATIVE_ONE_DB - NEGATIVE_THREE_DB) * (bearingAngleToSource - PI) + NEGATIVE_ONE_DB;
|
(FILTER_GAIN_AT_180 - FILTER_GAIN_AT_90) * (bearingAngleToSource - PI) + FILTER_GAIN_AT_180;
|
||||||
// gainR(+pi,-1db)->(pi/2,0db)
|
|
||||||
penumbraFilterGainR = TWO_OVER_PI *
|
penumbraFilterGainR = TWO_OVER_PI *
|
||||||
(NEGATIVE_ONE_DB - ZERO_DB) * (bearingAngleToSource - PI) + NEGATIVE_ONE_DB;
|
(FILTER_GAIN_AT_180 - FILTER_GAIN_AT_0) * (bearingAngleToSource - PI) + FILTER_GAIN_AT_180;
|
||||||
} else if (bearingAngleToSource <= PI_OVER_TWO && bearingAngleToSource > 0) {
|
} else if (bearingAngleToSource <= PI_OVER_TWO && bearingAngleToSource > 0) {
|
||||||
// gainL(+pi/2,-3db)->(0,0db)
|
|
||||||
penumbraFilterGainL = TWO_OVER_PI *
|
penumbraFilterGainL = TWO_OVER_PI *
|
||||||
(NEGATIVE_THREE_DB - ZERO_DB) * (bearingAngleToSource - PI_OVER_TWO) + NEGATIVE_THREE_DB;
|
(FILTER_GAIN_AT_90 - FILTER_GAIN_AT_0) * (bearingAngleToSource - PI_OVER_TWO) + FILTER_GAIN_AT_90;
|
||||||
// gainR(+p1/2,0db)->(0,0db)
|
penumbraFilterGainR = FILTER_GAIN_AT_0;
|
||||||
penumbraFilterGainR = ZERO_DB;
|
|
||||||
} else {
|
} else {
|
||||||
// gainL(0,0db)->(-pi/2,0db)
|
penumbraFilterGainL = FILTER_GAIN_AT_0;
|
||||||
penumbraFilterGainL = ZERO_DB;
|
|
||||||
// gainR(0,0db)->(-pi/2,-3db)
|
|
||||||
penumbraFilterGainR = TWO_OVER_PI *
|
penumbraFilterGainR = TWO_OVER_PI *
|
||||||
(ZERO_DB - NEGATIVE_THREE_DB) * (bearingAngleToSource) + ZERO_DB;
|
(FILTER_GAIN_AT_0 - FILTER_GAIN_AT_90) * (bearingAngleToSource) + FILTER_GAIN_AT_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
qDebug() << "avatar="
|
qDebug() << "avatar="
|
||||||
<< listeningNodeStream
|
<< listeningNodeStream
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"label": "Enable Positional Filter",
|
"label": "Enable Positional Filter",
|
||||||
"help": "If enabled, positional audio stream uses lowpass filter",
|
"help": "If enabled, positional audio stream uses lowpass filter",
|
||||||
"default": false
|
"default": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue