Progress on va controller notebook

parent 62889b54
......@@ -161,7 +161,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Macros\n",
"### Macros\n",
"\n",
"Macros can be defined to make your life easier. Don't mess around with file pathes too much, use macros. Don't rename output file names for recording and other exported information, use macros. You can test your macros using th method `substitute_macro` (see below), but you don't have to do it yourself. VA will always substitute macros where possible."
]
......@@ -195,7 +195,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Reset\n",
"### Reset\n",
"Use `reset` to reset the entire scene."
]
},
......@@ -228,6 +228,95 @@
"reset_button.on_click( on_reset_button_clicked )\n",
"display( reset_button )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Modules\n",
"You can interact with modules using a magic struct. In Python, this struct is represented by a (nested) dictionary, that is translated to a VAStruct. This struct can be used to call modules and receiver information on return. It is used to change any setting in a given module. This way, interfaces sta untouched but developers have all the possibilities required to try out new prototype functions."
]
},
{
"cell_type": "code",
"execution_count": 88,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1d339c748fd44c82ab9b8d5f4a31610c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"A Jupyter Widget"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Calling VACore\n",
"Calling BinauralFreeField:MyBinauralFreeField\n",
"Module returned an exception, could not get help\n"
]
}
],
"source": [
"allmods = va.enumerate_modules()\n",
"\n",
"modnames = list()\n",
"for mod in allmods[:] :\n",
" modnames.append( mod[\"name\"] )\n",
"mods_dropdown_menu = widgets.Dropdown( options=modnames )\n",
"\n",
"mod_call_button = widgets.Button( description = 'Call' )\n",
"mod_widget_box = widgets.HBox( [ mods_dropdown_menu, mod_call_button ] )\n",
"\n",
"def on_mod_call( b ) :\n",
" mod = allmods[ mods_dropdown_menu.index ]\n",
" print( 'Calling ' + mod[\"name\"] )\n",
" modnames.append( mod[\"name\"] )\n",
" try :\n",
" va.call_module( mod[\"name\"], { 'help': True } )\n",
" except :\n",
" print( 'Module returned an exception, could not get help' )\n",
" \n",
"mod_call_button.on_click( on_mod_call )\n",
"\n",
"display( mod_widget_box )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Rendering modules\n",
"Rendering modules are special modules and can also be called using the getter and setter methods `get_renderer_parameters` and `set_renderer_parameters`. They usually work like this: use the getter with an empty struct and receive every possible setting with its current value. Change the value or the returned struct and use the setter to modify the corresponding values in the renderinig module:"
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[{'enabled': 1, 'class': 'BinauralFreeField', 'description': ''}]\n"
]
}
],
"source": [
"allrmods = va.get_rendering_modules()\n",
"print( allrmods )\n",
"# todo implement in VAPy"
]
}
],
"metadata": {
......
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