ita_toolbox_setup.m 4.6 KB
Newer Older
1 2 3 4 5 6 7
function varargout = ita_toolbox_setup(varargin)
%ITA_TOOLBOX_SETUP - Setup paths for ITA Toolbox
%  This function sets all paths in the RWTH ITA Toolbox folder
%
%  Call: ita_toolbox_setup
%
%   See also ita_toolbox_documentation.
8

9 10 11 12 13 14 15 16 17 18 19 20
%   Reference page in Help browser
%      <a href="matlab:doc ita_toolbox_setup">doc ita_toolbox_setup</a>
%
% Autor: Pascal Dietrich -- Email: pdi@akustik.rwth-aachen.de
% Created:  25 Aug 2008

% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved.
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder.
% </ITA-Toolbox>


21
warning off
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
close all
clc

%% Check for MATLAB Version, R2008a or higher
if verLessThan('matlab','7.6')
    h = errordlg('MATLAB Version Check...', 'Your MATLAB Version is too old. Please install R2008a or higher.');
    uiwait(h)
    disp('Toolbox Setup stopped.')
    return;
end

%%
v = ver;
signalfound = false;
for k = 1:length(v)
    if strfind(v(k).Name, 'Signal Processing Toolbox')
        signalfound = true;
        disp(sprintf('%s, Version %s', v(k).Name, v(k).Version)) %#ok<*DSPS>
    end
end
if ~signalfound
    fprintf(2,'********************************************************************************\n') %#ok<*PRTCAL>
    fprintf(2,'************* You have to install Signal Processing Toolbox ! ******************\n')
    fprintf(2,'********************************************************************************\n')
end

%% Get root of RWTH-ITA-Toolbox
49 50
tb_setup_path = which('ita_toolbox_setup.m');
tb_base_path = fileparts(tb_setup_path);
51 52

%% Add path to kernel, so basic functions are available
53 54
addpath(tb_base_path);
addpath([tb_base_path, filesep, 'kernel']);
55 56 57 58 59

%% Add userpath, here might be our pathdef.m
addpath(userpath);

%% ITA-Toolbox path handling
60
% this function has to be in the kernel directory!
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
ita_path_handling();

%% License and Key?
if usejava('desktop') %Only if desktop available (non_cluster) (mpo 5.8.11)
    if ~ita_preferences('license')
        ita_toolbox_license();
    end
end

%% Update lastToolboxVersionNumber date to now
ita_preferences('lastToolboxSetupVerNum',ita_toolbox_version_number());

%% Preferences GUI
% First clean preferences
prefs = ita_preferences(); % Get current prefs
ita_preferences('reset');  % Delete all preferences
ita_preferences(prefs);    % Set all prefs, non-existing ones will be ignored

%% WIN64 and no ASIO sound cards
if strcmpi(mexext,'mexw64')
    % check for sound card list
82
    [~, devIDsIn, ~, devIDsOut] = ita_portaudio_menuStr();
83 84 85 86 87 88 89
    if numel(devIDsIn) == 1 && numel(devIDsOut) == 1 && ita_preferences('playrec') > 0
        ita_preferences('playrec',mod(ita_preferences('playrec'),2)+1);
        ccx
        ccx
        disp('Trying different playrec MEX-file to find sound cards...')
        pause(0.5)
        % search with alternative playrec mex-file
90
        [~, devIDsIn, ~, devIDsOut] = ita_portaudio_menuStr();
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
        if numel(devIDsIn) == 1 && numel(devIDsOut) == 1 && ita_preferences('playrec') > 0
            ita_preferences('playrec',mod(ita_preferences('playrec'),2)+1);
            ccx
            ccx
            disp('NO sound cards detected!');
        end
    end
end

%% build search database
% Temporarily disabled due to builddocsearchdb in 2014b and newer
% if ~exist([ita_toolbox_path filesep 'HTML' filesep 'helpsearch'],'dir')
%     builddocsearchdb( [ita_toolbox_path filesep 'HTML' ] ); %generate help search
%     rehash toolboxcache
% end

107
%% start third party APIs
108 109 110 111
% if ~exist([ita_toolbox_path filesep 'external_packages' filesep 'sofa' filesep 'API_MO' filesep 'conventions' filesep 'GeneralFIR-a.mat' ],'file')
%     disp('Installing SOFA conventions (external module):');
%     ;
% end
112

113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
%% clean up old filters
ita_delete_filter();

%% Then show gui
if usejava('desktop') %Only if desktop available (non_cluster)
    %     ita_preferences();
    ita_disp()
    disp('<a  href="matlab:ita_preferences"> Click here to start with basic settings ''ita_preferences()'' -configure soundcard...</a>')
    ita_disp()
    disp('<a  href="matlab:ita_preferences(''reset'')"> Click here to reset the basic settings to defaults ''ita_preferences(''reset'')'' ...</a>')
end

%% find output
if nargout > 0
    varargout{1} = 1;
else
    ita_disp()
    disp('<a href="matlab:ita_toolbox_gui"> Click here to start with a GUI ''ita_toolbox_gui()'' to start working...</a>')
    ita_disp()
132
    disp('<a href="matlab:edit ita_tutorial"> Click here to start with a Tutorial script ''ita_tutorial()''</a>')
133
    ita_disp()
134
    disp('<a href="matlab:ita_generate_documentation"> Click here to build the HTML documentation ''ita_generate_documentation()''</a>')
135 136 137 138
end
ita_disp()

end