Adding renderer and reproduction module methods

parent 78cc75e5
......@@ -117,17 +117,17 @@ static struct PyMethodDef va_methods[] =
{ "get_portal_state", ( PyCFunction ) va_get_portal_state, METH_FASTCALL, va_no_doc },
{ "set_portal_state", ( PyCFunction ) va_set_portal_state, METH_FASTCALL, va_no_doc },
{ "get_rendering_modules", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_rendering_module_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "is_rendering_module_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_rendering_module_gain", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_rendering_module_gain", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_reproduction_modules", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_reproduction_module_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "is_reproduction_module_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_reproduction_module_gain", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_reproduction_module_gain", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_rendering_modules", ( PyCFunction ) va_get_rendering_modules, METH_FASTCALL, va_no_doc },
{ "set_rendering_module_muted", ( PyCFunction ) va_set_rendering_module_muted, METH_FASTCALL, va_no_doc },
{ "is_rendering_module_muted", ( PyCFunction ) va_is_rendering_module_muted, METH_FASTCALL, va_no_doc },
{ "set_rendering_module_gain", ( PyCFunction ) va_set_rendering_module_gain, METH_FASTCALL, va_no_doc },
{ "get_rendering_module_gain", ( PyCFunction ) va_get_rendering_module_gain, METH_FASTCALL, va_no_doc },
{ "get_reprodution_modules", ( PyCFunction ) va_get_reproduction_modules, METH_FASTCALL, va_no_doc },
{ "set_reprodution_module_muted", ( PyCFunction ) va_set_reproduction_module_muted, METH_FASTCALL, va_no_doc },
{ "is_reprodution_module_muted", ( PyCFunction ) va_is_reproduction_module_muted, METH_FASTCALL, va_no_doc },
{ "set_reprodution_module_gain", ( PyCFunction ) va_set_reproduction_module_gain, METH_FASTCALL, va_no_doc },
{ "get_reprodution_module_gain", ( PyCFunction ) va_get_reproduction_module_gain, METH_FASTCALL, va_no_doc },
{ "get_input_gain", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_input_gain", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
......
......@@ -228,7 +228,7 @@ static PyObject* va_enumerate_modules( PyObject*, PyObject* )
for( size_t i = 0; i < voModuleInfos.size(); i++ )
{
CVAModuleInfo& oModule( voModuleInfos[ i ] );
PyObject* pModuleInfo = Py_BuildValue( "{s:i,s:s,s:s}", "index", i, "name", oModule.sName.c_str(), "description", oModule.sDesc.c_str() );
PyObject* pModuleInfo = Py_BuildValue( "{s:i,s:s,s:s}", "index", i, "name", SaveStringToUnicodeConversion( oModule.sName ).c_str(), "description", SaveStringToUnicodeConversion( oModule.sDesc ).c_str() );
PyList_SetItem( pModuleList, i, pModuleInfo ); // steals reference
}
......@@ -1790,3 +1790,189 @@ static PyObject* va_set_portal_state( PyObject*, PyObject** ppArgs, Py_ssize_t n
VAPY_CATCH_RETURN;
};
static PyObject* va_get_rendering_modules( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
std::vector< CVAAudioRendererInfo > voInfos;
g_pVANetClient->GetCoreInstance()->GetRenderingModules( voInfos );
PyObject* pList = PyList_New( voInfos.size() );
for( size_t i = 0; i < voInfos.size(); i++ )
{
CVAAudioRendererInfo& oInfo( voInfos[ i ] );
PyObject* pInfo = Py_BuildValue( "{s:b,s:s,s:s}",
"enabled", oInfo.bEnabled,
"class", SaveStringToUnicodeConversion( oInfo.sClass ).c_str(),
"description", SaveStringToUnicodeConversion( oInfo.sDescription ).c_str(),
"id", SaveStringToUnicodeConversion( oInfo.sID ).c_str());
PyList_SetItem( pList, i, pInfo ); // steals reference
}
return pList;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_rendering_module_gain( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "s:get_rendering_module_gain", _keywords, 0 };
char* pcID = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
return PyFloat_FromDouble( g_pVANetClient->GetCoreInstance()->GetRenderingModuleGain( sID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_rendering_module_gain( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "gain", NULL };
static _PyArg_Parser _parser = { "sd:set_rendering_module_gain", _keywords, 0 };
char* pcID = nullptr;
double dGain = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID, &dGain ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
g_pVANetClient->GetCoreInstance()->SetRenderingModuleGain( sID, dGain );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_rendering_module_muted( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "muted", NULL };
static _PyArg_Parser _parser = { "i|b:set_rendering_module_muted", _keywords, 0 };
char* pcID = nullptr;
bool bMuted = true;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID, &bMuted ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
g_pVANetClient->GetCoreInstance()->SetRenderingModuleMuted( sID, bMuted );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_is_rendering_module_muted( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "s:is_rendering_module_muted", _keywords, 0 };
char* pcID = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
return PyBool_FromLong( g_pVANetClient->GetCoreInstance()->IsRenderingModuleMuted( sID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_reproduction_modules( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
std::vector< CVAAudioReproductionInfo > voInfos;
g_pVANetClient->GetCoreInstance()->GetReproductionModules( voInfos );
PyObject* pList = PyList_New( voInfos.size() );
for( size_t i = 0; i < voInfos.size(); i++ )
{
CVAAudioReproductionInfo& oInfo( voInfos[ i ] );
PyObject* pInfo = Py_BuildValue( "{s:b,s:s,s:s}",
"enabled", oInfo.bEnabled,
"class", SaveStringToUnicodeConversion( oInfo.sClass ).c_str(),
"description", SaveStringToUnicodeConversion( oInfo.sDescription ).c_str(),
"id", SaveStringToUnicodeConversion( oInfo.sID ).c_str() );
PyList_SetItem( pList, i, pInfo ); // steals reference
}
return pList;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_reproduction_module_gain( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "s:get_reproduction_module_gain", _keywords, 0 };
char* pcID = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
return PyFloat_FromDouble( g_pVANetClient->GetCoreInstance()->GetReproductionModuleGain( sID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_reproduction_module_gain( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "gain", NULL };
static _PyArg_Parser _parser = { "sd:set_reproduction_module_gain", _keywords, 0 };
char* pcID = nullptr;
double dGain = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID, &dGain ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
g_pVANetClient->GetCoreInstance()->SetReproductionModuleGain( sID, dGain );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_reproduction_module_muted( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "muted", NULL };
static _PyArg_Parser _parser = { "i|b:set_reproduction_module_muted", _keywords, 0 };
char* pcID = nullptr;
bool bMuted = true;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID, &bMuted ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
g_pVANetClient->GetCoreInstance()->SetReproductionModuleMuted( sID, bMuted );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_is_reproduction_module_muted( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "s:is_reproduction_module_muted", _keywords, 0 };
char* pcID = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcID ) )
return NULL;
std::string sID = pcID ? std::string( pcID ) : "";
return PyBool_FromLong( g_pVANetClient->GetCoreInstance()->IsReproductionModuleMuted( sID ) );
VAPY_CATCH_RETURN;
};
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