Fixing bugs

parent c492cd0c
......@@ -2736,27 +2736,9 @@ void set_core_clock( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]
// Rendering
REGISTER_PUBLIC_FUNCTION( set_rendering_module_gain, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_gain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_gain, dGain, "double-1x1", "gain (factor)" );
void set_rendering_module_gain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
double dGain = matlabGetRealScalar( prhs[ 2 ], "dGain" );
pConnection->pCoreInterface->SetRenderingModuleGain( sID, dGain );
}
REGISTER_PUBLIC_FUNCTION( set_rendering_module_muted, "Mutes a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_muted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_muted, bMuted, "logical-1x1", "Mute (true) or unmute (false)" );
void set_rendering_module_muted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
......@@ -2774,7 +2756,6 @@ void set_rendering_module_muted( int nlhs, mxArray *plhs[], int nrhs, const mxAr
REGISTER_PUBLIC_FUNCTION( get_rendering_module_muted, "Is reproduction module muted?", "" );
DECLARE_FUNCTION_REQUIRED_INARG( get_rendering_module_muted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( get_rendering_module_muted, bMuted, "logical-1x1", "true if muted, false if unmuted" );
void get_rendering_module_muted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
......@@ -2788,6 +2769,22 @@ void get_rendering_module_muted( int nlhs, mxArray *plhs[], int nrhs, const mxAr
plhs[ 0 ] = mxCreateLogicalScalar( bMuted );
}
REGISTER_PUBLIC_FUNCTION( set_rendering_module_gain, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_gain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_gain, dGain, "double-1x1", "gain (factor)" );
void set_rendering_module_gain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
double dGain = matlabGetRealScalar( prhs[ 2 ], "dGain" );
pConnection->pCoreInterface->SetRenderingModuleGain( sID, dGain );
}
REGISTER_PUBLIC_FUNCTION( get_rendering_module_gain, "Get rendering module output gain", "" );
DECLARE_FUNCTION_REQUIRED_INARG( get_rendering_module_gain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( get_rendering_module_gain, dGain, "double-1x1", "Gain (scalar)" );
......@@ -2805,6 +2802,37 @@ void get_rendering_module_gain( int nlhs, mxArray *plhs[], int nrhs, const mxArr
plhs[ 0 ] = mxCreateDoubleScalar( dGain );
}
REGISTER_PUBLIC_FUNCTION( get_rendering_module_auralization_mode, "Returns the current rendering module parameters", "" );
DECLARE_FUNCTION_REQUIRED_INARG( get_rendering_module_auralization_mode, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( get_rendering_module_auralization_mode, auralization_mode, "string", "Auralization mode as string" );
void get_rendering_module_auralization_mode( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
const int iAuralizationMode = pConnection->pCoreInterface->GetRenderingModuleAuralizationMode( sID );
plhs[ 0 ] = mxCreateString( IVAInterface::GetAuralizationModeStr( iAuralizationMode, true ).c_str() );
}
REGISTER_PUBLIC_FUNCTION( set_rendering_module_auralization_mode, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_auralization_mode, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( set_rendering_module_auralization_mode, am_str, "string", "auralization mode string" );
void set_rendering_module_auralization_mode( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
const std::string sAM = matlabGetString( prhs[ 2 ], "am_str" );
const int iAM = IVAInterface::ParseAuralizationModeStr( sAM );
pConnection->pCoreInterface->SetRenderingModuleAuralizationMode( sID, iAM );
}
REGISTER_PUBLIC_FUNCTION( get_rendering_module_parameters, "Returns the current rendering module parameters", "" );
DECLARE_FUNCTION_REQUIRED_INARG( get_rendering_module_parameters, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( get_rendering_module_parameters, args, "mstruct", "Requested parameters" );
......@@ -2854,8 +2882,8 @@ void get_rendering_modules( int nlhs, mxArray *plhs[], int nrhs, const mxArray *
const size_t nDims = int( voRenderers.size() );
const int nFields = 4;
const char* ppszFieldNames[] = { "id", "class", "enabled", "desc" };
const int nFields = 8;
const char* ppszFieldNames[] = { "id", "class", "enabled", "desc", "output_detector_enabled", "output_recording_enabled", "output_recording_file_path", "parameters" };
plhs[ 0 ] = mxCreateStructArray( 1, &nDims, nFields, ppszFieldNames );
for( size_t i = 0; i < nDims; i++ )
......@@ -2865,6 +2893,10 @@ void get_rendering_modules( int nlhs, mxArray *plhs[], int nrhs, const mxArray *
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voRenderers[ i ].sClass.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voRenderers[ i ].bEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voRenderers[ i ].sDescription.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voRenderers[ i ].bOutputDetectorEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voRenderers[ i ].bOutputRecordingEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voRenderers[ i ].sOutputRecordingFilePath.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], matlabCreateStruct( voRenderers[ i ].oParams ) );
}
}
......@@ -2955,8 +2987,11 @@ void get_reproduction_modules( int, mxArray *plhs[], int nrhs, const mxArray *pr
pConnection->pCoreInterface->GetReproductionModules( voReproductions, bFilterEnabled );
const size_t nDims = int( voReproductions.size() );
const int nFields = 4;
const char* ppszFieldNames[] = { "id", "class", "enabled", "desc" };
const int nFields = 11;
const char* ppszFieldNames[] = { "id", "class", "enabled", "desc",
"output_detector_enabled", "output_recording_enabled", "output_recording_file_path",
"input_detector_enabled", "input_recording_enabled", "input_recording_file_path",
"parameters" };
plhs[ 0 ] = mxCreateStructArray( 1, &nDims, nFields, ppszFieldNames );
for( size_t i = 0; i < nDims; i++ )
......@@ -2966,6 +3001,13 @@ void get_reproduction_modules( int, mxArray *plhs[], int nrhs, const mxArray *pr
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voReproductions[ i ].sClass.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voReproductions[ i ].bEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voReproductions[ i ].sDescription.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voReproductions[ i ].bOutputDetectorEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voReproductions[ i ].bOutputRecordingEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voReproductions[ i ].sOutputRecordingFilePath.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voReproductions[ i ].bInputDetectorEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateLogicalScalar( voReproductions[ i ].bInputRecordingEnabled ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voReproductions[ i ].sInputRecordingFilePath.c_str() ) );
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], matlabCreateStruct( voReproductions[ i ].oParams ) );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment