Commit 51ad0a2b authored by emerit's avatar emerit
Browse files

no diegetic pan in ism

parent 36bca4da
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1417,6 +1417,10 @@ typedef enum
{
    TDREND_PLAYSTATUS_INITIAL,
    TDREND_PLAYSTATUS_PLAYING
#ifdef ISM_NO_DIEGETIC_PAN    
    ,
    TDREND_PLAYSTATUS_PLAYING_NO_DIEGETIC
#endif    
} TDREND_PlayStatus_t;

typedef enum
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@

#define NO_DIEGETIC_PAN
#define FIX_CRASH_EVS_BITSTREAM_WITH_OUTPUT

#define ISM_NO_DIEGETIC_PAN
/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+3 −0
Original line number Diff line number Diff line
@@ -1545,6 +1545,9 @@ typedef struct
    float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1];
    float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1];
    float Gain;
#ifdef ISM_NO_DIEGETIC_PAN
    int16_t no_diegtic_pan;
#endif    
} TDREND_SRC_t;

/* Top level TD binaural renderer handle */
+47 −0
Original line number Diff line number Diff line
@@ -323,7 +323,11 @@ static ivas_error TDREND_GetMix(
        SrcRend_p = Src_p->SrcRend_p;

        /* Update rendering params if needed */
#ifdef ISM_NO_DIEGETIC_PAN
        if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) )
#else
        if ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated )
#endif
        {
            TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev,
                                                            Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_idx );
@@ -334,6 +338,15 @@ static ivas_error TDREND_GetMix(
        {
            error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length );
        }
#ifdef ISM_NO_DIEGETIC_PAN
        if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING_NO_DIEGETIC ) )
        {
            float mixer_left = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f;
            float mixer_rigth = 1.f - mixer_left;
            v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], mixer_rigth, output_buf[1], subframe_length );
            v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], mixer_left, output_buf[0], subframe_length );
        }
#endif
    }

    /* Populate output variable */
@@ -422,8 +435,42 @@ static void TDREND_Update_object_positions(

            TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos );
            TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p );
#ifdef ISM_NO_DIEGETIC_PAN
            if ( hBinRendererTd->Sources[nS]->no_diegtic_pan > 3 )
            {
                Pos[0] = 0;
                Pos[1] = sinf( hIsmMetaData[nS]->azimuth * PI_OVER_180 );
                Pos[2] = 0;
                TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos );
                TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NO_DIEGETIC );
                if ( hIsmMetaData[nS]->elevation != -90.f )
                {
                    hBinRendererTd->Sources[nS]->no_diegtic_pan = 0;
                }
            }
            else
            {
                TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING );

                if ( ( hIsmMetaData[nS]->elevation == -90.f ) && ( hBinRendererTd->Sources[nS]->no_diegtic_pan >= 0 ) )
                {
                    hBinRendererTd->Sources[nS]->no_diegtic_pan++;
                    hBinRendererTd->Sources[nS]->no_diegtic_pan = hBinRendererTd->Sources[nS]->no_diegtic_pan * -1;
                }
                else if ( ( hIsmMetaData[nS]->elevation == 90.f ) && ( hBinRendererTd->Sources[nS]->no_diegtic_pan < 0 ) )
                {
                    hBinRendererTd->Sources[nS]->no_diegtic_pan = hBinRendererTd->Sources[nS]->no_diegtic_pan * -1;
                    hBinRendererTd->Sources[nS]->no_diegtic_pan++;
                }
                else
                {
                    hBinRendererTd->Sources[nS]->no_diegtic_pan = 0;
                }
            }
#else
            TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING );
#endif

            TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir );
        }
    }
+3 −1
Original line number Diff line number Diff line
@@ -683,7 +683,9 @@ void TDREND_SRC_Init(
    Src_p->hrf_right_prev[0] = 1;
    Src_p->azim_prev = 0.0f;
    Src_p->elev_prev = 0.0f;

#ifdef ISM_NO_DIEGETIC_PAN    
    Src_p->no_diegtic_pan = 0;
#endif

    return;
}
Loading