Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
VAPython
Commits
279ec824
Commit
279ec824
authored
Aug 24, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Adding renderer and reproduction module methods
parent
78cc75e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/vasingleton.cpp
View file @
279ec824
...
...
@@ -117,17 +117,17 @@ static struct PyMethodDef va_methods[] =
{
"get_portal_state"
,
(
PyCFunction
)
va_get_portal_state
,
METH_FASTCALL
,
va_no_doc
},
{
"set_portal_state"
,
(
PyCFunction
)
va_set_portal_state
,
METH_FASTCALL
,
va_no_doc
},
{
"get_rendering_modules"
,
(
PyCFunction
)
va_
not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"set_rendering_module_muted"
,
(
PyCFunction
)
va_
not_implemen
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"is_rendering_module_muted"
,
(
PyCFunction
)
va_
not_implemen
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"set_rendering_module_gain"
,
(
PyCFunction
)
va_
not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"get_rendering_module_gain"
,
(
PyCFunction
)
va_
not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"get_reprodu
c
tion_modules"
,
(
PyCFunction
)
va_
not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"set_reprodu
c
tion_module_muted"
,
(
PyCFunction
)
va_
not_implemen
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"is_reprodu
c
tion_module_muted"
,
(
PyCFunction
)
va_
not_implemen
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"set_reprodu
c
tion_module_gain"
,
(
PyCFunction
)
va_
not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"get_reprodu
c
tion_module_gain"
,
(
PyCFunction
)
va_
not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"get_rendering_modules"
,
(
PyCFunction
)
va_
get_rendering_modules
,
METH_FASTCALL
,
va_no_doc
},
{
"set_rendering_module_muted"
,
(
PyCFunction
)
va_
set_rendering_module_mu
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"is_rendering_module_muted"
,
(
PyCFunction
)
va_
is_rendering_module_mu
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"set_rendering_module_gain"
,
(
PyCFunction
)
va_
set_rendering_module_gain
,
METH_FASTCALL
,
va_no_doc
},
{
"get_rendering_module_gain"
,
(
PyCFunction
)
va_
get_rendering_module_gain
,
METH_FASTCALL
,
va_no_doc
},
{
"get_reprodution_modules"
,
(
PyCFunction
)
va_
get_reproduction_modules
,
METH_FASTCALL
,
va_no_doc
},
{
"set_reprodution_module_muted"
,
(
PyCFunction
)
va_
set_reproduction_module_mu
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"is_reprodution_module_muted"
,
(
PyCFunction
)
va_
is_reproduction_module_mu
ted
,
METH_FASTCALL
,
va_no_doc
},
{
"set_reprodution_module_gain"
,
(
PyCFunction
)
va_
set_reproduction_module_gain
,
METH_FASTCALL
,
va_no_doc
},
{
"get_reprodution_module_gain"
,
(
PyCFunction
)
va_
get_reproduction_module_gain
,
METH_FASTCALL
,
va_no_doc
},
{
"get_input_gain"
,
(
PyCFunction
)
va_not_implemented
,
METH_FASTCALL
,
va_no_doc
},
{
"set_input_gain"
,
(
PyCFunction
)
va_not_implemented
,
METH_FASTCALL
,
va_no_doc
},
...
...
src/vasingletonmethods.hpp
View file @
279ec824
...
...
@@ -228,7 +228,7 @@ static PyObject* va_enumerate_modules( PyObject*, PyObject* )
for
(
size_t
i
=
0
;
i
<
voModuleInfos
.
size
();
i
++
)
{
CVAModuleInfo
&
oModule
(
voModuleInfos
[
i
]
);
PyObject
*
pModuleInfo
=
Py_BuildValue
(
"{s:i,s:s,s:s}"
,
"index"
,
i
,
"name"
,
oModule
.
sName
.
c_str
(),
"description"
,
oModule
.
sDesc
.
c_str
()
);
PyObject
*
pModuleInfo
=
Py_BuildValue
(
"{s:i,s:s,s:s}"
,
"index"
,
i
,
"name"
,
SaveStringToUnicodeConversion
(
oModule
.
sName
)
.
c_str
(),
"description"
,
SaveStringToUnicodeConversion
(
oModule
.
sDesc
)
.
c_str
()
);
PyList_SetItem
(
pModuleList
,
i
,
pModuleInfo
);
// steals reference
}
...
...
@@ -1790,3 +1790,189 @@ static PyObject* va_set_portal_state( PyObject*, PyObject** ppArgs, Py_ssize_t n
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_get_rendering_modules
(
PyObject
*
,
PyObject
*
)
{
VAPY_REQUIRE_CONN_TRY
;
std
::
vector
<
CVAAudioRendererInfo
>
voInfos
;
g_pVANetClient
->
GetCoreInstance
()
->
GetRenderingModules
(
voInfos
);
PyObject
*
pList
=
PyList_New
(
voInfos
.
size
()
);
for
(
size_t
i
=
0
;
i
<
voInfos
.
size
();
i
++
)
{
CVAAudioRendererInfo
&
oInfo
(
voInfos
[
i
]
);
PyObject
*
pInfo
=
Py_BuildValue
(
"{s:b,s:s,s:s}"
,
"enabled"
,
oInfo
.
bEnabled
,
"class"
,
SaveStringToUnicodeConversion
(
oInfo
.
sClass
).
c_str
(),
"description"
,
SaveStringToUnicodeConversion
(
oInfo
.
sDescription
).
c_str
(),
"id"
,
SaveStringToUnicodeConversion
(
oInfo
.
sID
).
c_str
());
PyList_SetItem
(
pList
,
i
,
pInfo
);
// steals reference
}
return
pList
;
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_get_rendering_module_gain
(
PyObject
*
,
PyObject
**
ppArgs
,
Py_ssize_t
nArgs
,
PyObject
*
pKeywordNames
)
{
VAPY_REQUIRE_CONN_TRY
;
static
const
char
*
const
_keywords
[]
=
{
"id"
,
NULL
};
static
_PyArg_Parser
_parser
=
{
"s:get_rendering_module_gain"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
return
PyFloat_FromDouble
(
g_pVANetClient
->
GetCoreInstance
()
->
GetRenderingModuleGain
(
sID
)
);
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_set_rendering_module_gain
(
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
=
{
"sd:set_rendering_module_gain"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
double
dGain
=
-
1
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
,
&
dGain
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
g_pVANetClient
->
GetCoreInstance
()
->
SetRenderingModuleGain
(
sID
,
dGain
);
return
Py_None
;
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_set_rendering_module_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_rendering_module_muted"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
bool
bMuted
=
true
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
,
&
bMuted
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
g_pVANetClient
->
GetCoreInstance
()
->
SetRenderingModuleMuted
(
sID
,
bMuted
);
return
Py_None
;
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_is_rendering_module_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
=
{
"s:is_rendering_module_muted"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
return
PyBool_FromLong
(
g_pVANetClient
->
GetCoreInstance
()
->
IsRenderingModuleMuted
(
sID
)
);
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_get_reproduction_modules
(
PyObject
*
,
PyObject
*
)
{
VAPY_REQUIRE_CONN_TRY
;
std
::
vector
<
CVAAudioReproductionInfo
>
voInfos
;
g_pVANetClient
->
GetCoreInstance
()
->
GetReproductionModules
(
voInfos
);
PyObject
*
pList
=
PyList_New
(
voInfos
.
size
()
);
for
(
size_t
i
=
0
;
i
<
voInfos
.
size
();
i
++
)
{
CVAAudioReproductionInfo
&
oInfo
(
voInfos
[
i
]
);
PyObject
*
pInfo
=
Py_BuildValue
(
"{s:b,s:s,s:s}"
,
"enabled"
,
oInfo
.
bEnabled
,
"class"
,
SaveStringToUnicodeConversion
(
oInfo
.
sClass
).
c_str
(),
"description"
,
SaveStringToUnicodeConversion
(
oInfo
.
sDescription
).
c_str
(),
"id"
,
SaveStringToUnicodeConversion
(
oInfo
.
sID
).
c_str
()
);
PyList_SetItem
(
pList
,
i
,
pInfo
);
// steals reference
}
return
pList
;
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_get_reproduction_module_gain
(
PyObject
*
,
PyObject
**
ppArgs
,
Py_ssize_t
nArgs
,
PyObject
*
pKeywordNames
)
{
VAPY_REQUIRE_CONN_TRY
;
static
const
char
*
const
_keywords
[]
=
{
"id"
,
NULL
};
static
_PyArg_Parser
_parser
=
{
"s:get_reproduction_module_gain"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
return
PyFloat_FromDouble
(
g_pVANetClient
->
GetCoreInstance
()
->
GetReproductionModuleGain
(
sID
)
);
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_set_reproduction_module_gain
(
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
=
{
"sd:set_reproduction_module_gain"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
double
dGain
=
-
1
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
,
&
dGain
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
g_pVANetClient
->
GetCoreInstance
()
->
SetReproductionModuleGain
(
sID
,
dGain
);
return
Py_None
;
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_set_reproduction_module_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_reproduction_module_muted"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
bool
bMuted
=
true
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
,
&
bMuted
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
g_pVANetClient
->
GetCoreInstance
()
->
SetReproductionModuleMuted
(
sID
,
bMuted
);
return
Py_None
;
VAPY_CATCH_RETURN
;
};
static
PyObject
*
va_is_reproduction_module_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
=
{
"s:is_reproduction_module_muted"
,
_keywords
,
0
};
char
*
pcID
=
nullptr
;
if
(
!
_PyArg_ParseStack
(
ppArgs
,
nArgs
,
pKeywordNames
,
&
_parser
,
&
pcID
)
)
return
NULL
;
std
::
string
sID
=
pcID
?
std
::
string
(
pcID
)
:
""
;
return
PyBool_FromLong
(
g_pVANetClient
->
GetCoreInstance
()
->
IsReproductionModuleMuted
(
sID
)
);
VAPY_CATCH_RETURN
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment