Skip to content
Snippets Groups Projects
Commit aef86072 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Implementing all sound source API calls (untested)

parent 9d35155d
Branches
Tags
No related merge requests found
...@@ -53,30 +53,31 @@ static struct PyMethodDef va_methods[] = ...@@ -53,30 +53,31 @@ static struct PyMethodDef va_methods[] =
{ "lock_scene", ( PyCFunction ) va_lock_scene, METH_FASTCALL, va_no_doc }, { "lock_scene", ( PyCFunction ) va_lock_scene, METH_FASTCALL, va_no_doc },
{ "unlock_scene", ( PyCFunction ) va_unlock_scene, METH_FASTCALL, va_no_doc }, { "unlock_scene", ( PyCFunction ) va_unlock_scene, METH_FASTCALL, va_no_doc },
{ "get_sound_source_ids", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_ids", ( PyCFunction ) va_get_sound_source_ids, METH_FASTCALL, va_no_doc },
{ "create_sound_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "create_sound_source", ( PyCFunction ) va_create_sound_source, METH_FASTCALL, va_no_doc },
{ "create_sound_source_explicit_renderer", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "create_sound_source_explicit_renderer", ( PyCFunction ) va_create_sound_source_explicit_renderer, METH_FASTCALL, va_no_doc },
{ "delete_sound_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "delete_sound_source", ( PyCFunction ) va_delete_sound_source, METH_FASTCALL, va_no_doc },
{ "set_sound_source_enabled", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_enabled", ( PyCFunction ) va_set_sound_source_enabled, METH_FASTCALL, va_no_doc },
{ "get_sound_source_enabled", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_enabled", ( PyCFunction ) va_get_sound_source_enabled, METH_FASTCALL, va_no_doc },
{ "get_sound_source_name", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_name", ( PyCFunction ) va_get_sound_source_name, METH_FASTCALL, va_no_doc },
{ "set_sound_source_enabled", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_enabled", ( PyCFunction ) va_set_sound_source_enabled, METH_FASTCALL, va_no_doc },
{ "get_sound_source_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_signal_source", ( PyCFunction ) va_get_sound_source_signal_source, METH_FASTCALL, va_no_doc },
{ "set_sound_source_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_signal_source", ( PyCFunction ) va_set_sound_source_signal_source, METH_FASTCALL, va_no_doc },
{ "remove_sound_source_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "remove_sound_source_signal_source", ( PyCFunction ) va_remove_sound_source_signal_source, METH_FASTCALL, va_no_doc },
{ "get_sound_source_auralization_mode", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_auralization_mode", ( PyCFunction ) va_get_sound_source_auralization_mode, METH_FASTCALL, va_no_doc },
{ "set_sound_source_auralization_mode", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_auralization_mode", ( PyCFunction ) va_set_sound_source_auralization_mode, METH_FASTCALL, va_no_doc },
{ "set_sound_source_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_parameters", ( PyCFunction ) va_set_sound_source_parameters, METH_FASTCALL, va_no_doc },
{ "get_sound_source_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_parameters", ( PyCFunction ) va_get_sound_source_parameters, METH_FASTCALL, va_no_doc },
{ "get_sound_source_directivity", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_directivity", ( PyCFunction ) va_get_sound_source_directivity, METH_FASTCALL, va_no_doc },
{ "set_sound_source_directivity", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_directivity", ( PyCFunction ) va_set_sound_source_directivity, METH_FASTCALL, va_no_doc },
{ "get_sound_source_volume", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_volume", ( PyCFunction ) va_get_sound_source_volume, METH_FASTCALL, va_no_doc },
{ "set_sound_source_volume", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_volume", ( PyCFunction ) va_set_sound_source_volume, METH_FASTCALL, va_no_doc },
{ "is_sound_source_muted", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "is_sound_source_muted", ( PyCFunction ) va_is_sound_source_muted, METH_FASTCALL, va_no_doc },
{ "get_sound_source_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_muted", ( PyCFunction ) va_set_sound_source_muted, METH_FASTCALL, va_no_doc },
{ "set_sound_source_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_position", ( PyCFunction ) va_get_sound_source_position, METH_FASTCALL, va_no_doc },
{ "get_sound_source_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "set_sound_source_position", ( PyCFunction ) va_set_sound_source_position, METH_FASTCALL, va_no_doc },
{ "set_sound_source_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "get_sound_source_orientation_vu", ( PyCFunction ) va_get_sound_source_orientation_vu, METH_FASTCALL, va_no_doc },
{ "set_sound_source_orientation_vu", ( PyCFunction ) va_set_sound_source_orientation_vu, METH_FASTCALL, va_no_doc },
{ "get_sound_source_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc }, { "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 }, { "set_sound_source_orientation_q", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
...@@ -97,6 +98,7 @@ static struct PyMethodDef va_methods[] = ...@@ -97,6 +98,7 @@ static struct PyMethodDef va_methods[] =
{ "get_listener_volume", ( 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 }, { "set_listener_volume", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "is_listener_muted", ( 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 }, { "get_listener_position", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_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 }, { "get_listener_orientation_vu", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
......
...@@ -32,6 +32,17 @@ static void RequireCoreAvailable() ...@@ -32,6 +32,17 @@ static void RequireCoreAvailable()
VA_EXCEPT2( CVAException::NETWORK_ERROR, "VA client available, but access to VA interface failed. Please reconnect." ); VA_EXCEPT2( CVAException::NETWORK_ERROR, "VA client available, but access to VA interface failed. Please reconnect." );
}; };
std::string SaveStringToUnicodeConversion( const std::string& sInputString )
{
std::string sOutputString = sInputString;
const Py_ssize_t iLength = sInputString.length();
char* pcBuffer( &sOutputString[ 0 ] );
for( Py_ssize_t i = 0; i < iLength; i++ )
if( pcBuffer[ i ] < 0 )
pcBuffer[ i ] = '_';
return &sOutputString[ 0 ];
};
//! Helper to convert recursively from VAStruct to Python dict //! Helper to convert recursively from VAStruct to Python dict
PyObject* ConvertVAStructToPythonDict( const CVAStruct& oInStruct ) PyObject* ConvertVAStructToPythonDict( const CVAStruct& oInStruct )
{ {
...@@ -150,17 +161,6 @@ CVAStruct ConvertPythonDictToVAStruct(PyObject* pInDict) ...@@ -150,17 +161,6 @@ CVAStruct ConvertPythonDictToVAStruct(PyObject* pInDict)
}; };
std::string SaveStringToUnicodeConversion( const std::string& sInputString)
{
std::string sOutputString = sInputString;
const Py_ssize_t iLength = sInputString.length();
char* pcBuffer( &sOutputString[0] );
for (Py_ssize_t i = 0; i < iLength; i++)
if (pcBuffer[i] < 0)
pcBuffer[i] = '_';
return &sOutputString[0];
};
// ------------------------------- Python module extension methods // ------------------------------- Python module extension methods
static PyObject* va_connect( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames ) static PyObject* va_connect( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
...@@ -275,14 +275,19 @@ static PyObject* va_add_search_path(PyObject*, PyObject** ppArgs, Py_ssize_t nAr ...@@ -275,14 +275,19 @@ static PyObject* va_add_search_path(PyObject*, PyObject** ppArgs, Py_ssize_t nAr
VAPY_CATCH_RETURN; VAPY_CATCH_RETURN;
}; };
static PyObject* va_create_listener(PyObject*, PyObject*)
static PyObject* va_create_listener( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{ {
VAPY_REQUIRE_CONN_TRY; VAPY_REQUIRE_CONN_TRY;
std::string sName = "PyListener"; static const char * const _keywords[] = { "name", NULL };
int iID = g_pVANetClient->GetCoreInstance()->CreateListener(sName, IVACore::VA_AURAMODE_ALL); static _PyArg_Parser _parser = { "s:create_listener", _keywords, 0 };
char* pcName = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcName ) )
return NULL;
return PyLong_FromLong(iID); std::string sName = pcName ? std::string( pcName ) : "PyListener";
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->CreateListener( sName, IVACore::VA_AURAMODE_ALL ) );
VAPY_CATCH_RETURN; VAPY_CATCH_RETURN;
}; };
...@@ -472,3 +477,435 @@ static PyObject* va_get_hrir_infos(PyObject*, PyObject*) ...@@ -472,3 +477,435 @@ static PyObject* va_get_hrir_infos(PyObject*, PyObject*)
VAPY_CATCH_RETURN; VAPY_CATCH_RETURN;
}; };
static PyObject* va_get_sound_source_ids( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
std::vector< int > viIDs;
g_pVANetClient->GetCoreInstance()->GetSoundSourceIDs( 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_sound_source( 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_sound_source", _keywords, 0 };
char* pcName = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcName ) )
return NULL;
std::string sName = pcName ? std::string( pcName ) : "PySoundSource";
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->CreateSoundSource( sName, IVACore::VA_AURAMODE_ALL ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_create_sound_source_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_sound_source_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 ) : "PySoundSource_" + sRenderer;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->CreateSoundSourceExplicitRenderer( sName, sRenderer ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_delete_sound_source( 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_sound_source", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->DeleteSoundSource( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_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_sound_source_enabled", _keywords, 0 };
long iID = -1;
bool bEnabled = true;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &bEnabled ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetSoundSourceEnabled( iID, bEnabled );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_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_sound_source_enabled", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyBool_FromLong( g_pVANetClient->GetCoreInstance()->GetSoundSourceEnabled( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_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_sound_source_name", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyUnicode_FromString( SaveStringToUnicodeConversion( g_pVANetClient->GetCoreInstance()->GetSoundSourceName( iID ) ).c_str() );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_signal_source( 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_sound_source_signal_source", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyUnicode_FromString( SaveStringToUnicodeConversion( g_pVANetClient->GetCoreInstance()->GetSoundSourceSignalSource( iID ) ).c_str() );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_signal_source( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "signalsource", NULL };
static _PyArg_Parser _parser = { "is:set_sound_source_signal_source", _keywords, 0 };
long iID = -1;
char* pcSignalSourceID;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &pcSignalSourceID ) )
return NULL;
std::string sSIgnalSourceID = pcSignalSourceID ? std::string( pcSignalSourceID ) : "";
g_pVANetClient->GetCoreInstance()->SetSoundSourceSignalSource( iID, sSIgnalSourceID );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_remove_sound_source_signal_source( 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:remove_sound_source_signal_source", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
g_pVANetClient->GetCoreInstance()->RemoveSoundSourceSignalSource( iID );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_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_sound_source_auralization_mode", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->GetSoundSourceAuralizationMode( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_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_sound_source_auralization_mode", _keywords, 0 };
long iID = -1;
long iAuralizationMode = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &iAuralizationMode ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetSoundSourceAuralizationMode( iID, iAuralizationMode );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_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_sound_source_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()->SetSoundSourceParameters( iID, oParameters );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_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_sound_source_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()->GetSoundSourceParameters( iID, oParameters );
return ConvertVAStructToPythonDict( oReturn );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_directivity( 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_sound_source_directivity", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyLong_FromLong( g_pVANetClient->GetCoreInstance()->GetSoundSourceDirectivity( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_directivity( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "id", "directivity", NULL };
static _PyArg_Parser _parser = { "ii:set_sound_source_directivity", _keywords, 0 };
long iID = -1;
long iDirectivityID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &iDirectivityID ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetSoundSourceDirectivity( iID, iDirectivityID );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_volume( 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_sound_source_volume", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyFloat_FromDouble( g_pVANetClient->GetCoreInstance()->GetSoundSourceVolume( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_volume( 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 = { "id:set_sound_source_volume", _keywords, 0 };
long iID = -1;
double dGain = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &dGain ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetSoundSourceVolume( iID, dGain );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_sound_source_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_sound_source_muted", _keywords, 0 };
long iID = -1;
bool bMuted = true;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID, &bMuted ) )
return NULL;
g_pVANetClient->GetCoreInstance()->SetSoundSourceMuted( iID, bMuted );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_is_sound_source_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 = { "i:is_sound_source_muted", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
return PyBool_FromLong( g_pVANetClient->GetCoreInstance()->IsSoundSourceMuted( iID ) );
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_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:va_get_sound_source_position", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
VAVec3 v3Pos;
g_pVANetClient->GetCoreInstance()->GetSoundSourcePosition( 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_sound_source_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_sound_source_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()->SetSoundSourcePosition( iID, v3Pos.x, v3Pos.y, v3Pos.z );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_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_sound_source_orientation_vu", _keywords, 0 };
long iID = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iID ) )
return NULL;
VAVec3 v3View, v3Up;
g_pVANetClient->GetCoreInstance()->GetSoundSourceOrientationVU( 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_sound_source_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_sound_source_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()->SetSoundSourceOrientationVU( iID, v3View.x, v3View.y, v3View.z, v3Up.x, v3Up.y, v3Up.z );
return Py_None;
VAPY_CATCH_RETURN;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment