Adding most signal source methods

parent b4fdc7e5
......@@ -14,6 +14,8 @@ endif( )
if( NOT BUILD_SHARED_LIBS )
add_definitions( -DVAPYTHON_STATIC -DVABASE_STATIC -DVANET_STATIC )
else( )
message( WARNING "You are building shared libs, but it is _highly_ recommended to use static linking against ViSTA and VA libs with the Python binding. Otherwise DLLs with mismatching version could be loaded, which will lead to unpredictable behavior." )
endif( )
add_definitions( -DPy_NO_ENABLE_SHARED )
......
......@@ -29,25 +29,23 @@ static struct PyMethodDef va_methods[] =
{ "get_hrir_info", ( PyCFunction )va_get_hrir_info, METH_FASTCALL, va_no_doc },
{ "get_hrir_infos", ( PyCFunction )va_get_hrir_infos, METH_FASTCALL, va_no_doc },
{ "create_audio_file_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_text_to_speech_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_sequencer_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_network_stream_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_engine_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_machine_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "delete_signal_source", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_signal_source_info", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_signal_source_infos", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_machine_signal_source_state_str", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_speed", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_machine_signal_source_speed", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_start_file", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_idle_start_file", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_stop_start_file", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "add_sound_playback", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "remove_sound_playback", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_signal_source_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_signal_source_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "create_audio_file_signal_source", ( PyCFunction ) va_create_audio_file_signal_source, METH_FASTCALL, va_no_doc },
{ "create_text_to_speech_signal_source", ( PyCFunction ) va_create_text_to_speech_signal_source, METH_FASTCALL, va_no_doc },
{ "create_sequencer_signal_source", ( PyCFunction ) va_create_sequencer_signal_source, METH_FASTCALL, va_no_doc },
{ "create_network_stream_signal_source", ( PyCFunction ) va_create_network_stream_signal_source, METH_FASTCALL, va_no_doc },
{ "create_engine_signal_source", ( PyCFunction ) va_create_engine_signal_source, METH_FASTCALL, va_no_doc },
{ "create_machine_signal_source", ( PyCFunction ) va_create_machine_signal_source, METH_FASTCALL, va_no_doc },
{ "delete_signal_source", ( PyCFunction ) va_delete_signal_source, METH_FASTCALL, va_no_doc },
{ "get_signal_source_info", ( PyCFunction ) va_get_signal_source_info, METH_FASTCALL, va_no_doc },
{ "get_signal_source_infos", ( PyCFunction ) va_get_signal_source_infos, METH_FASTCALL, va_no_doc },
{ "get_machine_signal_source_state_str", ( PyCFunction ) va_get_machine_signal_source_state_str, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_speed", ( PyCFunction ) va_set_machine_signal_source_speed, METH_FASTCALL, va_no_doc },
{ "get_machine_signal_source_speed", ( PyCFunction ) va_get_machine_signal_source_speed, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_start_file", ( PyCFunction ) va_set_machine_signal_source_start_file, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_idle_file", ( PyCFunction ) va_set_machine_signal_source_idle_file, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_stop_file", ( PyCFunction ) va_set_machine_signal_source_stop_file, METH_FASTCALL, va_no_doc },
{ "set_signal_source_parameters", ( PyCFunction ) va_set_signal_source_parameters, METH_FASTCALL, va_no_doc },
{ "get_signal_source_parameters", ( PyCFunction ) va_get_signal_source_parameters, METH_FASTCALL, va_no_doc },
{ "is_scene_locked", ( PyCFunction ) va_is_scene_locked, METH_FASTCALL, va_no_doc },
{ "lock_scene", ( PyCFunction ) va_lock_scene, METH_FASTCALL, va_no_doc },
......
......@@ -692,7 +692,6 @@ static PyObject* va_get_sound_source_parameters( PyObject*, PyObject** ppArgs, P
VAPY_CATCH_RETURN;
};
static PyObject* va_get_sound_source_directivity( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
......@@ -1468,18 +1467,209 @@ static PyObject* va_delete_signal_source( PyObject*, PyObject** ppArgs, Py_ssize
VAPY_CATCH_RETURN;
};
/*
{ "get_signal_source_info", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_signal_source_infos", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_machine_signal_source_state_str", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_speed", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_machine_signal_source_speed", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_source_start_file", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_idle_start_file", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_machine_signal_stop_start_file", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "add_sound_playback", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "remove_sound_playback", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "set_signal_source_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
{ "get_signal_source_parameters", ( PyCFunction ) va_not_implemented, METH_FASTCALL, va_no_doc },
static PyObject* va_get_signal_source_info( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", NULL };
static _PyArg_Parser _parser = { "s:get_signal_source_info", _keywords, 0 };
char* pcSignalSource = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
CVASignalSourceInfo oInfo = g_pVANetClient->GetCoreInstance()->GetSignalSourceInfo( sSignalSource );
PyObject* pInfo = Py_BuildValue( "{s:s,s:s,s:s,s:s,s:i,s:s}",
"id", SaveStringToUnicodeConversion( oInfo.sID ).c_str(),
"name", SaveStringToUnicodeConversion( oInfo.sName ).c_str(),
"state", SaveStringToUnicodeConversion( oInfo.sState ).c_str(),
"type", SaveStringToUnicodeConversion( oInfo.sType ).c_str(),
"references", oInfo.iReferences,
"description", SaveStringToUnicodeConversion( oInfo.sDesc ).c_str() );
return pInfo;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_signal_source_infos( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
std::vector< CVASignalSourceInfo > voInfos;
g_pVANetClient->GetCoreInstance()->GetSignalSourceInfos( voInfos );
PyObject* pInfoList = PyList_New( voInfos.size() );
for( size_t i = 0; i < voInfos.size(); i++ )
{
CVASignalSourceInfo& oInfo( voInfos[ i ] );
PyObject* pInfo = Py_BuildValue( "{s:s,s:s,s:s,s:s,s:i,s:s}",
"id", SaveStringToUnicodeConversion(oInfo.sID).c_str(),
"name", SaveStringToUnicodeConversion( oInfo.sName ).c_str(),
"state", SaveStringToUnicodeConversion( oInfo.sState ).c_str(),
"type", SaveStringToUnicodeConversion( oInfo.sType ).c_str(),
"references", oInfo.iReferences,
"description", SaveStringToUnicodeConversion( oInfo.sDesc ).c_str() );
PyList_SetItem( pInfoList, i, pInfo ); // steals reference
}
return pInfoList;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_machine_signal_source_state_str( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", NULL };
static _PyArg_Parser _parser = { "s:get_machine_signal_source_state_str", _keywords, 0 };
char* pcSignalSource = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
std::string sState = g_pVANetClient->GetCoreInstance()->GetMachineSignalSourceStateStr( sSignalSource );
return PyUnicode_FromString( SaveStringToUnicodeConversion( sState ).c_str() );
VAPY_CATCH_RETURN;
};
static PyObject* va_set_machine_signal_source_speed( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", "speed", NULL };
static _PyArg_Parser _parser = { "sd:set_machine_signal_source_speed", _keywords, 0 };
char* pcSignalSource = nullptr;
double dSpeed;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource, &dSpeed ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
g_pVANetClient->GetCoreInstance()->SetMachineSignalSourceSpeed( sSignalSource, dSpeed );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_machine_signal_source_speed( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", NULL };
static _PyArg_Parser _parser = { "s:get_machine_signal_source_speed", _keywords, 0 };
char* pcSignalSource = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
double dSpeed = g_pVANetClient->GetCoreInstance()->GetMachineSignalSourceSpeed( sSignalSource );
return PyFloat_FromDouble( dSpeed );
*/
\ No newline at end of file
VAPY_CATCH_RETURN;
};
static PyObject* va_set_machine_signal_source_start_file( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", "filepath", NULL };
static _PyArg_Parser _parser = { "ss:set_machine_signal_source_start_file", _keywords, 0 };
char* pcSignalSource = nullptr;
char* pcPath = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource, &pcPath ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
std::string sPath = pcPath ? std::string( pcPath ) : "";
g_pVANetClient->GetCoreInstance()->SetMachineSignalSourceStartFile( sSignalSource, sPath );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_machine_signal_source_idle_file( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", "filepath", NULL };
static _PyArg_Parser _parser = { "ss:set_machine_signal_source_idle_file", _keywords, 0 };
char* pcSignalSource = nullptr;
char* pcPath = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource, &pcPath ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
std::string sPath = pcPath ? std::string( pcPath ) : "";
g_pVANetClient->GetCoreInstance()->SetMachineSignalSourceIdleFile( sSignalSource, sPath );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_machine_signal_source_stop_file( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", "filepath", NULL };
static _PyArg_Parser _parser = { "ss:set_machine_signal_source_stop_file", _keywords, 0 };
char* pcSignalSource = nullptr;
char* pcPath = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource, &pcPath ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
std::string sPath = pcPath ? std::string( pcPath ) : "";
g_pVANetClient->GetCoreInstance()->SetMachineSignalSourceStopFile( sSignalSource, sPath );
return Py_None;
VAPY_CATCH_RETURN;
};
static PyObject* va_get_signal_source_parameters( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs, PyObject* pKeywordNames )
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "signalsource", "parameters", NULL };
static _PyArg_Parser _parser = { "iO!:get_signal_source_parameters", _keywords, 0 };
char* pcSignalSource = nullptr;
PyObject* pParameters = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource, &pParameters ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
CVAStruct oParameters = ConvertPythonDictToVAStruct( pParameters );
CVAStruct oReturn = g_pVANetClient->GetCoreInstance()->GetSignalSourceParameters( sSignalSource, oParameters );
return ConvertVAStructToPythonDict( oReturn );;
VAPY_CATCH_RETURN;
};
static PyObject* va_set_signal_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!:set_signal_source_parameters", _keywords, 0 };
char* pcSignalSource = nullptr;
PyObject* pParameters = nullptr;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &pcSignalSource, &pParameters ) )
return NULL;
std::string sSignalSource = pcSignalSource ? std::string( pcSignalSource ) : "";
CVAStruct oParameters = ConvertPythonDictToVAStruct( pParameters );
g_pVANetClient->GetCoreInstance()->SetSignalSourceParameters( sSignalSource, oParameters );
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