Renaming all itaVA class references to VA

parent 6e0e572e
% This 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 "VA"
% 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
......@@ -40,7 +40,7 @@ disp( reproductions )
%% Tests
L = VAMatlabD( 'create_sound_receiver', conn, 'itaVA_Tracked_Listener', 'default', -1 );
L = VAMatlabD( 'create_sound_receiver', conn, 'VA_Tracked_Listener', 'default', -1 );
VAMatlabD( 'set_tracked_sound_receiver', conn,L )
%VAMatlabD( 'set_tracked_sound_source', conn,L )
......
% THIS FILE WILL BE OVERWRITTEN BY CMAKE WITHOUT WARNING
%
% Code generator for the VA Matlab interface facade class
%
% Desc: This script generates the code for the Matlab
% facade class to the VAInterface MEXExtension.
% It takes the class template code and inserts
% all stubs for the functions in the VAConnector
% interface. These are derived using the reflexion
% mechanism ('enumerate_functions')
%
va_base_dir = '..'; % VA folder with bin, lib, matlab, data etc.
va_script_dir = fullfile( va_base_dir, 'matlab' ); % Matlab scripts target directory
va_bin_dir = fullfile( va_base_dir, 'bin' );
va_lib_dir = fullfile( va_base_dir, 'lib' );
if exist( va_bin_dir, 'dir' ) ~= 7
error( 'Deploy dir ''%s'' does not exist. Please build and install VAMatlab first.', va_bin_dir )
end
if exist( va_script_dir, 'dir' ) ~= 7
mkdir( va_script_dir );
end
if exist( [ 'VAMatlab' '.' mexext ], 'file' )
warning( 'VAMatlab already found at location "%s", are you sure to build VA against this executable? Will proceed now.', which( 'VAMatlab' ) )
else
% Add to PATH temporarily and attempt to move lib to bin dir
addpath( va_script_dir, va_bin_dir )
[ s ] = movefile( fullfile( va_lib_dir, 'VAMatlab*' ), va_bin_dir );
if ~s && ~exist( [ 'VAMatlab' '.' mexext ], 'file' )
error( 'Could not locate VAMatlab executable. Please make sure that it can be found.' )
end
end
% Parameters
templateFile = 'VA.m.proto';
outputFile = fullfile( va_script_dir, 'VA.m' );
fprintf( 'Generating code for VA Matlab class ''%s'' ...\n', outputFile );
code = fileread( templateFile );
stubCode = VA_generate_stubs();
code = strrep( code, '###STUBCODE###', stubCode );
% Write the results
fid = fopen( outputFile, 'w' );
fprintf( fid, '%s', code );
fclose( fid );
fprintf( 'Matlab class ''%s'' successfully built\n', outputFile );
% Remove from MATLABPATH (otherwise naming conflicts may occur with
% ITA-Toolbox/applications/VirtualAcoustics/VA/* scripts)
rmpath( va_script_dir, va_bin_dir )
% THIS FILE WILL BE OVERWRITTEN BY CMAKE WITHOUT WARNING
%
% Code generator for the VA Matlab interface facade class
%
% Desc: This script generates the code for the Matlab
% facade class to the VAInterface MEXExtension.
% It takes the class template code and inserts
% all stubs for the functions in the VAConnector
% interface. These are derived using the reflexion
% mechanism ('enumerate_functions')
%
va_base_dir = 'D:/Users/stienen/dev/VA/dist/win32-x64.vc12'; % VA folder with bin, lib, matlab, data etc.
va_script_dir = fullfile( va_base_dir, 'matlab' ); % Matlab scripts target directory
va_bin_dir = fullfile( va_base_dir, 'bin' );
va_lib_dir = fullfile( va_base_dir, 'lib' );
if exist( va_bin_dir, 'dir' ) ~= 7
error( 'Deploy dir ''%s'' does not exist. Please build and install VAMatlab first.', va_bin_dir )
end
if exist( va_script_dir, 'dir' ) ~= 7
mkdir( va_script_dir );
end
if exist( [ 'VAMatlab' '.' mexext ], 'file' )
warning( 'VAMatlab already found at location "%s", are you sure to build VA against this executable? Will proceed now.', which( 'VAMatlab' ) )
else
% Add to PATH temporarily and attempt to move lib to bin dir
addpath( va_script_dir, va_bin_dir )
[ s ] = movefile( fullfile( va_lib_dir, 'VAMatlab*' ), va_bin_dir );
if ~s && ~exist( [ 'VAMatlab' '.' mexext ], 'file' )
error( 'Could not locate VAMatlab executable. Please make sure that it can be found.' )
end
end
% Parameters
templateFile = 'VA.m.proto';
outputFile = fullfile( va_script_dir, 'VA.m' );
fprintf( 'Generating code for VA Matlab class ''%s'' ...\n', outputFile );
code = fileread( templateFile );
stubCode = VA_generate_stubs();
code = strrep( code, '###STUBCODE###', stubCode );
% Write the results
fid = fopen( outputFile, 'w' );
fprintf( fid, '%s', code );
fclose( fid );
fprintf( 'Matlab class ''%s'' successfully built\n', outputFile );
% Remove from MATLABPATH (otherwise naming conflicts may occur with
% ITA-Toolbox/applications/VirtualAcoustics/VA/* scripts)
rmpath( va_script_dir, va_bin_dir )
%% itaVA offline simulation/auralization example
%% VA offline simulation/auralization example
% Requires VA to run with a virtual audio device that can be triggered by
% the user. Also the rendering module(s) have to be set to record the output
......@@ -9,14 +9,14 @@ sampling_rate = 44100;
%% Connect and set up simple scene
va = itaVA( 'localhost' );
va = VA( 'localhost' );
L = va.create_sound_receiver( 'itaVA_Listener' );
L = va.create_sound_receiver( 'VA_Listener' );
va.set_sound_receiver_position( L, [ 0 1.7 0 ] )
H = va.create_directivity( '$(DefaultHRIR)' );
va.set_sound_receiver_directivity( L, H );
S = va.create_sound_source( 'itaVA_Source' );
S = va.create_sound_source( 'VA_Source' );
X = va.create_signal_source_buffer_from_file( '$(DemoSound)' );
va.set_signal_source_buffer_playback_action( X, 'play' )
va.set_signal_source_buffer_looping( X, true );
......
%% itaVA offline simulation/auralization example that uses impulse responses
%% VA offline simulation/auralization example that uses impulse responses
% Requires VA to run with a virtual audio device that can be triggered by
% the user. Also the generic path prototype rendering module(s) has to record the output
......@@ -6,14 +6,14 @@
%% Connect and set up simple scene
va = itaVA( 'localhost' );
va = VA( 'localhost' );
L = va.create_sound_receiver( 'itaVA_Listener' );
L = va.create_sound_receiver( 'VA_Listener' );
va.set_sound_receiver_position( L, [ 0 1.7 0 ] )
H = va.create_directivity( '$(DefaultHRIR)' );
va.set_sound_receiver_directivity( L, H );
S = va.create_sound_source( 'itaVA_Source' );
S = va.create_sound_source( 'VA_Source' );
X = va.create_signal_source_buffer_from_file( '$(DemoSound)' );
va.set_signal_source_buffer_playback_action( X, 'play' )
va.set_signal_source_buffer_looping( X, true );
......
%% VA simple example code
% Create VA
va = VA;
% Connect to VA application (start the application first)
va.connect( 'localhost' )
% Reset VA to clear the scene
va.reset()
% Control output gain
va.set_output_gain( .25 )
% Add the current absolute folder path to VA application
va.add_search_path( pwd );
% Create a signal source and start playback
X = va.create_signal_source_buffer_from_file( '$(DemoSound)' );
va.set_signal_source_buffer_playback_action( X, 'play' )
va.set_signal_source_buffer_looping( X, true );
% Create a virtual sound source and set a position
S = va.create_sound_source( 'VA_Source' );
va.set_sound_source_position( S, [ 2 1.7 2 ] )
% Create a listener with a HRTF and position him
L = va.create_sound_receiver( 'VA_Listener' );
va.set_sound_receiver_position( L, [ 0 1.7 0 ] )
H = va.create_directivity( '$(DefaultHRIR)' );
va.set_sound_receiver_directivity( L, H );
% Connect the signal source to the virtual sound source
va.set_sound_source_signal_source( S, X )
% More information
disp( 'Type ''doc VA'' for more information.' )
%% VA tracked listener example code
% This assumes you already have set up a virtual scene without listener
% Create VA and connect
va = VA( 'localhost' );
% Create a sound receiver
L = va.create_sound_receiver( 'VA_Tracked_Listener' );
% OptiTrack tracker conneection and sound receiver updates
va.set_tracked_sound_receiver( L ) % For virtual scene / rendering
va.set_tracked_real_world_sound_receiver( L ) % For CTC reproductions
va.connect_tracker
pause( 12 ) % Observe how you can move the virtual sound receiver
va.disconnect_tracker
% Remove listener again
va.delete_sound_receiver( L )
% Stub generator for the VA Matlab facade class
% Author: Frank Wefers (fwefers@akustik.rwth-aachen.de)
function [output] = generateStubs()
% Get interface describtion
d = VAMatlab('enumerate_functions');
code = '';
for i=1:length(d)
% Concatenate the input and output argument lists
inargs = '';
ninargs = length(d(i).inargs);
for j=1:ninargs
if (j>1) inargs = strcat(inargs, ', '); end
inargs = strcat(inargs, sprintf('%s', d(i).inargs(j).name));
end
outargs = '';
noutargs = length(d(i).outargs);
for j=1:noutargs
if (j>1) outargs = strcat(outargs, ', '); end
outargs = strcat(outargs, sprintf('%s', d(i).outargs(j).name));
end
if ninargs > 0
code = [code sprintf('\tfunction [%s] = %s(this, %s)\n', outargs, d(i).name, inargs)];
else
code = [code sprintf('\tfunction [%s] = %s(this)\n', outargs, d(i).name)];
end
code = [code sprintf('\t\t%% %s\n', d(i).desc)];
% Argument and return value documentation
code = [code sprintf('\t\t%%\n\t\t%% Parameters:\n\t\t%%\n')];
if (ninargs == 0)
code = [code sprintf('\t\t%% \tNone\n')];
else
for j=1:ninargs
if (d(i).inargs(j).optional)
code = [code sprintf('\t\t%% \t%s [%s] %s (optional, default: %s)\n', ...
d(i).inargs(j).name, ...
d(i).inargs(j).type, ...
d(i).inargs(j).desc, ...
d(i).inargs(j).default)];
else
code = [code sprintf('\t\t%% \t%s [%s] %s\n', ...
d(i).inargs(j).name, ...
d(i).inargs(j).type, ...
d(i).inargs(j).desc)];
end
end
end
code = [code sprintf('\t\t%%\n\t\t%% Return values:\n\t\t%%\n')];
if (noutargs == 0)
code = [code sprintf('\t\t%% \tNone\n')];
else
for j=1:noutargs
code = [code sprintf('\t\t%% \t%s [%s] %s\n', ...
d(i).outargs(j).name, ...
d(i).outargs(j).type, ...
d(i).outargs(j).desc)];
end
end
code = [code sprintf('\t\t%%\n\n')];
% Matlab code that checks that a connection is established
code = [code sprintf('\t\tif this.handle==0, error(''Not connected.''); end;\n\n')];
% Matlab code for default values in optional input parameters
for j=1:ninargs
if (d(i).inargs(j).optional)
code = [code sprintf('\t\tif ~exist(''%s'',''var''), %s = %s; end\n', ...
d(i).inargs(j).name, d(i).inargs(j).name, d(i).inargs(j).default)];
end
end
% Matlab code calling the MEX
if (noutargs > 0)
if (ninargs > 0)
code = [code sprintf('\t\t[%s] = VAMatlab(''%s'', this.handle, %s);\n', outargs, d(i).name, inargs)];
else
code = [code sprintf('\t\t[%s] = VAMatlab(''%s'', this.handle);\n', outargs, d(i).name)];
end
else
if (ninargs > 0)
code = [code sprintf('\t\tVAMatlab(''%s'', this.handle, %s);\n', d(i).name, inargs)];
else
code = [code sprintf('\t\tVAMatlab(''%s'', this.handle);\n', d(i).name)];
end
end
code = [code sprintf('\tend\n\n')];
end
output = code;
end
\ No newline at end of file
This diff is collapsed.
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