progress, not compile clean

parent fdbb39f6
......@@ -17,9 +17,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Successfully connected, server core version is: VACore v2017.d (debug)\n"
]
}
],
"source": [
"import sys\n",
"sys.path.append( '../../Lib/site-packages' )\n",
......@@ -27,7 +35,9 @@
"import ipywidgets as widgets\n",
"import va\n",
"if not va.connect() :\n",
" raise 'Could not connect to local VA server'"
" raise 'Could not connect to local VA server'\n",
"else :\n",
" print( 'Successfully connected, server core version is: ' + va.get_version() )"
]
},
{
......@@ -54,9 +64,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "057eb3bfb4fc4828a5db5914ab4d00ae",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"A Jupyter Widget"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"mute_output_button = widgets.ToggleButton( description = 'Output muted', value = va.get_output_muted() )\n",
"\n",
......@@ -78,9 +103,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b03c42298f59475083c9dfe7012f1c1c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"A Jupyter Widget"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output_gain_slider = widgets.FloatSlider( \n",
" value = va.get_output_gain(),\n",
......@@ -103,14 +143,28 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Global auralization mode"
"#### Global auralization mode\n",
"\n",
"The auralization mode is a bundle of flags to control the acoustic phenomena that should be considered during audio rendering. It's purpose is to demonstrate the audibility of certain aspects, like sound source directivity.\n",
"Auralization mode can be set globally, but also individually for rendering modules, sources and receivers."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'Direct sound, early reflections, diffuse decay, source directivity, air absorption, atmospheric temporal variations, scattering, diffraction, near-field effects, doppler shifts, spherical spreading loss, transmission, absorption'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"global_am = va.get_global_auralization_mode()\n",
"va.get_auralization_mode_str( global_am )"
......@@ -127,9 +181,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"$(DefaultHRIR): HRIR\\\\ITA-Kunstkopf_HRIR_AP11_Pressure_Equalized_3x3_256.v17.ir.daff\n",
"$(ProjectName): MyVirtualAcousticsProject\n",
"$(data): $(data)\n",
"$(big_data_dir): C:\\\\data\n",
"$(conf): $(conf)\n"
]
}
],
"source": [
"print( '$(DefaultHRIR): ' + va.substitute_macro( '$(DefaultHRIR)' ) )\n",
"print( '$(ProjectName): ' + va.substitute_macro( '$(ProjectName)' ) )\n",
......@@ -138,6 +204,38 @@
"print( '$(conf): ' + va.substitute_macro( '$(conf)' ) )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Paths\n",
"\n",
"Using search path is encouraged, as it makes it easier to move from one PC to another. You can get the available search paths and also add new search paths. Paths are always bound to the server PC."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'path_0': 'C:/data', 'path_1': 'C:/dev/VA/VACore/conf', 'path_2': 'C:/dev/VA/VACore/data', 'path_3': 'C:/data/InsideSceneData', 'path_4': 'C:\\\\dev\\\\VA\\\\VAPython\\\\examples\\\\jupyter'}\n",
"client working directory: C:\\dev\\VA\\VAPython\\examples\\jupyter\n"
]
}
],
"source": [
"print( va.get_search_paths() )\n",
"\n",
"import os\n",
"current_working_dir = os.getcwd()\n",
"print( \"client working directory: \" + current_working_dir )\n",
"va.add_search_path( current_working_dir ); # only makes sense if client and server are running on same PC"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -148,9 +246,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6899a1855f3a497b8bc73393cb56aca1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"A Jupyter Widget"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"reset_button = widgets.Button( description = 'Reset VA server' )\n",
"\n",
......@@ -171,9 +284,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8127aca5a12c42f1ae547a52226c2f0d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"A Jupyter Widget"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Calling BinauralFreeField:MyBinauralFreeField\n",
"Module returned an exception, could not get help\n"
]
}
],
"source": [
"allmods = va.get_modules()\n",
"\n",
......@@ -209,19 +345,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'enabled': 1, 'class': 'BinauralFreeField', 'description': '', 'id': 'MyBinauralFreeField'}\n",
"MyBinauralFreeField\n",
"Could not get rendering module parameters\n"
]
}
],
"source": [
"allrmods = va.get_rendering_modules()\n",
"for rmod in allrmods :\n",
" print( rmod )\n",
" rmod_id = str( rmod[ 'class' ] + ':' + rmod[ 'name' ] )\n",
" try :\n",
" magic_return = va.call_module( rmod_id, { 'help': True } )\n",
" print( rmod[\"id\"] )\n",
" magic_return = va.get_renderer_parameters( rmod[\"id\"], {} )\n",
" print( magic_return )\n",
" except:\n",
" print( 'Module call failed, could not get help' )\n",
" print( 'Could not get rendering module parameters' )\n",
"\n",
"# todo implement in VAPy"
]
......
......@@ -15,8 +15,11 @@ static struct PyMethodDef va_methods[] =
{ "is_connected", ( PyCFunction ) is_connected, METH_FASTCALL, no_doc },
{ "reset", ( PyCFunction ) reset, METH_FASTCALL, no_doc },
{ "get_version", ( PyCFunction ) get_version, METH_FASTCALL, no_doc },
{ "get_modules", ( PyCFunction ) get_modules, METH_FASTCALL, no_doc },
{ "call_module", ( PyCFunction ) call_module, METH_FASTCALL, no_doc },
{ "get_search_paths", ( PyCFunction ) get_search_paths, METH_FASTCALL, no_doc },
{ "add_search_path", ( PyCFunction ) add_search_path, METH_FASTCALL, no_doc },
{ "create_directivity_from_file", ( PyCFunction ) create_directivity_from_file, METH_FASTCALL, no_doc },
......@@ -117,7 +120,7 @@ static struct PyMethodDef va_methods[] =
{ "get_homogeneous_medium_temperature", ( PyCFunction ) get_homogeneous_medium_temperature, METH_FASTCALL, no_doc },
{ "set_homogeneous_medium_temperature", ( PyCFunction ) set_homogeneous_medium_temperature, METH_FASTCALL, no_doc },
{ "get_homogeneous_medium_static_pressure", ( PyCFunction ) get_homogeneous_medium_static_pressure, METH_FASTCALL, no_doc },
{ "get_homogeneous_medium_static_pressure", ( PyCFunction ) get_homogeneous_medium_static_pressure, METH_FASTCALL, no_doc },
{ "set_homogeneous_medium_static_pressure", ( PyCFunction ) set_homogeneous_medium_static_pressure, METH_FASTCALL, no_doc },
{ "get_homogeneous_medium_relative_humidity", ( PyCFunction ) get_homogeneous_medium_relative_humidity, METH_FASTCALL, no_doc },
{ "set_homogeneous_medium_relative_humidity", ( PyCFunction ) set_homogeneous_medium_relative_humidity, METH_FASTCALL, no_doc },
{ "get_homogeneous_medium_shift_speed", ( PyCFunction ) get_homogeneous_medium_shift_speed, METH_FASTCALL, no_doc },
......@@ -130,12 +133,18 @@ static struct PyMethodDef va_methods[] =
{ "get_rendering_module_muted", ( PyCFunction ) get_rendering_module_muted, METH_FASTCALL, no_doc },
{ "set_rendering_module_gain", ( PyCFunction ) set_rendering_module_gain, METH_FASTCALL, no_doc },
{ "get_rendering_module_gain", ( PyCFunction ) get_rendering_module_gain, METH_FASTCALL, no_doc },
{ "get_rendering_module_auralization_mode", ( PyCFunction ) get_rendering_module_auralization_mode, METH_FASTCALL, no_doc },
{ "set_rendering_module_auralization_mode", ( PyCFunction ) set_rendering_module_auralization_mode, METH_FASTCALL, no_doc },
{ "get_rendering_module_parameters", ( PyCFunction ) get_rendering_module_parameters, METH_FASTCALL, no_doc },
{ "set_rendering_module_parameters", ( PyCFunction ) set_rendering_module_parameters, METH_FASTCALL, no_doc },
{ "get_reprodution_modules", ( PyCFunction ) get_reproduction_modules, METH_FASTCALL, no_doc },
{ "set_reprodution_module_muted", ( PyCFunction ) set_reproduction_module_muted, METH_FASTCALL, no_doc },
{ "get_reprodution_module_muted", ( PyCFunction ) get_reproduction_module_muted, METH_FASTCALL, no_doc },
{ "set_reprodution_module_gain", ( PyCFunction ) set_reproduction_module_gain, METH_FASTCALL, no_doc },
{ "get_reprodution_module_gain", ( PyCFunction ) get_reproduction_module_gain, METH_FASTCALL, no_doc },
{ "get_reproduction_module_parameters", ( PyCFunction ) get_reproduction_module_parameters, METH_FASTCALL, no_doc },
{ "set_reproduction_parameters", ( PyCFunction ) set_reproduction_module_parameters, METH_FASTCALL, no_doc },
{ "lock_update", ( PyCFunction ) lock_update, METH_FASTCALL, no_doc },
......@@ -158,8 +167,10 @@ static struct PyMethodDef va_methods[] =
{ "set_active_sound_receiver_explicit_renderer", ( PyCFunction ) set_active_sound_receiver_explicit_renderer, METH_FASTCALL, no_doc },
{ "get_core_clock", ( PyCFunction ) get_core_clock, METH_FASTCALL, no_doc },
{ "set_core_clock", ( PyCFunction ) set_core_clock, METH_FASTCALL, no_doc },
{ "substitute_macro", ( PyCFunction ) substitute_macro, METH_FASTCALL, no_doc },
{ "find_file_path", ( PyCFunction ) find_file_path, METH_FASTCALL, no_doc },
{ "get_core_configuration", ( PyCFunction ) get_core_configuration, METH_FASTCALL, no_doc },
{ "get_hardware_configuration", ( PyCFunction ) get_hardware_configuration, METH_FASTCALL, no_doc },
{ "get_file_list", ( PyCFunction ) get_file_list, METH_FASTCALL, no_doc },
......
......@@ -236,6 +236,15 @@ static PyObject* reset( PyObject*, PyObject* )
VAPY_CATCH_RETURN;
};
static PyObject* get_version( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
CVAVersionInfo oInfo;
g_pVANetClient->GetCoreInstance()->GetVersionInfo( &oInfo );
return PyUnicode_FromString( SaveStringToUnicodeConversion( oInfo.ToString() ).c_str() );
VAPY_CATCH_RETURN;
};
static PyObject* get_modules( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
......@@ -293,6 +302,14 @@ static PyObject* add_search_path( PyObject*, PyObject** ppArgs, Py_ssize_t nArgs
VAPY_CATCH_RETURN;
};
static PyObject* get_search_paths( PyObject*, PyObject**, Py_ssize_t, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
CVAStruct oPaths = g_pVANetClient->GetCoreInstance()->GetSearchPaths();
return ConvertVAStructToPythonDict( oPaths );
VAPY_CATCH_RETURN;
};
static PyObject* get_update_locked( PyObject*, PyObject* )
{
VAPY_REQUIRE_CONN_TRY;
......@@ -1910,11 +1927,15 @@ static PyObject* get_rendering_modules( PyObject*, PyObject* )
for( size_t i = 0; i < voInfos.size(); i++ )
{
CVAAudioRendererInfo& oInfo( voInfos[ i ] );
PyObject* pInfo = Py_BuildValue( "{s:b,s:s,s:s, s:s}",
PyObject* pInfo = Py_BuildValue( "{s:b,s:s,s:s,s:s,s:s,s:b,s:b,s:O!}",
"enabled", oInfo.bEnabled,
"class", SaveStringToUnicodeConversion( oInfo.sClass ).c_str(),
"description", SaveStringToUnicodeConversion( oInfo.sDescription ).c_str(),
"id", SaveStringToUnicodeConversion( oInfo.sID ).c_str() );
"id", SaveStringToUnicodeConversion( oInfo.sID ).c_str(),
"output_recording_file_path", SaveStringToUnicodeConversion( oInfo.sOutputRecordingFilePath ).c_str(),
"output_detector_enabled", oInfo.bOutputDetectorEnabled,
"output_recording_enabled", oInfo.bOutputRecordingEnabled,
"parameters", ConvertVAStructToPythonDict( oInfo.oParams ) );
PyList_SetItem( pList, i, pInfo ); // steals reference
}
......@@ -2390,13 +2411,14 @@ static PyObject* get_auralization_mode_str( PyObject*, PyObject** ppArgs, Py_ssi
{
VAPY_REQUIRE_CONN_TRY;
static const char * const _keywords[] = { "auralization_mode", NULL };
static _PyArg_Parser _parser = { "i:get_auralization_mode_str", _keywords, 0 };
static const char * const _keywords[] = { "auralization_mode", "short_name", NULL };
static _PyArg_Parser _parser = { "i|b:get_auralization_mode_str", _keywords, 0 };
int iAM = -1;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iAM ) )
bool bShort = false;
if( !_PyArg_ParseStack( ppArgs, nArgs, pKeywordNames, &_parser, &iAM, &bShort ) )
return NULL;
std::string sAM = g_pVANetClient->GetCoreInstance()->GetAuralizationModeStr( iAM );
std::string sAM = g_pVANetClient->GetCoreInstance()->GetAuralizationModeStr( iAM, bShort );
return PyUnicode_FromString( SaveStringToUnicodeConversion( sAM ).c_str() );
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