-
Notifications
You must be signed in to change notification settings - Fork 11
/
startTwoEars.m
58 lines (53 loc) · 2.04 KB
/
startTwoEars.m
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
function startTwoEars(configFile)
%startTwoEars sets up the whole Two!Ears model parts
%
% USAGE
% startTwoEars()
% startTwoEars(configFile)
% startTwoEars('info')
%
% INPUT PARAMETERS
% configFiles - xml config file specifying which modules of Two!Ears
% should be activated, see http://bit.ly/1Kc1Zuc
% 'info' - display the version of the Two!Ears Auditory Model and
% infos about the involved people
if nargin==0
configFile = 'TwoEars.xml';
end
if ~ischar(configFile)
error('configFile needs to be a string');
end
% Add current folder and the src folders
TwoEarsPath = fileparts(mfilename('fullpath'));
addpath( fullfile(TwoEarsPath, 'Tools', 'misc') );
addPathsIfNotIncluded( {TwoEarsPath,...
fullfile(TwoEarsPath, 'Tools', 'TwoEarsStartup'),...
fullfile(TwoEarsPath, 'Tools', 'args')...
} );
% Display version information and finish if asked to do so
if strcmp('info', configFile)
displayTwoEarsInfo('full');
return
end
% SOFA work around. The following checks if you have another version of SOFA
% added to your Matlab paths and removes it as the official SOFA version is not
% compatible with the one needed by Two!Ears
if exist('SOFAstart') && ~strcmp('1.0-twoears', SOFAgetVersion('SOFA'))
warning('off', 'MATLAB:rmpath:DirNotFound');
sofaPath = fileparts(which('SOFAstart'));
rmpath(sofaPath);
rmpath(fullfile(sofaPath, 'helper'));
rmpath(fullfile(sofaPath, 'coordinates'));
rmpath(fullfile(sofaPath, 'converters'));
rmpath(fullfile(sofaPath, 'demos'));
rmpath(fullfile(sofaPath, 'netcdf'));
warning('on', 'MATLAB:rmpath:DirNotFound');
warning(['Your current SOFA installation has been removed from Matlab ', ...
'paths as the official SOFA version is not compatible with ', ...
'Two!Ears.']);
end
if exist(configFile,'file')
setupPartConfig(configFile);
else
error('Config file %s is not a valid file.',configFile);
end