Updating DAFFv17 executable and metadata handling in itaHRTF to comply with...

Updating DAFFv17 executable and metadata handling in itaHRTF to comply with current OpenDAFF HEAD revision source code
parent cca50cca
......@@ -379,7 +379,7 @@ classdef itaHRTF < itaAudio
counter= counter+2;
end
tempMetadata=DAFFv17('getMetadata', handleDaff);
metadata = DAFFv17('getMetadata', handleDaff);
catch
disp( 'Could not read DAFF file right away, falling back to old version and retrying ...' );
......@@ -394,17 +394,12 @@ classdef itaHRTF < itaAudio
counter = 1;
data = zeros(props.filterLength,props.numRecords*2,'double' ) ;
coordDaff = zeros(props.numRecords,2) ;
tempMetadata=DAFFv15('getMetadata', handleDaff);
for iDir = 1:props.numRecords
data(:,[counter counter+1]) = DAFFv15( 'getRecordByIndex', handleDaff,iDir )';
coordDaff(iDir,:) = DAFFv15( 'getRecordCoords', handleDaff, 'data', iDir )';
counter= counter+2;
end
end
% Proceed (version independent)
names=fieldnames(tempMetadata);
for k=1:(numel(names))
tempMetadata = DAFFv15('getMetadata', handleDaff);
% Convert old-style metadata format to v17.
names = fieldnames( tempMetadata );
for k = 1:numel( tempMetadata )
switch class(tempMetadata.(names{k}))
case 'logical'
datatype='bool';
......@@ -417,9 +412,17 @@ classdef itaHRTF < itaAudio
datatype='float';
end
end
metadata=daffv17_add_metadata(metadata,cell2mat(names(k)),datatype,tempMetadata.(names{k}));
metadata = daffv17_add_metadata( metadata,cell2mat(names(k)),datatype,tempMetadata.(names{k}) );
end
for iDir = 1:props.numRecords
data(:,[counter counter+1]) = DAFFv15( 'getRecordByIndex', handleDaff,iDir )';
coordDaff(iDir,:) = DAFFv15( 'getRecordCoords', handleDaff, 'data', iDir )';
counter= counter+2;
end
end
phiM = coordDaff(:,1)*pi/180;
%phiM = mod(coordDaff(:,1),360)*pi/180;
%if ~isempty(find(0<coordDaff(:,2),1,'first'))
......
......@@ -71,12 +71,29 @@ assert( betarange( 2 ) >= 0.0 )
assert( betarange( 1 ) <= 180.0 )
%% Assemble metadata
%% Assemble metadata (if not already present)
keyname = 'Generation script';
if ~any( strcmpi( { metadata(:).name }, keyname ) )
metadata = daffv17_add_metadata( metadata, keyname, 'String', 'writeDAFFFile.m' );
end
keyname = 'Generation toolkit';
if ~any( strcmpi( { metadata(:).name }, keyname ) )
metadata = daffv17_add_metadata( metadata, keyname, 'String', 'ITA-Toolkit' );
end
keyname = 'Generation date';
if ~any( strcmpi( { metadata(:).name }, keyname ) )
metadata = daffv17_add_metadata( metadata, keyname, 'String', date );
end
keyname = 'Web resource';
if ~any( strcmpi( { metadata(:).name }, keyname ) )
metadata = daffv17_add_metadata( metadata, keyname, 'String', 'http://www.ita-toolkit.org' );
end
metadata = daffv17_add_metadata( metadata, 'Generation script', 'String', 'writeDAFFFile.m' );
metadata = daffv17_add_metadata( metadata, 'Generation toolkit', 'String', 'ITA-Toolkit' );
metadata = daffv17_add_metadata( metadata, 'Generation date', 'String', date );
metadata = daffv17_add_metadata( metadata, 'Web resource', 'String', 'http://www.ita-toolkit.org' );
channels=this.nChannels/this.nDirections;
if(channels<1)
warning('Number of channels per record was not detected correctly, assuming 2 channel records');
......
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