Commit 2237d559 authored by norvell's avatar norvell
Browse files

Fixes in DistGain calculation and init for MC

parent 6d0d63c2
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -190,6 +190,13 @@ ivas_error ivas_td_binaural_open_unwrap(
            DirAtten_p->ConeOuterAngle = 360.0f;
            DirAtten_p->ConeOuterGain = 1.0f;

#ifdef CONF_DISTATT
            DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED;
            DistAtten.MaxDist = 15.75f;
            DistAtten.RefDist = 1.0f;
            DistAtten.RollOffFactor = 1.0f;
#endif

            if ( ( error = TDREND_MIX_SRC_SetPos( pBinRendTd, nS, Pos ) ) != IVAS_ERR_OK )
            {
                return error;
@@ -209,6 +216,12 @@ ivas_error ivas_td_binaural_open_unwrap(
            {
                return error;
            }
#ifdef CONF_DISTATT
            if ( ( error = TDREND_MIX_SRC_SetDistAtten( pBinRendTd, nS, &DistAtten ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#endif
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -609,7 +609,7 @@ static float TDREND_SRC_SPATIAL_GetDistGain(
    {
        case TDREND_DIST_ATTEN_MODEL_INV_DIST:
#ifdef CONF_DISTATT
            DistGain = powf( DistAtten_p->RefDist / ( Dist2 - DistAtten_p->RefDist ), DistAtten_p->RollOffFactor );
            DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor );
#else
            DistGain = DistAtten_p->RefDist / ( DistAtten_p->RefDist + DistAtten_p->RollOffFactor * ( Dist2 - DistAtten_p->RefDist ) );
#endif
@@ -626,7 +626,7 @@ static float TDREND_SRC_SPATIAL_GetDistGain(
                Dist2 = DistAtten_p->MaxDist;
            }
#ifdef CONF_DISTATT
            DistGain = powf( DistAtten_p->RefDist / ( Dist2 - DistAtten_p->RefDist ), DistAtten_p->RollOffFactor );
            DistGain = powf( DistAtten_p->RefDist / Dist2, DistAtten_p->RollOffFactor );
#else
            DistGain = DistAtten_p->RefDist / ( DistAtten_p->RefDist + DistAtten_p->RollOffFactor * ( Dist2 - DistAtten_p->RefDist ) );
#endif