Commit fa565fb4 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

implement object-gain editing in TD renderer

parent 0e14fc1c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@ typedef struct
    float pitch;     /* pitch value read from the input metadata file */

#ifdef OBJ_EDITING_API

	float gain;

    float edited_azimuth;
    float edited_elevation;
    float edited_radius;
+2 −3
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ ivas_error ivas_td_binaural_renderer_sf(
                    ismMetaData[nS].yaw = st_ivas->hIsmMetaData[nS]->edited_yaw;
                    ismMetaData[nS].pitch = st_ivas->hIsmMetaData[nS]->edited_pitch;
                    ismMetaData[nS].non_diegetic_flag = st_ivas->hIsmMetaData[nS]->non_diegetic_flag;
					ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain;
                    hIsmMetaData[nS] = &ismMetaData[nS];
                }

@@ -194,16 +195,14 @@ ivas_error ivas_td_binaural_renderer_sf(
                    return error;
                }
            }
#endif
            else
            {
#endif
                if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#ifdef OBJ_EDITING_API
            }
#endif
        }

        /* Update the listener's location/orientation */
+6 −0
Original line number Diff line number Diff line
@@ -552,6 +552,12 @@ ivas_error TDREND_Update_object_positions(
            {
                return error;
            }
#ifdef OBJ_EDITING_INTERFACE
			if ( ( error = TDREND_MIX_SRC_SetGain( hBinRendererTd, nS, hIsmMetaData[nS]->gain ) ) != IVAS_ERR_OK )
			{
				return error;
			}
#endif

            if ( hIsmMetaData[nS]->non_diegetic_flag )
            {
+28 −0
Original line number Diff line number Diff line
@@ -128,6 +128,34 @@ ivas_error TDREND_MIX_SRC_SetDir(
    return IVAS_ERR_OK;
}

#ifdef OBJ_EDITING_INTERFACE
/*-------------------------------------------------------------------*
 * TDREND_MIX_SRC_SetSourceGain()
 *
 * Set source gain
 --------------------------------------------------------------------*/

ivas_error TDREND_MIX_SRC_SetGain(
	BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle                      */
	const int16_t SrcInd,                              /* i  : Source index        */
	const float Gain                                   /* i  : Gain    */
)
{
	TDREND_SRC_SPATIAL_t *SrcSpatial_p;

	/* Value verification */
	if ( ! ( Gain >= 0.0f && Gain <= 2.0f ) )
	{
		return (IVAS_ERROR(IVAS_ERR_WRONG_PARAMS, "Gain out of range. Command is ignored!\n"));
	}
	else
	{
		hBinRendererTd->Sources[SrcInd]->SrcRend_p->SrcGain_p[0] = Gain;
	}

	return IVAS_ERR_OK;
}
#endif

/*-------------------------------------------------------------------*
 * TDREND_MIX_SRC_SetDirAtten()
+8 −0
Original line number Diff line number Diff line
@@ -720,6 +720,14 @@ ivas_error TDREND_MIX_SRC_SetDir(
    const float *Vec_p                                          /* i  : Direction vector                        */
);

#ifdef OBJ_EDITING_INTERFACE
ivas_error TDREND_MIX_SRC_SetGain(
	BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle                      */
	const int16_t SrcInd,                              /* i  : Source index        */
	const float Gain                                   /* i  : Gain    */
);
#endif

ivas_error TDREND_MIX_SRC_SetDirAtten(
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd,          /* i/o: TD renderer handle                      */
    const int16_t SrcInd,                                       /* i  : Source index                            */