More documentation for DAFF class

parent b7788f16
classdef DAFF < handle classdef DAFF < handle
% DAFF is a direction audio file format for virtual acoustics
% A daff file instance can be used to load a file in DAFF format and
% receiver metadata, proerties and directional audio content.
%
% The most important functions are
%
% load Open a DAFF file
% close Closes a DAFF file
% nearest_neighbour_record Receive content for a certain direction in spherical coordinates
% metadata Get DAFF metadata as struct
% properties Get DAFF properties as struct
%
properties (Access = protected) properties (Access = protected)
daffhandle
view = 'object' daffhandle % The internal DAFF file handle
view = 'object' % The DAFF viewpoint (user/object or developer/data)
end end
methods methods
function obj = DAFF( filepath ) function obj = DAFF( filepath )
%% Create DAFF class and loads content from file % Creates a DAFF instance and loads content from file
% filepath Path to DAFF file % filepath Path to DAFF file
if( nargin > 0 ) if( nargin > 0 )
obj.open( filepath ) obj.open( filepath )
end end
end end
function open( obj, filepath ) function open( obj, filepath )
%% Opens a DAFF file % Opens a DAFF file
obj.daffhandle = DAFFv17( 'open', filepath ); obj.daffhandle = DAFFv17( 'open', filepath );
end end
function close( obj ) function close( obj )
%% Closes the DAFF file % Closes the DAFF file
DAFFv17( 'close', obj.daffhandle ) DAFFv17( 'close', obj.daffhandle )
end end
function set_data_view( obj ) function set_data_view( obj )
%% Switches to data view (alpha, beta) % Switches to data view (alpha, beta)
obj.view = 'data'; obj.view = 'data';
end end
function set_object_view( obj ) function set_object_view( obj )
%% Switches to object / user view (elevation, azimuth) [default] % Switches to object / user view (elevation, azimuth) [default]
obj.view = 'object'; obj.view = 'object';
end end
function metadata = get_metadata(obj) function metadata = metadata(obj)
%% Returns the metadata of an opened DAFF file % Returns the metadata of an opened DAFF file
metadata = DAFFv17('getMetadata', obj.daffhandle); metadata = DAFFv17( 'getMetadata', obj.daffhandle );
end end
function metadata = get_record_metadata( obj, index ) function metadata = record_metadata( obj, index )
%% Returns the record metadata of an opened DAFF file % Returns the record metadata of an opened DAFF file
metadata = DAFFv17('getRecordMetadata', obj.daffhandle, index); metadata = DAFFv17( 'getRecordMetadata', obj.daffhandle, index );
end end
function props = get_properties( obj ) function props = properties( obj )
%% Returns the properties of an opened DAFF file % Returns the properties of an opened DAFF file
props = DAFFv17( 'getProperties', obj.daffhandle ); props = DAFFv17( 'getProperties', obj.daffhandle );
end end
function coords = get_record_coords( obj, index ) function coords = record_coords( obj, index )
%% Returns the coordinates of a grid point % Returns the coordinates of a grid point
coords = DAFFv17( 'getRecordCoords', obj.daffhandle, obj.view, index ); coords = DAFFv17( 'getRecordCoords', obj.daffhandle, obj.view, index );
end end
function idx = get_nearest_neighbour_index( obj, azi_deg, ele_deg ) function idx = nearest_neighbour_index( obj, azi_deg, ele_deg )
%% Returns the data at the nearest neighbour grid point to the given direction % Returns the data at the nearest neighbour grid point to the given direction
% Uses spherical coordinates azimuth and elevation in degree.
%
% azi_deg Azimuthal angle in degree
% ele_deg Elevation angle in degree
%
idx = DAFFv17( 'getNearestNeighbourIndex', obj.daffhandle, obj.view, azi_deg, ele_deg ); idx = DAFFv17( 'getNearestNeighbourIndex', obj.daffhandle, obj.view, azi_deg, ele_deg );
end end
function data = get_nearest_neighbour_record( obj, azi_deg, ele_deg ) function data = nearest_neighbour_record( obj, azi_deg, ele_deg )
%% Returns the data at the nearest neighbour grid point to the given direction % Returns the data at the nearest neighbour grid point to the given direction
% Uses spherical coordinates azimuth and elevation in degree.
%
% azi_deg Azimuthal angle in degree
% ele_deg Elevation angle in degree
%
data = DAFFv17( 'getNearestNeighbourRecord', obj.daffhandle, obj.view, azi_deg, ele_deg ); data = DAFFv17( 'getNearestNeighbourRecord', obj.daffhandle, obj.view, azi_deg, ele_deg );
end end
function rec = get_record_by_index( obj, idx ) function rec = record_by_index( obj, idx )
%% Returns the data at a grid of the given index % Returns the data at a grid of the given index
rec = DAFFv17( 'getRecordByIndex', obj.daffhandle, idx ); rec = DAFFv17( 'getRecordByIndex', obj.daffhandle, idx );
end end
function data = get_cell_records( obj, azi_deg, ele_deg ) function data = cell_records( obj, azi_deg, ele_deg )
%% Returns the data of all four records of the surrounding cell to the given direction % Returns the data of all four records of the surrounding cell to the given direction
% Uses spherical coordinates azimuth and elevation in degree.
%
% azi_deg Azimuthal angle in degree
% ele_deg Elevation angle in degree
%
data = DAFFv17('getCellRecords', obj.daffhandle, obj.view, azi_deg, ele_deg ); data = DAFFv17('getCellRecords', obj.daffhandle, obj.view, azi_deg, ele_deg );
end end
function idx = get_cell( obj, azi_deg, ele_deg ) function idx = cell( obj, azi_deg, ele_deg )
%% Returns the data at the nearest neighbour grid point to the given direction % Returns the data at the nearest neighbour grid point to the given direction
% Uses spherical coordinates azimuth and elevation in degree.
%
% azi_deg Azimuthal angle in degree
% ele_deg Elevation angle in degree
%
idx = DAFFv17( 'getCell', obj.daffhandle, obj.view, azi_deg, ele_deg ); idx = DAFFv17( 'getCell', obj.daffhandle, obj.view, azi_deg, ele_deg );
end end
end end
methods (Static) methods (Static)
function help()
%% Prints the help output of OpenDAFF function mex_help()
DAFFv17('help') % Prints the help output of OpenDAFF extension (mex)
DAFFv17( 'help' )
end end
function v = get_version()
%% Returns the OpenDAFF version function v = mex_version()
v = DAFFv17('getVersion'); % Returns the OpenDAFF extension (mex) version
v = DAFFv17( 'getVersion' );
end end
end end
end end
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