Updating itaVA class with deprecation warning on old directivity calls

parent bdb96173
classdef itaVA < handle
%ITAVA Remote network interface to VA (Virtual Acoustics), the real-time
%auralization software made by ITA.
%auralization framework.
%
% Find the VA applications, documentation and examples here: http://www.virtualacoustics.org
%
% This class realizes a remote connection to a VA real-time
% auralization server and implements the full VA core interface
% in Matlab. You can connect to to the server
% and control all of its features to perform real-time
% auralization, including live tracking if available.
% In order to get understand to the concepts behind VA
% please refer to the VA documentation or have a look at the example scripts.
% auralization, including integrated live tracking if an OptiTrack tracker is at hand.
%
% See also: itaVA_example_simple, itaVA_example_tracked_sound_receiver,
% itaVA_example_generic_path_renderer, itaVA_example_random_numbers
......@@ -21,13 +21,11 @@ classdef itaVA < handle
% va = itaVA;
% va.connect;
%
% If no error occurs, you can then use the interface to work with
% the VA server.
%
% Now, you can call other methods. For instance create a sound
% source:
% If the connection is established, you can start controlling VA via the interface.
% For instance create an move a sound source:
%
% sourceID = va.create_sound_source( 'My Matlab virtual sound source' )
% va.set_sound_source_position( sourceID, [ 0 0 0 ] );
%
% When everything is done, do not forget to close the connection.
% You can call disconnect on the instance or simply clear it:
......@@ -373,6 +371,15 @@ classdef itaVA < handle
VAMatlab( 'get_tracker_info', this.handle )
end
%% --= Deprecated methods =--
function id = create_directivity( this, filepath )
% Creates a directivity from file [DEPRECATED]
warning( 'This method is marked as deprecated and will be removed in a future version. Please use ''create_directivity_from_file'' instead.' )
id = this.create_directivity_from_file( filepath );
end
%% --= Functions =--
......@@ -430,7 +437,7 @@ classdef itaVA < handle
[material_id] = VAMatlab('create_acoustic_material_from_file', this.handle, file_path,material_name);
end
function [directivityID] = create_directivity(this, filename,name)
function [directivityID] = create_directivity_from_file(this, filename,name)
% Loads a directivity from a file
%
% Parameters:
......@@ -446,7 +453,26 @@ classdef itaVA < handle
if this.handle==0, error('Not connected.'); end;
if ~exist('name','var'), name = ''; end
[directivityID] = VAMatlab('create_directivity', this.handle, filename,name);
[directivityID] = VAMatlab('create_directivity_from_file', this.handle, filename,name);
end
function [directivityID] = create_directivity_from_parameters(this, directivity_args,name)
% Creates a directivity based on given parameters
%
% Parameters:
%
% directivity_args [struct] Directivity arguments
% name [string] Displayed name (optional, default: '')
%
% Return values:
%
% directivityID [integer-1x1] Directivity ID
%
if this.handle==0, error('Not connected.'); end;
if ~exist('name','var'), name = ''; end
[directivityID] = VAMatlab('create_directivity_from_parameters', this.handle, directivity_args,name);
end
function [geo_mesh_id] = create_geometry_mesh_from_file(this, file_path,geo_mesh_name)
......@@ -599,6 +625,24 @@ classdef itaVA < handle
[id] = VAMatlab('create_sound_receiver', this.handle, name);
end
function [id] = create_sound_receiver_explicit_renderer(this, renderer,name)
% Creates a sound receiver explicitly for a certain renderer
%
% Parameters:
%
% renderer [string] Renderer identifier
% name [string] Name
%
% Return values:
%
% id [integer-1x1] Sound receiver ID
%
if this.handle==0, error('Not connected.'); end;
[id] = VAMatlab('create_sound_receiver_explicit_renderer', this.handle, renderer,name);
end
function [id] = create_sound_source(this, name)
% Creates a sound source
%
......@@ -1494,7 +1538,7 @@ classdef itaVA < handle
[params] = VAMatlab('get_sound_receiver_parameters', this.handle, ID,args);
end
function [pos,ypr] = get_sound_receiver_pose(this, soundreceiverID)
function [pos,quat] = get_sound_receiver_pose(this, soundreceiverID)
% Returns the position and orientation of a sound receiver
%
% Parameters:
......@@ -1504,12 +1548,12 @@ classdef itaVA < handle
% Return values:
%
% pos [double-3] Position vector [x,y,z] (unit: meters)
% ypr [double-4] Rotation quaternion [w,x,y,z]
% quat [double-4] Rotation quaternion [w,x,y,z]
%
if this.handle==0, error('Not connected.'); end;
[pos,ypr] = VAMatlab('get_sound_receiver_pose', this.handle, soundreceiverID);
[pos,quat] = VAMatlab('get_sound_receiver_pose', this.handle, soundreceiverID);
end
function [pos] = get_sound_receiver_position(this, soundreceiverID)
......@@ -2459,14 +2503,14 @@ classdef itaVA < handle
VAMatlab('set_sound_receiver_parameters', this.handle, ID,params);
end
function [] = set_sound_receiver_pose(this, soundreceiverID,pos,ypr)
function [] = set_sound_receiver_pose(this, soundreceiverID,pos,quat)
% Sets the position and orientation (in yaw-pitch-roll angles) of a sound receiver
%
% Parameters:
%
% soundreceiverID [integer-1x1] Sound receiver ID
% pos [double-3] Position vector [x, y, z] (unit: meters)
% ypr [double-4] Rotation angles [w,x,y,z]
% quat [double-4] Rotation angles [w,x,y,z]
%
% Return values:
%
......@@ -2475,7 +2519,7 @@ classdef itaVA < handle
if this.handle==0, error('Not connected.'); end;
VAMatlab('set_sound_receiver_pose', this.handle, soundreceiverID,pos,ypr);
VAMatlab('set_sound_receiver_pose', this.handle, soundreceiverID,pos,quat);
end
function [] = set_sound_receiver_position(this, soundreceiverID,pos)
......
classdef DAFF < handle
properties
properties (Access = protected)
daffhandle
view = 'object'
end
......@@ -8,14 +8,12 @@ classdef DAFF < handle
%% Create DAFF class and load from file
% filepath Path to DAFF file
if( nargin > 0 )
open( filepath )
obj.open( filepath )
end
end
function open( obj, filepath )
obj.daffhandle = DAFFv17( 'open', filepath );
end
function close( obj )
end
function set_data_view( obj )
obj.view = 'data';
end
......@@ -34,6 +32,7 @@ classdef DAFF < handle
function props = get_properties( obj )
%% Returns the properties of an opened DAFF file
props = DAFFv17( 'getProperties', obj.daffhandle );
end
function coords = get_record_coords( obj, index )
%% Returns the coordinates of a grid point
coords = DAFFv17( 'getRecordCoords', obj.daffhandle, obj.view, index );
......@@ -58,12 +57,15 @@ classdef DAFF < handle
%% Returns the data at the nearest neighbour grid point to the given direction
idx = DAFFv17( 'getCell', obj.daffhandle, obj.view, azi_deg, ele_deg );
end
function get_version( obj )
%% Returns the OpenDAFF version
DAFFv17('getVersion')
end
methods (Static)
function help()
%% Prints the help output of OpenDAFF
DAFFv17('help')
end
function help( obj )
DAFFv17('help');
function v = get_version()
%% Returns the OpenDAFF version
v = DAFFv17('getVersion');
end
end
end
......@@ -798,7 +798,7 @@ function [] = daffv17_write( varargin )
props.numRecords = props.numRecords + 1;
end
disp( [ 'Processed beta angle ' num2str( beta ) ', took ' num2str( toc ) ] )
disp( [ 'Processed beta angle ' num2str( beta ) ', took ' num2str( toc, 3 ) 's' ] )
end
disp( '... and data has been assembled. Will write to file now.' )
......
......@@ -24,8 +24,8 @@ if isfield( config, 'reference' ) && strcmpi( config.reference, 'head' )
for n = 1:(config.numchannels/2)
[ l, r ] = AKhrirInterpolation( alpha + hato( n ), beta - 90, hato( n ) );
% Interleave for DAFF (odd = left, even = right)
data( 2*n-1, : ) = l';
data( 2*n, : ) = r';
data( 2*n-1, : ) = l' / n;
data( 2*n, : ) = r' / n;
end
else
......
......@@ -2,6 +2,8 @@
% Resources
% http://dx.doi.org/10.14279/depositonce-5718.2
% http://www.ak.tu-berlin.de/menue/digitale_ressourcen/research_tools/aktools/
addpath( genpath( 'AKtools' ) )
addpath( genpath( 'FABIAN_HRTF_DATABASE_V2' ) )
AKdependencies('FABIAN')
%% Configure
......@@ -26,9 +28,9 @@ additional_metadata = daffv17_add_metadata( additional_metadata, 'FABIAN_license
%% Export untouched
additional_metadata_untouched = daffv17_add_metadata( additional_metadata, 'reference', 'STRING', export_properties.reference );
daffv17_convert_from_aktools( 'FABIAN_HATO_5x5x5_256_44100Hz.v17.ir.daff', export_properties, additional_metadata_untouched )
daffv17_convert_from_aktools( 'FABIAN_HATO_5x5x5_256_44100Hz_debug.v17.ir.daff', export_properties, additional_metadata_untouched )
%% Export for VA with head as reference frame
export_properties.reference = 'head'; % the head-above-torso angle rotates torso not head (for Virtual Acoustics)
additional_metadata_va = daffv17_add_metadata( additional_metadata, 'reference', 'STRING', export_properties.reference );
daffv17_convert_from_aktools( 'FABIAN_OTAH_5x5x5_256_44100Hz.v17.ir.daff', export_properties, additional_metadata_va )
daffv17_convert_from_aktools( 'FABIAN_OTAH_5x5x5_256_44100Hz_debug.v17.ir.daff', export_properties, additional_metadata_va )
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