mathieu@14
|
1 function [] = check_options(timeMode,ebrMode,score)
|
mathieu@14
|
2
|
mathieu@14
|
3 % This program was written by Mathias Rossignol & Grégoire Lafay
|
mathieu@14
|
4 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr>
|
mathieu@14
|
5 %
|
mathieu@14
|
6 % This program is free software: you can redistribute it and/or modify it
|
mathieu@14
|
7 % under the terms of the GNU General Public License as published by the Free
|
mathieu@14
|
8 % Software Foundation, either version 3 of the License, or (at your option)
|
mathieu@14
|
9 % any later version.
|
mathieu@14
|
10 %
|
mathieu@14
|
11 % This program is distributed in the hope that it will be useful, but
|
mathieu@14
|
12 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
mathieu@14
|
13 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
mathieu@14
|
14 % for more details.
|
mathieu@14
|
15 %
|
mathieu@14
|
16 % You should have received a copy of the GNU General Public License along
|
mathieu@14
|
17 % with this program. If not, see <http://www.gnu.org/licenses/>.
|
mathieu@14
|
18
|
mathieu@14
|
19
|
mathieu@14
|
20 %% Forbidden modes :
|
mathieu@14
|
21 % time abstract - ebr replicate
|
mathieu@14
|
22 % time generate - ebr replicate
|
mathieu@14
|
23
|
mathieu@14
|
24 %% Check mode validity
|
mathieu@14
|
25 if(~strcmp(ebrMode,'abstract') && ~strcmp(ebrMode,'replicate') && ~strcmp(ebrMode,'generate'))
|
mathieu@14
|
26 error('wrong ebrMode')
|
mathieu@14
|
27 end
|
mathieu@14
|
28
|
mathieu@14
|
29 if(~strcmp(timeMode,'abstract') && ~strcmp(timeMode,'replicate') && ~strcmp(timeMode,'generate'))
|
mathieu@14
|
30 error('wrong ebrMode')
|
mathieu@14
|
31 end
|
mathieu@14
|
32
|
mathieu@14
|
33 if(strcmp(timeMode,'abstract') && strcmp(ebrMode,'replicate'))
|
mathieu@14
|
34 error(['wrong timeMode, timeMode must be set to replicate if ebrMode is set to replicate (The number of events must be the same); time=' timeMode ', and ebr=' ebrMode])
|
mathieu@14
|
35 elseif(strcmp(timeMode,'generate') && strcmp(ebrMode,'replicate'))
|
mathieu@14
|
36 error(['wrong timeMode, timeMode must be set to replicate if ebrMode is set to replicate (The number of events must be the same); time=' timeMode ', and ebr=' ebrMode])
|
mathieu@14
|
37 end
|
mathieu@14
|
38
|
mathieu@14
|
39 %% Check options validity
|
mathieu@14
|
40 if ~isfield(score,'sceneDuration')
|
mathieu@14
|
41 if strcmp(timeMode,'generate') && strcmp(timeMode,'generate')
|
mathieu@14
|
42 error('Score does not have a sceneDuration field')
|
mathieu@14
|
43 else
|
mathieu@33
|
44 fprintf(2, 'score.sceneduration does not exist; sceneDuration will be set to the duration of the scene to replicate.\n')
|
mathieu@14
|
45 end
|
mathieu@14
|
46 end
|
mathieu@14
|
47
|
mathieu@14
|
48 if strcmp(timeMode,'generate') || strcmp(timeMode,'generate')
|
mathieu@14
|
49 if ~isfield(score,'events')
|
mathieu@14
|
50 error('score.event does not exist; score.event is needed if one of the modes is set to generate')
|
mathieu@14
|
51 end
|
mathieu@14
|
52 end
|
mathieu@14
|
53
|
mathieu@14
|
54 if ~strcmp(timeMode,'generate') || ~strcmp(timeMode,'generate')
|
mathieu@14
|
55 if isfield(score,'events')
|
mathieu@33
|
56 fprintf(2, 'score.event exist; score.events cells values will be used as offsets.\n')
|
mathieu@14
|
57 end
|
mathieu@14
|
58 end
|
mathieu@14
|
59
|
mathieu@14
|
60
|
mathieu@14
|
61
|