Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
VAMatlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
VAMatlab
Commits
360e6a23
Commit
360e6a23
authored
Dec 11, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
# Conflicts: # matlab/itaVA_build.m.proto
parents
7915bb98
f8700241
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
176 additions
and
78 deletions
+176
-78
matlab/VAMatlabExecutable_debug.m
matlab/VAMatlabExecutable_debug.m
+33
-5
src/VAMatlabExecutable.cpp
src/VAMatlabExecutable.cpp
+143
-73
No files found.
matlab/VAMatlabExecutable_debug.m
View file @
360e6a23
%
t
his debug script is for debugging the VA-to-Matlab connection
%
T
his debug script is for debugging the VA-to-Matlab connection
% without the use of the facade class "itaVA"
% without the use of the facade class "itaVA"
% To use MSVS for debugging the MEX library, in VS select "Debugging >
% To use MSVS for debugging the MEX library, in VS select "Debugging >
% Append to process" ... then select the MATLAB.exe process and start to
% Append to process" ... then select the MATLAB.exe process and start to
% execute commands in Matlab that are calling functions of the MEX file
% execute commands in Matlab that are calling functions of the MEX file
cd
'D:\Users\stienen\VA\VAMatlab\Matlab'
addpath
(
'../../VABuild/Build/Debug_x64'
)
%% Pathes to required libs & dlls (cumbersome, but necessary)
addpath
(
'../../VistaCoreLibs/lib/x64'
)
vam_path
=
'D:\Users\stienen\dev\VA\VAMatlab'
;
addpath
(
'../../3rdParty/NatNetSDK/lib/x64'
)
build_dir
=
'build_win32-x64.vc12'
;
vanet_dir
=
'D:\Users\stienen\dev\VA'
;
vista_dir
=
'D:\Users\stienen\dev\ViSTA'
;
natnet_libs
=
'X:\VR\dev\ExternalLibs\NatNetSDK\NatNetSDK-2.7\lib\x64'
;
addpath
(
fullfile
(
vam_path
,
build_dir
,
'lib'
)
)
% VAMatlabD
addpath
(
fullfile
(
vanet_dir
,
build_dir
,
'lib'
)
)
% VABaseD, VANetD
addpath
(
fullfile
(
vista_dir
,
build_dir
,
'lib'
)
)
% VistaBaseD, VistaAspectsD, VistaInterProcCommD
addpath
(
fullfile
(
natnet_libs
)
)
% NatNetSDK (OptiTrack)
copy_dlls
=
true
;
if
(
copy_dlls
)
% Be careful with this option
dest
=
fullfile
(
vam_path
,
build_dir
,
'lib'
);
copyfile
(
which
(
'VABaseD.dll'
),
dest
)
copyfile
(
which
(
'VANetD.dll'
),
dest
)
copyfile
(
which
(
'VistaBaseD.dll'
),
dest
)
copyfile
(
which
(
'VistaAspectsD.dll'
),
dest
)
copyfile
(
which
(
'VistaInterProcCommD.dll'
),
dest
)
copyfile
(
which
(
'NatNetLib.dll'
),
dest
)
warning
(
'DLLs have been copied, make sure to use the corresponding versions during debugging.'
)
end
%% Connection
conn
=
VAMatlabD
(
'connect'
,
'localhost:12340'
);
conn
=
VAMatlabD
(
'connect'
,
'localhost:12340'
);
renderers
=
VAMatlabD
(
'getRenderingModules'
,
conn
,
false
);
disp
(
renderers
)
reproductions
=
VAMatlabD
(
'getReproductionModules'
,
conn
,
false
);
disp
(
reproductions
)
%% Tests
L
=
VAMatlabD
(
'createListener'
,
conn
,
'itaVA_Tracked_Listener'
,
'default'
,
-
1
);
L
=
VAMatlabD
(
'createListener'
,
conn
,
'itaVA_Tracked_Listener'
,
'default'
,
-
1
);
...
...
src/VAMatlabExecutable.cpp
View file @
360e6a23
...
@@ -116,12 +116,15 @@ ConnectionHandle GenerateConnectionHandle() {
...
@@ -116,12 +116,15 @@ ConnectionHandle GenerateConnectionHandle() {
}
}
// Get connection handle from Matlab arguments and validate it
// Get connection handle from Matlab arguments and validate it
ConnectionHandle
GetConnectionHandle
(
const
mxArray
*
pArray
,
bool
bAllowNullHandle
=
false
)
{
ConnectionHandle
GetConnectionHandle
(
const
mxArray
*
pArray
,
bool
bAllowNullHandle
=
false
)
{
// Strict typing! Make sure that the parameter has a valid type (scalar + handle datatype)
// Strict typing! Make sure that the parameter has a valid type (scalar + handle datatype)
if
(
matlabIsScalar
(
pArray
)
&&
(
mxGetClassID
(
pArray
)
==
CONNECTIONHANDLE_CLASS_ID
))
{
if
(
matlabIsScalar
(
pArray
)
&&
(
mxGetClassID
(
pArray
)
==
CONNECTIONHANDLE_CLASS_ID
)
)
{
ConnectionHandle
hHandle
=
*
((
ConnectionHandle
*
)
mxGetData
(
pArray
));
ConnectionHandle
hHandle
=
*
((
ConnectionHandle
*
)
mxGetData
(
pArray
));
if
((
hHandle
>=
0
)
&&
(
hHandle
<=
VAMATLAB_MAX_CONNECTIONS
))
{
if
(
(
hHandle
>=
0
)
&&
(
hHandle
<=
VAMATLAB_MAX_CONNECTIONS
)
)
if
(
g_vpConnections
[
hHandle
]
||
((
hHandle
==
0
)
&&
bAllowNullHandle
))
{
if
(
g_vpConnections
[
hHandle
]
||
(
(
hHandle
==
0
)
&&
bAllowNullHandle
)
)
return
hHandle
;
return
hHandle
;
}
}
}
}
...
@@ -135,22 +138,25 @@ ConnectionHandle GetConnectionHandle(const mxArray *pArray, bool bAllowNullHandl
...
@@ -135,22 +138,25 @@ ConnectionHandle GetConnectionHandle(const mxArray *pArray, bool bAllowNullHandl
// USED FOR? Convenience baby! This saves some lines of code below ...
// USED FOR? Convenience baby! This saves some lines of code below ...
// NOTE: In this MEX we are always checking for the exact number of arguments
// NOTE: In this MEX we are always checking for the exact number of arguments
// Optional values are predefined in the Matlab facade class
// Optional values are predefined in the Matlab facade class
void
vCheckInputArguments
(
int
nrhs
,
int
iRequiredNumArgs
)
{
void
vCheckInputArguments
(
int
nrhs
,
int
iRequiredNumArgs
)
if
(
nrhs
!=
iRequiredNumArgs
)
{
{
switch
(
iRequiredNumArgs
)
{
if
(
nrhs
!=
iRequiredNumArgs
)
case
0
:
VA_EXCEPT1
(
"This function does not take any arguments"
);
{
case
1
:
VA_EXCEPT1
(
"This function takes exactly one argument"
);
switch
(
iRequiredNumArgs
)
case
2
:
VA_EXCEPT1
(
"This function takes exactly two arguments"
);
{
case
3
:
VA_EXCEPT1
(
"This function takes exactly three arguments"
);
case
0
:
VA_EXCEPT1
(
"This VAMatlab function does not take any arguments"
);
case
4
:
VA_EXCEPT1
(
"This function takes exactly four arguments"
);
case
1
:
VA_EXCEPT1
(
"This VAMatlab function takes exactly one argument"
);
case
5
:
VA_EXCEPT1
(
"This function takes exactly five arguments"
);
case
2
:
VA_EXCEPT1
(
"This VAMatlab function takes exactly two arguments"
);
case
6
:
VA_EXCEPT1
(
"This function takes exactly six arguments"
);
case
3
:
VA_EXCEPT1
(
"This VAMatlab function takes exactly three arguments"
);
case
4
:
VA_EXCEPT1
(
"This VAMatlab function takes exactly four arguments"
);
case
5
:
VA_EXCEPT1
(
"This VAMatlab function takes exactly five arguments"
);
case
6
:
VA_EXCEPT1
(
"This VAMatlab function takes exactly six arguments"
);
// Do we need more?
// Do we need more?
default:
default:
{
{
char
buf
[
64
];
char
buf
[
64
];
sprintf_s
(
buf
,
64
,
"This function takes exactly %d arguments"
,
iRequiredNumArgs
);
sprintf_s
(
buf
,
64
,
"This VAMatlab function takes exactly %d arguments"
,
iRequiredNumArgs
);
VA_EXCEPT1
(
buf
);
VA_EXCEPT1
(
buf
);
}
}
}
}
}
}
...
@@ -3088,83 +3094,116 @@ void setCoreClock(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
...
@@ -3088,83 +3094,116 @@ void setCoreClock(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
* | | *
* | | *
* +----------------------------------------------------------+ */
* +----------------------------------------------------------+ */
REGISTER_PUBLIC_FUNCTION
(
setReproductionModuleGain
,
"Sets the output gain of a reproduction module"
,
""
);
// Rendering
DECLARE_FUNCTION_REQUIRED_INARG
(
setReproductionModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setReproductionModuleGain
,
dGain
,
"double-1x1"
,
"gain (factor)"
);
void
setReproductionModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
REGISTER_PUBLIC_FUNCTION
(
setRenderingModuleGain
,
"Sets the output gain of a reproduction module"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRenderingModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRenderingModuleGain
,
dGain
,
"double-1x1"
,
"gain (factor)"
);
void
setRenderingModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
3
);
REQUIRE_INPUT_ARGS
(
3
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
double
dGain
=
matlabGetRealScalar
(
prhs
[
2
],
"dGain"
);
double
dGain
=
matlabGetRealScalar
(
prhs
[
2
],
"dGain"
);
pConnection
->
pCoreInterface
->
SetRe
production
ModuleGain
(
sID
,
dGain
);
pConnection
->
pCoreInterface
->
SetRe
ndering
ModuleGain
(
sID
,
dGain
);
}
}
REGISTER_PUBLIC_FUNCTION
(
setRe
production
ModuleMuted
,
"Mutes a reproduction module"
,
""
);
REGISTER_PUBLIC_FUNCTION
(
setRe
ndering
ModuleMuted
,
"Mutes a reproduction module"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
production
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
ndering
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
production
ModuleMuted
,
bMuted
,
"logical-1x1"
,
"Mute (true) or unmute (false)"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
ndering
ModuleMuted
,
bMuted
,
"logical-1x1"
,
"Mute (true) or unmute (false)"
);
void
setRe
production
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
void
setRe
ndering
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
3
);
REQUIRE_INPUT_ARGS
(
3
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
bool
bMuted
=
matlabGetBoolScalar
(
prhs
[
2
],
"bMuted"
);
bool
bMuted
=
matlabGetBoolScalar
(
prhs
[
2
],
"bMuted"
);
pConnection
->
pCoreInterface
->
SetRe
production
ModuleMuted
(
sID
,
bMuted
);
pConnection
->
pCoreInterface
->
SetRe
ndering
ModuleMuted
(
sID
,
bMuted
);
}
}
REGISTER_PUBLIC_FUNCTION
(
isRe
production
ModuleMuted
,
"Is reproduction module muted?"
,
""
);
REGISTER_PUBLIC_FUNCTION
(
isRe
ndering
ModuleMuted
,
"Is reproduction module muted?"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
isRe
production
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
isRe
ndering
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_OUTARG
(
isRe
productionModuleMuted
,
bMuted
,
"logical-1x1"
,
"true if muted, false if unmuted"
);
DECLARE_FUNCTION_OUTARG
(
isRe
nderingModuleMuted
,
bMuted
,
"logical-1x1"
,
"true if muted, false if unmuted"
);
void
isRe
production
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
void
isRe
ndering
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
2
);
REQUIRE_INPUT_ARGS
(
2
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
bool
bMuted
=
pConnection
->
pCoreInterface
->
IsRe
production
ModuleMuted
(
sID
);
bool
bMuted
=
pConnection
->
pCoreInterface
->
IsRe
ndering
ModuleMuted
(
sID
);
plhs
[
0
]
=
mxCreateLogicalScalar
(
bMuted
);
plhs
[
0
]
=
mxCreateLogicalScalar
(
bMuted
);
}
}
REGISTER_PUBLIC_FUNCTION
(
getRe
productionModuleGain
,
"Returns the reproduction
module output gain"
,
""
);
REGISTER_PUBLIC_FUNCTION
(
getRe
nderingModuleGain
,
"Get rendering
module output gain"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
getRe
production
ModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
getRe
ndering
ModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_OUTARG
(
getRe
productionModuleGain
,
dGain
,
"double-1x1"
,
"Gain (scalar)"
);
DECLARE_FUNCTION_OUTARG
(
getRe
nderingModuleGain
,
dGain
,
"double-1x1"
,
"Gain (scalar)"
);
void
getRe
production
ModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
void
getRe
ndering
ModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
2
);
REQUIRE_INPUT_ARGS
(
2
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
double
dGain
=
pConnection
->
pCoreInterface
->
GetRe
production
ModuleGain
(
sID
);
double
dGain
=
pConnection
->
pCoreInterface
->
GetRe
ndering
ModuleGain
(
sID
);
plhs
[
0
]
=
mxCreateDoubleScalar
(
dGain
);
plhs
[
0
]
=
mxCreateDoubleScalar
(
dGain
);
}
}
// Rendering
REGISTER_PUBLIC_FUNCTION
(
getRenderingModules
,
"Get list of rendering modules"
,
""
);
DECLARE_FUNCTION_OPTIONAL_INARG
(
getRenderingModules
,
bFilterEnabled
,
"boolean-1x1"
,
"Filter activated (true)"
,
"1"
);
DECLARE_FUNCTION_OUTARG
(
getRenderingModules
,
renderers
,
"cell-array of struct-1x1"
,
"Renderer infos (names, descriptions, etc.)"
);
void
getRenderingModules
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
bool
bFilterEnabled
=
true
;
if
(
nrhs
>
1
)
bFilterEnabled
=
matlabGetBoolScalar
(
prhs
[
1
],
"bFilterEnabled"
);
REGISTER_PUBLIC_FUNCTION
(
setRenderingModuleGain
,
"Sets the output gain of a reproduction module"
,
""
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRenderingModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
DECLARE_FUNCTION_REQUIRED_INARG
(
setRenderingModuleGain
,
dGain
,
"double-1x1"
,
"gain (factor)"
);
void
setRenderingModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
std
::
vector
<
CVAAudioRendererInfo
>
voRenderers
;
pConnection
->
pCoreInterface
->
GetRenderingModules
(
voRenderers
,
bFilterEnabled
);
const
size_t
nDims
=
int
(
voRenderers
.
size
()
);
const
int
nFields
=
4
;
const
char
*
ppszFieldNames
[]
=
{
"id"
,
"class"
,
"enabled"
,
"desc"
};
plhs
[
0
]
=
mxCreateStructArray
(
1
,
&
nDims
,
nFields
,
ppszFieldNames
);
for
(
size_t
i
=
0
;
i
<
nDims
;
i
++
)
{
size_t
j
=
0
;
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateString
(
voRenderers
[
i
].
sID
.
c_str
()
)
);
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateString
(
voRenderers
[
i
].
sClass
.
c_str
()
)
);
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateLogicalScalar
(
voRenderers
[
i
].
bEnabled
)
);
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateString
(
voRenderers
[
i
].
sDescription
.
c_str
()
)
);
}
}
// Reproduction
REGISTER_PUBLIC_FUNCTION
(
setReproductionModuleGain
,
"Sets the output gain of a reproduction module"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setReproductionModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setReproductionModuleGain
,
dGain
,
"double-1x1"
,
"gain (factor)"
);
void
setReproductionModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
3
);
REQUIRE_INPUT_ARGS
(
3
);
...
@@ -3175,14 +3214,14 @@ void setRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray
...
@@ -3175,14 +3214,14 @@ void setRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
double
dGain
=
matlabGetRealScalar
(
prhs
[
2
],
"dGain"
);
double
dGain
=
matlabGetRealScalar
(
prhs
[
2
],
"dGain"
);
pConnection
->
pCoreInterface
->
SetRe
ndering
ModuleGain
(
sID
,
dGain
);
pConnection
->
pCoreInterface
->
SetRe
production
ModuleGain
(
sID
,
dGain
);
}
}
REGISTER_PUBLIC_FUNCTION
(
setRe
ndering
ModuleMuted
,
"Mutes a reproduction module"
,
""
);
REGISTER_PUBLIC_FUNCTION
(
setRe
production
ModuleMuted
,
"Mutes a reproduction module"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
ndering
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
production
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
ndering
ModuleMuted
,
bMuted
,
"logical-1x1"
,
"Mute (true) or unmute (false)"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
setRe
production
ModuleMuted
,
bMuted
,
"logical-1x1"
,
"Mute (true) or unmute (false)"
);
void
setRe
ndering
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
void
setRe
production
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
3
);
REQUIRE_INPUT_ARGS
(
3
);
...
@@ -3192,14 +3231,14 @@ void setRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray
...
@@ -3192,14 +3231,14 @@ void setRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
bool
bMuted
=
matlabGetBoolScalar
(
prhs
[
2
],
"bMuted"
);
bool
bMuted
=
matlabGetBoolScalar
(
prhs
[
2
],
"bMuted"
);
pConnection
->
pCoreInterface
->
SetRe
ndering
ModuleMuted
(
sID
,
bMuted
);
pConnection
->
pCoreInterface
->
SetRe
production
ModuleMuted
(
sID
,
bMuted
);
}
}
REGISTER_PUBLIC_FUNCTION
(
isRe
ndering
ModuleMuted
,
"Is reproduction module muted?"
,
""
);
REGISTER_PUBLIC_FUNCTION
(
isRe
production
ModuleMuted
,
"Is reproduction module muted?"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
isRe
ndering
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
isRe
production
ModuleMuted
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_OUTARG
(
isRe
ndering
ModuleMuted
,
bMuted
,
"logical-1x1"
,
"true if muted, false if unmuted"
);
DECLARE_FUNCTION_OUTARG
(
isRe
production
ModuleMuted
,
bMuted
,
"logical-1x1"
,
"true if muted, false if unmuted"
);
void
isRe
ndering
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
void
isRe
production
ModuleMuted
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
2
);
REQUIRE_INPUT_ARGS
(
2
);
...
@@ -3207,16 +3246,16 @@ void isRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray
...
@@ -3207,16 +3246,16 @@ void isRenderingModuleMuted( int nlhs, mxArray *plhs[], int nrhs, const mxArray
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
bool
bMuted
=
pConnection
->
pCoreInterface
->
IsRe
ndering
ModuleMuted
(
sID
);
bool
bMuted
=
pConnection
->
pCoreInterface
->
IsRe
production
ModuleMuted
(
sID
);
plhs
[
0
]
=
mxCreateLogicalScalar
(
bMuted
);
plhs
[
0
]
=
mxCreateLogicalScalar
(
bMuted
);
}
}
REGISTER_PUBLIC_FUNCTION
(
getRe
nderingModuleGain
,
"Get rendering
module output gain"
,
""
);
REGISTER_PUBLIC_FUNCTION
(
getRe
productionModuleGain
,
"Returns the reproduction
module output gain"
,
""
);
DECLARE_FUNCTION_REQUIRED_INARG
(
getRe
ndering
ModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_REQUIRED_INARG
(
getRe
production
ModuleGain
,
sModuleID
,
"string"
,
"Module identifier"
);
DECLARE_FUNCTION_OUTARG
(
getRe
ndering
ModuleGain
,
dGain
,
"double-1x1"
,
"Gain (scalar)"
);
DECLARE_FUNCTION_OUTARG
(
getRe
production
ModuleGain
,
dGain
,
"double-1x1"
,
"Gain (scalar)"
);
void
getRe
ndering
ModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
void
getRe
production
ModuleGain
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
{
REQUIRE_INPUT_ARGS
(
2
);
REQUIRE_INPUT_ARGS
(
2
);
...
@@ -3224,11 +3263,42 @@ void getRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray
...
@@ -3224,11 +3263,42 @@ void getRenderingModuleGain( int nlhs, mxArray *plhs[], int nrhs, const mxArray
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
std
::
string
sID
=
matlabGetString
(
prhs
[
1
],
"sModuleID"
);
double
dGain
=
pConnection
->
pCoreInterface
->
GetRe
ndering
ModuleGain
(
sID
);
double
dGain
=
pConnection
->
pCoreInterface
->
GetRe
production
ModuleGain
(
sID
);
plhs
[
0
]
=
mxCreateDoubleScalar
(
dGain
);
plhs
[
0
]
=
mxCreateDoubleScalar
(
dGain
);
}
}
REGISTER_PUBLIC_FUNCTION
(
getReproductionModules
,
"Get list of rendering modules"
,
""
);
DECLARE_FUNCTION_OPTIONAL_INARG
(
getReproductionModules
,
bFilterEnabled
,
"boolean-1x1"
,
"Filter activated (true)"
,
"1"
);
DECLARE_FUNCTION_OUTARG
(
getReproductionModules
,
reproductionmodules
,
"cell-array of struct-1x1"
,
"Reproduction module infos (names, descriptions, etc.)"
);
void
getReproductionModules
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[]
)
{
bool
bFilterEnabled
=
true
;
if
(
nrhs
>
1
)
bFilterEnabled
=
matlabGetBoolScalar
(
prhs
[
1
],
"bFilterEnabled"
);
ConnectionHandle
hHandle
=
GetConnectionHandle
(
prhs
[
0
]
);
CVAMatlabConnection
*
pConnection
=
g_vpConnections
[
hHandle
];
std
::
vector
<
CVAAudioReproductionInfo
>
voReproductions
;
pConnection
->
pCoreInterface
->
GetReproductionModules
(
voReproductions
,
bFilterEnabled
);
const
size_t
nDims
=
int
(
voReproductions
.
size
()
);
const
int
nFields
=
4
;
const
char
*
ppszFieldNames
[]
=
{
"id"
,
"class"
,
"enabled"
,
"desc"
};
plhs
[
0
]
=
mxCreateStructArray
(
1
,
&
nDims
,
nFields
,
ppszFieldNames
);
for
(
size_t
i
=
0
;
i
<
nDims
;
i
++
)
{
size_t
j
=
0
;
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateString
(
voReproductions
[
i
].
sID
.
c_str
()
)
);
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateString
(
voReproductions
[
i
].
sClass
.
c_str
()
)
);
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateLogicalScalar
(
voReproductions
[
i
].
bEnabled
)
);
mxSetField
(
plhs
[
0
],
i
,
ppszFieldNames
[
j
++
],
mxCreateString
(
voReproductions
[
i
].
sDescription
.
c_str
()
)
);
}
}
/* +----------------------------------------------------------+ *
/* +----------------------------------------------------------+ *
* | | *
* | | *
* | Timer | *
* | Timer | *
...
...
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