Implementing API changes

parent 59b5f3ac
......@@ -3102,83 +3102,117 @@ void setCoreClock(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
* | | *
* +----------------------------------------------------------+ */
REGISTER_PUBLIC_FUNCTION( setReproductionModuleGain, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleGain, dGain, "double-1x1", "gain (factor)" );
// Rendering
void setReproductionModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
REGISTER_PUBLIC_FUNCTION( setRenderingModuleGain, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleGain, dGain, "double-1x1", "gain (factor)" );
void setRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle(prhs[0]);
CVAMatlabConnection* pConnection = g_vpConnections[hHandle];
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[1], "sModuleID" );
double dGain = matlabGetRealScalar( prhs[2], "dGain" );
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
double dGain = matlabGetRealScalar( prhs[ 2 ], "dGain" );
pConnection->pCoreInterface->SetReproductionModuleGain( sID, dGain );
pConnection->pCoreInterface->SetRenderingModuleGain( sID, dGain );
}
REGISTER_PUBLIC_FUNCTION( setReproductionModuleMuted, "Mutes a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleMuted, bMuted, "logical-1x1", "Mute (true) or unmute (false)" );
REGISTER_PUBLIC_FUNCTION( setRenderingModuleMuted, "Mutes a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleMuted, bMuted, "logical-1x1", "Mute (true) or unmute (false)" );
void setReproductionModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void setRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
ConnectionHandle hHandle = GetConnectionHandle(prhs[0]);
CVAMatlabConnection* pConnection = g_vpConnections[hHandle];
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[1], "sModuleID" );
bool bMuted = matlabGetBoolScalar( prhs[2], "bMuted" );
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
bool bMuted = matlabGetBoolScalar( prhs[ 2 ], "bMuted" );
pConnection->pCoreInterface->SetReproductionModuleMuted( sID, bMuted );
pConnection->pCoreInterface->SetRenderingModuleMuted( sID, bMuted );
}
REGISTER_PUBLIC_FUNCTION( isReproductionModuleMuted, "Is reproduction module muted?", "" );
DECLARE_FUNCTION_REQUIRED_INARG( isReproductionModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( isReproductionModuleMuted, bMuted, "logical-1x1", "true if muted, false if unmuted");
REGISTER_PUBLIC_FUNCTION( isRenderingModuleMuted, "Is reproduction module muted?", "" );
DECLARE_FUNCTION_REQUIRED_INARG( isRenderingModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( isRenderingModuleMuted, bMuted, "logical-1x1", "true if muted, false if unmuted" );
void isReproductionModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void isRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle(prhs[0]);
CVAMatlabConnection* pConnection = g_vpConnections[hHandle];
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[1], "sModuleID" );
bool bMuted = pConnection->pCoreInterface->IsReproductionModuleMuted( sID );
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
bool bMuted = pConnection->pCoreInterface->IsRenderingModuleMuted( sID );
plhs[0] = mxCreateLogicalScalar( bMuted );
plhs[ 0 ] = mxCreateLogicalScalar( bMuted );
}
REGISTER_PUBLIC_FUNCTION( getReproductionModuleGain, "Returns the reproduction module output gain", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getReproductionModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( getReproductionModuleGain, dGain, "double-1x1", "Gain (scalar)");
REGISTER_PUBLIC_FUNCTION( getRenderingModuleGain, "Get rendering module output gain", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getRenderingModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( getRenderingModuleGain, dGain, "double-1x1", "Gain (scalar)" );
void getReproductionModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void getRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
ConnectionHandle hHandle = GetConnectionHandle(prhs[0]);
CVAMatlabConnection* pConnection = g_vpConnections[hHandle];
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::string sID = matlabGetString( prhs[1], "sModuleID" );
double dGain = pConnection->pCoreInterface->GetReproductionModuleGain( sID );
std::string sID = matlabGetString( prhs[ 1 ], "sModuleID" );
double dGain = pConnection->pCoreInterface->GetRenderingModuleGain( sID );
plhs[0] = mxCreateDoubleScalar( dGain );
plhs[ 0 ] = mxCreateDoubleScalar( dGain );
}
// Rendering
REGISTER_PUBLIC_FUNCTION( getRenderingModules, "Get list of rendering modules", "" );
DECLARE_FUNCTION_OPTIONAL_INARG( getRenderingModules, bFilterEnabled, "boolean-1x1", "Filter activated (true)", "1" );
REGISTER_PUBLIC_FUNCTION( setRenderingModuleGain, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleGain, dGain, "double-1x1", "gain (factor)" );
void getRenderingModules( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 0 );
void setRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
bool bFilterEnabled = true;
if( nrhs > 1 )
bFilterEnabled = matlabGetBoolScalar( prhs[ 1 ], "bFilterEnabled" );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::vector< CVAAudioRendererInfo > voRenderers;
pConnection->pCoreInterface->GetRenderingModules( voRenderers, bFilterEnabled );
const size_t nDims = int( voRenderers.size() );
const int nFields = 2;
const char* ppszFieldNames[] = { "id", "class", "enabled", "desc" };
plhs[ 0 ] = mxCreateStructArray( 1, &nDims, nFields, ppszFieldNames );
for( size_t i = 0; i < nDims; i++ )
{
size_t j = 0;
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voRenderers[ i ].sID.c_str() ) );
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() ) );
}
}
// Reproduction
REGISTER_PUBLIC_FUNCTION( setReproductionModuleGain, "Sets the output gain of a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleGain, dGain, "double-1x1", "gain (factor)" );
void setReproductionModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
......@@ -3189,14 +3223,14 @@ void setRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray
std::string sID = matlabGetString( prhs[1], "sModuleID" );
double dGain = matlabGetRealScalar( prhs[2], "dGain" );
pConnection->pCoreInterface->SetRenderingModuleGain( sID, dGain );
pConnection->pCoreInterface->SetReproductionModuleGain( sID, dGain );
}
REGISTER_PUBLIC_FUNCTION( setRenderingModuleMuted, "Mutes a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setRenderingModuleMuted, bMuted, "logical-1x1", "Mute (true) or unmute (false)" );
REGISTER_PUBLIC_FUNCTION( setReproductionModuleMuted, "Mutes a reproduction module", "" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_REQUIRED_INARG( setReproductionModuleMuted, bMuted, "logical-1x1", "Mute (true) or unmute (false)" );
void setRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void setReproductionModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 3 );
......@@ -3207,14 +3241,14 @@ void setRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray
std::string sID = matlabGetString( prhs[1], "sModuleID" );
bool bMuted = matlabGetBoolScalar( prhs[2], "bMuted" );
pConnection->pCoreInterface->SetRenderingModuleMuted( sID, bMuted );
pConnection->pCoreInterface->SetReproductionModuleMuted( sID, bMuted );
}
REGISTER_PUBLIC_FUNCTION( isRenderingModuleMuted, "Is reproduction module muted?", "" );
DECLARE_FUNCTION_REQUIRED_INARG( isRenderingModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( isRenderingModuleMuted, bMuted, "logical-1x1", "true if muted, false if unmuted");
REGISTER_PUBLIC_FUNCTION( isReproductionModuleMuted, "Is reproduction module muted?", "" );
DECLARE_FUNCTION_REQUIRED_INARG( isReproductionModuleMuted, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( isReproductionModuleMuted, bMuted, "logical-1x1", "true if muted, false if unmuted");
void isRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void isReproductionModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
......@@ -3222,16 +3256,16 @@ void isRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray
CVAMatlabConnection* pConnection = g_vpConnections[hHandle];
std::string sID = matlabGetString( prhs[1], "sModuleID" );
bool bMuted = pConnection->pCoreInterface->IsRenderingModuleMuted( sID );
bool bMuted = pConnection->pCoreInterface->IsReproductionModuleMuted( sID );
plhs[0] = mxCreateLogicalScalar( bMuted );
}
REGISTER_PUBLIC_FUNCTION( getRenderingModuleGain, "Get rendering module output gain", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getRenderingModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( getRenderingModuleGain, dGain, "double-1x1", "Gain (scalar)");
REGISTER_PUBLIC_FUNCTION( getReproductionModuleGain, "Returns the reproduction module output gain", "" );
DECLARE_FUNCTION_REQUIRED_INARG( getReproductionModuleGain, sModuleID, "string", "Module identifier" );
DECLARE_FUNCTION_OUTARG( getReproductionModuleGain, dGain, "double-1x1", "Gain (scalar)");
void getRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
void getReproductionModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 2 );
......@@ -3239,11 +3273,44 @@ void getRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray
CVAMatlabConnection* pConnection = g_vpConnections[hHandle];
std::string sID = matlabGetString( prhs[1], "sModuleID" );
double dGain = pConnection->pCoreInterface->GetRenderingModuleGain( sID );
double dGain = pConnection->pCoreInterface->GetReproductionModuleGain( sID );
plhs[0] = mxCreateDoubleScalar( dGain );
}
REGISTER_PUBLIC_FUNCTION( getReproductionModules, "Get list of rendering modules", "" );
DECLARE_FUNCTION_OPTIONAL_INARG( getReproductionModules, bFilterEnabled, "boolean-1x1", "Filter activated (true)", "1" );
void getReproductionModules( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
REQUIRE_INPUT_ARGS( 0 );
bool bFilterEnabled = true;
if( nrhs > 1 )
bFilterEnabled = matlabGetBoolScalar( prhs[ 1 ], "bFilterEnabled" );
ConnectionHandle hHandle = GetConnectionHandle( prhs[ 0 ] );
CVAMatlabConnection* pConnection = g_vpConnections[ hHandle ];
std::vector< CVAAudioReproductionInfo > voReproductions;
pConnection->pCoreInterface->GetReproductionModules( voReproductions, bFilterEnabled );
const size_t nDims = int( voReproductions.size() );
const int nFields = 2;
const char* ppszFieldNames[] = { "id", "class", "enabled", "desc" };
plhs[ 0 ] = mxCreateStructArray( 1, &nDims, nFields, ppszFieldNames );
for( size_t i = 0; i < nDims; i++ )
{
size_t j = 0;
mxSetField( plhs[ 0 ], i, ppszFieldNames[ j++ ], mxCreateString( voReproductions[ i ].sID.c_str() ) );
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() ) );
}
}
/* +----------------------------------------------------------+ *
* | | *
* | Timer | *
......
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