VAMatlabExecutable_debug.m 2.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
%this debug script is for debugging the VA-to-Matlab connection
% without the use of the facade class "itaVA"
% To use MSVS for debugging the MEX library, in VS select "Debugging >
% Append to process" ... then select the MATLAB.exe process and start to
% execute commands in Matlab that are calling functions of the MEX file

cd 'D:\Users\stienen\VA\VAMatlab\Matlab'

addpath( '../../VABuild/Build/Debug_x64' )
addpath( '../../VistaCoreLibs/lib/x64' )
addpath( '../../3rdParty/NatNetSDK/lib/x64' )

conn = VAMatlabD( 'connect', 'localhost:12340' );

L = VAMatlabD( 'createListener', conn, 'itaVA_Tracked_Listener', 'default', -1 );

VAMatlabD( 'SetTrackedListener', conn,L )
%VAMatlabD( 'SetTrackedSource', conn,L )
VAMatlabD( 'SetRigidBodyIndex', conn, 1 )
VAMatlabD( 'SetRigidBodyTranslation', conn, [ 0 0 3 ] )
q = ita_quaternion( [ pi/sqrt(2) 0 1/sqrt(2) 0 ] ) 
q = q.normalize

VAMatlabD( 'SetRigidBodyRotation', conn, q.e(:)' )

VAMatlabD( 'connectTracker', conn )
b = VAMatlabD( 'IsTrackerConnected', conn )
VAMatlabD( 'disconnectTracker', conn )


%VAMatlabD( 'connectTracker', conn, '137.226.61.85', '137.226.61.85' )



modinfos = VAMatlabD( 'enumerateModules', conn );


istruct = struct;
istruct.info = '';
ostruct = VAMatlabD( 'callModule', conn, 'GenericPath:MyGenericRenderer', istruct )

istruct = struct();
istruct.command = 'UPDATE';
istruct.ListenerID = 1;
istruct.SourceID = 1;

if false 
    istruct.type = 'FilePath';
    istruct.FilePath = '$(VADataDir)/HPEQ/HD600_all_eq_128_stereo.wav';
end

if true
    istruct.type = 'DATA';
    istruct.IRDataCh1 = [ 0.9 zeros( 1, 2048 ) ];
    istruct.IRDataCh2 = [ 0.1 zeros( 1, 2048 ) ];
end

if false
    sweep = ita_time_crop( ita_generate_sweep, [1 1350], 'samples' ) * 0.03;
    istruct.type = class( sweep );
    istruct.itaAudio = ita_merge( sweep, sweep );
end

ostruct = VAMatlabD( 'callModule', conn, 'GenericPath:MyGenericRenderer', istruct );

%VAMatlabD( 'callModule', conn, 'hprep', { 'print', 'help' } ) % will print on std::cout @ real VACore, i.e. VAGUI or Console
%lhs_arg = VAMatlabD( 'callModule', conn, 'hprep', { 'get', 'gain' } )
%VAMatlabD( 'callModule', conn, 'hprep', { 'set', 'gain', 'value', lhs_arg / 3 } )
%lhs_arg_new = VAMatlabD( 'callModule', conn, 'hprep', { 'get', 'gain' } )

VAMatlabD( 'disconnect', conn )
clear VAMatlabD % release to allow write access for msvc