Adding listener methods

parent aef86072
......@@ -81,34 +81,32 @@ static struct PyMethodDef va_methods[] =
{ "get_sound_source_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_sound_source_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_ids", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_ids", ( PyCFunction ) va_get_listener_ids, METH_FASTCALL, va_no_doc },
{ "create_listener", ( PyCFunction ) va_create_listener, METH_FASTCALL, va_no_doc },
{ "create_listener_explicit_renderer", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "delete_listener", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_enabled", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_enabled", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_name", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_enabled", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_auralization_mode", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_auralization_mode", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_hrir", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_hrir", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_volume", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_volume", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "is_listener_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_listener_explicit_renderer", ( PyCFunction ) va_create_listener_explicit_renderer, METH_FASTCALL, va_no_doc },
{ "delete_listener", ( PyCFunction ) va_delete_listener, METH_FASTCALL, va_no_doc },
{ "set_listener_enabled", ( PyCFunction ) va_set_listener_enabled, METH_FASTCALL, va_no_doc },
{ "get_listener_enabled", ( PyCFunction ) va_get_listener_enabled, METH_FASTCALL, va_no_doc },
{ "get_listener_name", ( PyCFunction ) va_get_listener_name, METH_FASTCALL, va_no_doc },
{ "set_listener_enabled", ( PyCFunction ) va_set_listener_enabled, METH_FASTCALL, va_no_doc },
{ "get_listener_auralization_mode", ( PyCFunction ) va_get_listener_auralization_mode, METH_FASTCALL, va_no_doc },
{ "set_listener_auralization_mode", ( PyCFunction ) va_set_listener_auralization_mode, METH_FASTCALL, va_no_doc },
{ "set_listener_parameters", ( PyCFunction ) va_set_listener_parameters, METH_FASTCALL, va_no_doc },
{ "get_listener_parameters", ( PyCFunction ) va_get_listener_parameters, METH_FASTCALL, va_no_doc },
{ "get_listener_hrir", ( PyCFunction ) va_get_listener_hrir, METH_FASTCALL, va_no_doc },
{ "set_listener_hrir", ( PyCFunction ) va_set_listener_hrir, METH_FASTCALL, va_no_doc },
{ "get_active_listener", ( PyCFunction ) va_get_active_listener, METH_FASTCALL, va_no_doc },
{ "set_active_listener", ( PyCFunction ) va_set_active_listener, METH_FASTCALL, va_no_doc },
{ "get_listener_position", ( PyCFunction ) va_get_listener_position, METH_FASTCALL, va_no_doc },
{ "set_listener_position", ( PyCFunction ) va_set_listener_position, METH_FASTCALL, va_no_doc },
{ "get_listener_orientation_vu", ( PyCFunction ) va_get_listener_orientation_vu, METH_FASTCALL, va_no_doc },
{ "set_listener_orientation_vu", ( PyCFunction ) va_set_listener_orientation_vu, METH_FASTCALL, va_no_doc },
{ "get_listener_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_real_world_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_real_world_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_real_world_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_real_world_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_listener_real_world_position", ( PyCFunction ) va_get_listener_real_world_position, METH_FASTCALL, va_no_doc },
{ "set_listener_real_world_position", ( PyCFunction ) va_set_listener_real_world_position, METH_FASTCALL, va_no_doc },
{ "get_listener_real_world_orientation_vu", ( PyCFunction ) va_get_listener_real_world_orientation_vu, METH_FASTCALL, va_no_doc },
{ "set_listener_real_world_orientation_vu", ( PyCFunction ) va_set_listener_real_world_orientation_vu, METH_FASTCALL, va_no_doc },
{ "get_listener_real_world_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_listener_real_world_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
......
......@@ -275,23 +275,6 @@ static PyObject* va_add_search_path( PyObject*, PyObject** ppArgs, Py_ssize_t nA
VAPY_CATCH_RETURN;
};
static PyObject* va_create_listener( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "name", NULL };
static _PyArg_Parser _parser = { "s:create_listener", _keywords, 0 };
char* pcName = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcName ) )
return NULL;
std::string sName = pcName ? std::string( pcName ) : "PyListener";
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->CreateListener( sName, IVACore::VA_AURAMODE_ALL ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_is_scene_locked( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
......@@ -811,7 +794,7 @@ static PyObject* va_get_sound_source_position( PyObject*, PyObject** ppArgs, Py_
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:va_get_sound_source_position", _keywords, 0 };
static _PyArg_Parser _parser = { "i:vet_sound_source_position", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
......@@ -909,3 +892,455 @@ static PyObject* va_set_sound_source_orientation_vu( PyObject*, PyObject** ppArg
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_ids( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
std::vector< int > viIDs;
g_pVANetClient->GetCoreInstance()->GetListenerIDs( viIDs );
PyObject* pIDList = PyList_New( viIDs.size() );
for( Py_ssize_t i = 0; i < PyList_GET_SIZE( pIDList ); i++ )
PyList_SetItem( pIDList, i, PyLong_FromLong( viIDs[ i ] ) );
return pIDList;
VAPY_CATCH_RETURN;
};
static PyObject* va_create_listener( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "name", NULL };
static _PyArg_Parser _parser = { "s:create_listener", _keywords, 0 };
char* pcName = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcName ) )
return NULL;
std::string sName = pcName ? std::string( pcName ) : "PyListener";
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->CreateListener( sName, IVACore::VA_AURAMODE_ALL ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_create_listener_explicit_renderer( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "name", "renderer", NULL };
static _PyArg_Parser _parser = { "ss:create_listener_explicit_renderer", _keywords, 0 };
char* pcName = nullptr;
char* pcRenderer = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcName, &pcRenderer ) )
return NULL;
std::string sRenderer = pcRenderer ? std::string( pcRenderer ) : "Unspecified";
std::string sName = pcName ? std::string( pcName ) : "PyListener_" + sRenderer;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->CreateListenerExplicitRenderer( sName, sRenderer ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_delete_listener( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:delete_listener", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->DeleteListener( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_enabled( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "enabled", NULL };
static _PyArg_Parser _parser = { "i|b:set_listener_enabled", _keywords, 0 };
long iID = -1;
bool bEnabled = true;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &bEnabled ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetListenerEnabled( iID, bEnabled );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_enabled( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_enabled", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyBool_FromLong( g_pVANetClient->GetCoreInstance()->GetListenerEnabled( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_name( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_name", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyUnicode_FromString( SaveStringToUnicodeConversion( g_pVANetClient->GetCoreInstance()->GetListenerName( iID ) ).c_str() );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_auralization_mode( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_auralization_mode", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->GetListenerAuralizationMode( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_auralization_mode( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "auralizationmode", NULL };
static _PyArg_Parser _parser = { "ii:set_listener_auralization_mode", _keywords, 0 };
long iID = -1;
long iAuralizationMode = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &iAuralizationMode ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetListenerAuralizationMode( iID, iAuralizationMode );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_parameters( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "parameters", NULL };
static _PyArg_Parser _parser = { "iO!:set_listener_parameters", _keywords, 0 };
long iID = -1;
PyObject* pParameters = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pParameters ) )
return NULL;
CVAStruct oParameters = ConvertPythonDictToVAStruct( pParameters );
g_pVANetClient->GetCoreInstance()->SetListenerParameters( iID, oParameters );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_parameters( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "io!:get_listener_parameters", _keywords, 0 };
long iID = -1;
PyObject* pParameters = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pParameters ) )
return NULL;
CVAStruct oParameters = ConvertPythonDictToVAStruct( pParameters );
CVAStruct oReturn = g_pVANetClient->GetCoreInstance()->GetListenerParameters( iID, oParameters );
return ConvertVAStructToPythonDict( oReturn );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_hrir( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_hrir", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->GetListenerHRIRDataset( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_hrir( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "hrir", NULL };
static _PyArg_Parser _parser = { "ii:set_listener_hrir", _keywords, 0 };
long iID = -1;
long iHRIRID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &iHRIRID ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetListenerHRIRDataset( iID, iHRIRID );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_active_listener( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->GetActiveListener() );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_active_listener( 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:set_active_listener", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetActiveListener( iID );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_position( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_position", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
VAVec3 v3Pos;
g_pVANetClient->GetCoreInstance()->GetListenerPosition( iID, v3Pos.x, v3Pos.y, v3Pos.z );
PyObject* pPosList = PyList_New( 3 );
PyList_SetItem( pPosList, 0, PyFloat_FromDouble( v3Pos.x ) );
PyList_SetItem( pPosList, 1, PyFloat_FromDouble( v3Pos.y ) );
PyList_SetItem( pPosList, 2, PyFloat_FromDouble( v3Pos.z ) );
return pPosList;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_position( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "pos", NULL };
static _PyArg_Parser _parser = { "i(d,d,d):va_set_listener_position", _keywords, 0 };
long iID = -1;
PyObject* pPosList = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pPosList ) )
return NULL;
VAVec3 v3Pos;
v3Pos.x = PyFloat_AsDouble( PyList_GetItem( pPosList, 0 ) );
v3Pos.y = PyFloat_AsDouble( PyList_GetItem( pPosList, 1 ) );
v3Pos.z = PyFloat_AsDouble( PyList_GetItem( pPosList, 2 ) );
g_pVANetClient->GetCoreInstance()->SetListenerPosition( iID, v3Pos.x, v3Pos.y, v3Pos.z );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_orientation_vu( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_orientation_vu", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
VAVec3 v3View, v3Up;
g_pVANetClient->GetCoreInstance()->GetListenerOrientationVU( iID, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
PyObject* pViewList = PyList_New( 3 );
PyList_SetItem( pViewList, 0, PyFloat_FromDouble( v3View.x ) );
PyList_SetItem( pViewList, 1, PyFloat_FromDouble( v3View.y ) );
PyList_SetItem( pViewList, 2, PyFloat_FromDouble( v3View.z ) );
PyObject* pUpList = PyList_New( 3 );
PyList_SetItem( pUpList, 0, PyFloat_FromDouble( v3View.x ) );
PyList_SetItem( pUpList, 1, PyFloat_FromDouble( v3View.y ) );
PyList_SetItem( pUpList, 2, PyFloat_FromDouble( v3View.z ) );
PyObject* pViewUpList = PyList_New( 2 );
PyList_SetItem( pUpList, 0, pViewList );
PyList_SetItem( pUpList, 1, pUpList );
return pViewUpList;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_orientation_vu( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "view", "up", NULL };
static _PyArg_Parser _parser = { "i(d,d,d)(d,d,d):set_listener_orientation_vu", _keywords, 0 };
long iID = -1;
PyObject* pViewList = nullptr;
PyObject* pUpList = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pViewList, &pUpList ) )
return NULL;
VAVec3 v3View;
v3View.x = PyFloat_AsDouble( PyList_GetItem( pViewList, 0 ) );
v3View.y = PyFloat_AsDouble( PyList_GetItem( pViewList, 1 ) );
v3View.z = PyFloat_AsDouble( PyList_GetItem( pViewList, 2 ) );
VAVec3 v3Up;
v3Up.x = PyFloat_AsDouble( PyList_GetItem( pUpList, 0 ) );
v3Up.y = PyFloat_AsDouble( PyList_GetItem( pUpList, 1 ) );
v3Up.z = PyFloat_AsDouble( PyList_GetItem( pUpList, 2 ) );
g_pVANetClient->GetCoreInstance()->SetListenerOrientationVU( iID, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_real_world_position( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_real_world_position", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
VAVec3 v3Pos;
double t;
g_pVANetClient->GetCoreInstance()->GetListenerRealWorldHeadPositionOrientationVU( iID, v3Pos.x, v3Pos.y, v3Pos.z, t, t, t, t, t, t );
PyObject* pPosList = PyList_New( 3 );
PyList_SetItem( pPosList, 0, PyFloat_FromDouble( v3Pos.x ) );
PyList_SetItem( pPosList, 1, PyFloat_FromDouble( v3Pos.y ) );
PyList_SetItem( pPosList, 2, PyFloat_FromDouble( v3Pos.z ) );
return pPosList;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_real_world_position( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "pos", NULL };
static _PyArg_Parser _parser = { "i(d,d,d):va_set_listener_real_world_position", _keywords, 0 };
long iID = -1;
PyObject* pPosList = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pPosList ) )
return NULL;
double t;
VAVec3 v3View, v3Up;
g_pVANetClient->GetCoreInstance()->GetListenerRealWorldHeadPositionOrientationVU( iID, t, t, t, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
VAVec3 v3Pos;
v3Pos.x = PyFloat_AsDouble( PyList_GetItem( pPosList, 0 ) );
v3Pos.y = PyFloat_AsDouble( PyList_GetItem( pPosList, 1 ) );
v3Pos.z = PyFloat_AsDouble( PyList_GetItem( pPosList, 2 ) );
g_pVANetClient->GetCoreInstance()->SetListenerRealWorldHeadPositionOrientationVU( iID, v3Pos.x, v3Pos.y, v3Pos.z, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_listener_real_world_orientation_vu( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", NULL };
static _PyArg_Parser _parser = { "i:get_listener_real_world_orientation_vu", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
double t;
VAVec3 v3View, v3Up;
g_pVANetClient->GetCoreInstance()->GetListenerRealWorldHeadPositionOrientationVU( iID, t, t, t, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
PyObject* pViewList = PyList_New( 3 );
PyList_SetItem( pViewList, 0, PyFloat_FromDouble( v3View.x ) );
PyList_SetItem( pViewList, 1, PyFloat_FromDouble( v3View.y ) );
PyList_SetItem( pViewList, 2, PyFloat_FromDouble( v3View.z ) );
PyObject* pUpList = PyList_New( 3 );
PyList_SetItem( pUpList, 0, PyFloat_FromDouble( v3View.x ) );
PyList_SetItem( pUpList, 1, PyFloat_FromDouble( v3View.y ) );
PyList_SetItem( pUpList, 2, PyFloat_FromDouble( v3View.z ) );
PyObject* pViewUpList = PyList_New( 2 );
PyList_SetItem( pUpList, 0, pViewList );
PyList_SetItem( pUpList, 1, pUpList );
return pViewUpList;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_listener_real_world_orientation_vu( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "view", "up", NULL };
static _PyArg_Parser _parser = { "i(d,d,d)(d,d,d):set_listener_real_world_orientation_vu", _keywords, 0 };
long iID = -1;
PyObject* pViewList = nullptr;
PyObject* pUpList = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pViewList, &pUpList ) )
return NULL;
double t;
VAVec3 v3Pos;
g_pVANetClient->GetCoreInstance()->GetListenerRealWorldHeadPositionOrientationVU( iID, v3Pos.x, v3Pos.y, v3Pos.z, t, t, t, t, t, t );
VAVec3 v3View;
v3View.x = PyFloat_AsDouble( PyList_GetItem( pViewList, 0 ) );
v3View.y = PyFloat_AsDouble( PyList_GetItem( pViewList, 1 ) );
v3View.z = PyFloat_AsDouble( PyList_GetItem( pViewList, 2 ) );
VAVec3 v3Up;
v3Up.x = PyFloat_AsDouble( PyList_GetItem( pUpList, 0 ) );
v3Up.y = PyFloat_AsDouble( PyList_GetItem( pUpList, 1 ) );
v3Up.z = PyFloat_AsDouble( PyList_GetItem( pUpList, 2 ) );
g_pVANetClient->GetCoreInstance()->SetListenerRealWorldHeadPositionOrientationVU( iID, v3Pos.x, v3Pos.y, v3Pos.z, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
return Py_None;
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