tomwalters@0
|
1 % procedure for 'aim-mat'
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % INPUT VALUES:
|
tomwalters@0
|
4 %
|
tomwalters@0
|
5 % RETURN VALUE:
|
tomwalters@0
|
6 %
|
tomwalters@0
|
7 %
|
tomwalters@0
|
8 % (c) 2011, University of Southampton
|
bleeck@3
|
9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
10 % download of current version is on the soundsoftware site:
|
bleeck@3
|
11 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
12 % documentation and everything is on http://www.acousticscale.org
|
bleeck@3
|
13
|
tomwalters@0
|
14
|
tomwalters@0
|
15
|
tomwalters@0
|
16 function handles=do_aim_updateparameters(handles)
|
tomwalters@0
|
17 % return the pointer shape
|
tomwalters@0
|
18 if handles.with_graphic==1
|
tomwalters@0
|
19 set(handles.figure1,'Pointer','watch');
|
tomwalters@0
|
20 wbh=waitbar(0,'Updating Parameters... Please Wait');
|
tomwalters@0
|
21 end
|
tomwalters@0
|
22
|
tomwalters@0
|
23
|
tomwalters@0
|
24 % set the checkboxes according to the changes in the parameterfile. If
|
tomwalters@0
|
25 % changes have occured from the parameterfile relativ to the options in
|
tomwalters@0
|
26 % handles, the associated checkbox is checked. A further call to
|
tomwalters@0
|
27 % aim_calculate then does the rest
|
tomwalters@0
|
28
|
tomwalters@0
|
29 oldoptions=handles.all_options;
|
tomwalters@0
|
30 parfile=handles.info.parameterfilename;
|
tomwalters@0
|
31
|
tomwalters@0
|
32 olddir=pwd;
|
tomwalters@0
|
33 [pathstr,name,ext] = fileparts(parfile);
|
tomwalters@0
|
34 cd(pathstr);
|
tomwalters@0
|
35 eval(name); % here it is evaluated
|
tomwalters@0
|
36 cd(olddir);
|
tomwalters@0
|
37 if handles.with_graphic==1
|
tomwalters@0
|
38 waitbar(0.2,wbh);
|
tomwalters@0
|
39 end
|
tomwalters@0
|
40 %
|
tomwalters@0
|
41 % wo=strfind(parfile,'.m');
|
tomwalters@0
|
42 % if ~isempty(wo)
|
tomwalters@0
|
43 % parfile=parfile(1:wo-1);
|
tomwalters@0
|
44 % end
|
tomwalters@0
|
45 %
|
tomwalters@0
|
46 % [a,b,c]=fileparts(parfile);
|
tomwalters@0
|
47 % cd(a);
|
tomwalters@0
|
48 % parfile=parfile(strfind(parfile,'/')+1:end);
|
tomwalters@0
|
49 % eval(parfile);
|
tomwalters@0
|
50 % cd ..
|
tomwalters@0
|
51 newoptions=all_options;
|
tomwalters@0
|
52
|
tomwalters@0
|
53 % compare the old and the new parameters to see, what must be changed
|
tomwalters@0
|
54 if ~structisequal(oldoptions.pcp,newoptions.pcp)
|
tomwalters@0
|
55 set(handles.checkbox0,'Value',1);
|
tomwalters@0
|
56 handles.info.calculate_pcp=1;
|
tomwalters@0
|
57 else
|
tomwalters@0
|
58 set(handles.checkbox0,'Value',0);
|
tomwalters@0
|
59 handles.info.calculate_pcp=0;
|
tomwalters@0
|
60 end
|
tomwalters@0
|
61 if handles.with_graphic==1
|
tomwalters@0
|
62 waitbar(0.3,wbh);
|
tomwalters@0
|
63 end
|
tomwalters@0
|
64 if ~structisequal(oldoptions.bmm,newoptions.bmm)
|
tomwalters@0
|
65 set(handles.checkbox1,'Value',1);
|
tomwalters@0
|
66 handles.info.calculate_bmm=1;
|
tomwalters@0
|
67 else
|
tomwalters@0
|
68 set(handles.checkbox1,'Value',0);
|
tomwalters@0
|
69 handles.info.calculate_bmm=0;
|
tomwalters@0
|
70 end
|
tomwalters@0
|
71 if handles.with_graphic==1
|
tomwalters@0
|
72 waitbar(0.4,wbh);
|
tomwalters@0
|
73 end
|
tomwalters@0
|
74 if ~structisequal(oldoptions.nap,newoptions.nap)
|
tomwalters@0
|
75 set(handles.checkbox2,'Value',1);
|
tomwalters@0
|
76 handles.info.calculate_nap=1;
|
tomwalters@0
|
77 else
|
tomwalters@0
|
78 set(handles.checkbox2,'Value',0);
|
tomwalters@0
|
79 handles.info.calculate_nap=0;
|
tomwalters@0
|
80 end
|
tomwalters@0
|
81 if handles.with_graphic==1
|
tomwalters@0
|
82 waitbar(0.5,wbh);
|
tomwalters@0
|
83 end
|
tomwalters@0
|
84 if ~structisequal(oldoptions.strobes,newoptions.strobes)
|
tomwalters@0
|
85 set(handles.checkbox3,'Value',1);
|
tomwalters@0
|
86 handles.info.calculate_strobes=1;
|
tomwalters@0
|
87 else
|
tomwalters@0
|
88 set(handles.checkbox3,'Value',0);
|
tomwalters@0
|
89 handles.info.calculate_strobes=0;
|
tomwalters@0
|
90 end
|
tomwalters@0
|
91 if handles.with_graphic==1
|
tomwalters@0
|
92 waitbar(0.6,wbh);
|
tomwalters@0
|
93 end
|
tomwalters@0
|
94 if ~structisequal(oldoptions.sai,newoptions.sai)
|
tomwalters@0
|
95 set(handles.checkbox4,'Value',1);
|
tomwalters@0
|
96 handles.info.calculate_sai=1;
|
tomwalters@0
|
97 else
|
tomwalters@0
|
98 set(handles.checkbox4,'Value',0);
|
tomwalters@0
|
99 handles.info.calculate_sai=0;
|
tomwalters@0
|
100 end
|
tomwalters@0
|
101 if handles.with_graphic==1
|
tomwalters@0
|
102 waitbar(0.7,wbh);
|
tomwalters@0
|
103 end
|
tomwalters@0
|
104 if ~structisequal(oldoptions.usermodule,newoptions.usermodule)
|
tomwalters@0
|
105 set(handles.checkbox8,'Value',1);
|
tomwalters@0
|
106 handles.info.calculate_usermodule=1;
|
tomwalters@0
|
107 else
|
tomwalters@0
|
108 set(handles.checkbox8,'Value',0);
|
tomwalters@0
|
109 handles.info.calculate_usermodule=0;
|
tomwalters@0
|
110 end
|
tomwalters@0
|
111 % if ~structisequal(oldoptions.movie,newoptions.movie)
|
tomwalters@0
|
112 % set(handles.checkbox5,'Value',1);
|
tomwalters@0
|
113 % handles.info.calculate_movie=1;
|
tomwalters@0
|
114 % else
|
tomwalters@0
|
115 % set(handles.checkbox5,'Value',0);
|
tomwalters@0
|
116 % handles.info.calculate_movie=0;
|
tomwalters@0
|
117 % end
|
tomwalters@0
|
118
|
tomwalters@0
|
119 if handles.with_graphic==1
|
tomwalters@0
|
120 waitbar(0.8,wbh);
|
tomwalters@0
|
121 end
|
tomwalters@0
|
122 % check, if the signal time has changed, if, redo everything!
|
tomwalters@0
|
123 changesig=0;
|
tomwalters@0
|
124 if oldoptions.signal.start_time~=newoptions.signal.start_time
|
tomwalters@0
|
125 changesig=1;
|
tomwalters@0
|
126 end
|
tomwalters@0
|
127 if oldoptions.signal.duration~=newoptions.signal.duration
|
tomwalters@0
|
128 changesig=1;
|
tomwalters@0
|
129 end
|
tomwalters@0
|
130 if oldoptions.signal.samplerate~=newoptions.signal.samplerate
|
tomwalters@0
|
131 changesig=1;
|
tomwalters@0
|
132 end
|
tomwalters@0
|
133
|
tomwalters@0
|
134 % if ~structisequal(oldoptions.signal,newoptions.signal)
|
tomwalters@0
|
135 if changesig==1
|
tomwalters@0
|
136 new_duration=newoptions.signal.duration;
|
tomwalters@0
|
137 new_start_time=newoptions.signal.start_time;
|
tomwalters@0
|
138 new_sr=newoptions.signal.samplerate;
|
tomwalters@0
|
139
|
tomwalters@0
|
140 % if new_start_time+new_duration>handles.all_options.signal.original_duration
|
tomwalters@0
|
141 % error('fehler in do_aim_updateparameters ');
|
tomwalters@0
|
142 % end
|
tomwalters@0
|
143
|
tomwalters@0
|
144
|
tomwalters@0
|
145 if handles.info.pcp_loaded==1
|
tomwalters@0
|
146 set(handles.checkbox0,'Value',1);
|
tomwalters@0
|
147 handles.info.calculate_pcp=1;
|
tomwalters@0
|
148 end
|
tomwalters@0
|
149 if handles.info.bmm_loaded==1
|
tomwalters@0
|
150 set(handles.checkbox1,'Value',1);
|
tomwalters@0
|
151 handles.info.calculate_bmm=1;
|
tomwalters@0
|
152 end
|
tomwalters@0
|
153 if handles.info.nap_loaded==1
|
tomwalters@0
|
154 set(handles.checkbox2,'Value',1);
|
tomwalters@0
|
155 handles.info.calculate_nap=1;
|
tomwalters@0
|
156 end
|
tomwalters@0
|
157 if handles.info.strobes_loaded==1
|
tomwalters@0
|
158 set(handles.checkbox3,'Value',1);
|
tomwalters@0
|
159 handles.info.calculate_strobes=1;
|
tomwalters@0
|
160 end
|
tomwalters@0
|
161 if handles.info.sai_loaded==1
|
tomwalters@0
|
162 set(handles.checkbox4,'Value',1);
|
tomwalters@0
|
163 handles.info.calculate_sai=1;
|
tomwalters@0
|
164 end
|
tomwalters@0
|
165 if handles.info.usermodule_loaded==1
|
tomwalters@0
|
166 set(handles.checkbox8,'Value',1);
|
tomwalters@0
|
167 handles.info.calculate_usermodule=1;
|
tomwalters@0
|
168 end
|
tomwalters@0
|
169 if handles.info.movie_loaded==1
|
tomwalters@0
|
170 set(handles.checkbox5,'Value',1);
|
tomwalters@0
|
171 handles.info.calculate_movie=1;
|
tomwalters@0
|
172 end
|
tomwalters@0
|
173 handles.info.calculate_signal=1;
|
tomwalters@0
|
174
|
tomwalters@0
|
175
|
tomwalters@0
|
176 % change the slider etc...
|
tomwalters@0
|
177 if new_duration>1
|
tomwalters@0
|
178 set(handles.displayduration,'String',num2str(fround(new_duration,2)));
|
tomwalters@0
|
179 set(handles.text20,'String','sec');
|
tomwalters@0
|
180 else
|
tomwalters@0
|
181 set(handles.displayduration,'String',num2str(fround(new_duration*1000,0)));
|
tomwalters@0
|
182 set(handles.text20,'String','ms');
|
tomwalters@0
|
183 end
|
tomwalters@0
|
184 % samplerate
|
tomwalters@0
|
185 set(handles.text25,'String',num2str(fround(new_sr/1000,1)));
|
tomwalters@0
|
186 % offset
|
tomwalters@0
|
187 if new_start_time>0
|
tomwalters@0
|
188 set(handles.text29,'String',num2str(fround(new_start_time*1000,1)));
|
tomwalters@0
|
189 set(handles.text29,'Visible','on');
|
tomwalters@0
|
190 set(handles.text30,'Visible','on');
|
tomwalters@0
|
191 else
|
tomwalters@0
|
192 set(handles.text29,'Visible','off');
|
tomwalters@0
|
193 set(handles.text30,'Visible','off');
|
tomwalters@0
|
194 end
|
tomwalters@0
|
195 handles.slideredit_start.minvalue=new_start_time;
|
tomwalters@0
|
196 handles.slideredit_start.maxvalue=new_start_time+new_duration-0.04;
|
tomwalters@0
|
197 handles.slideredit_start=slidereditcontrol_set_value(handles.slideredit_start,new_start_time);
|
tomwalters@0
|
198 handles.slideredit_start=slidereditcontrol_set_range(handles.slideredit_start,new_duration/10);
|
tomwalters@0
|
199
|
tomwalters@0
|
200 handles.slideredit_duration=slidereditcontrol_set_value(handles.slideredit_duration,0.04);
|
tomwalters@0
|
201 handles.slideredit_duration.maxvalue=new_duration;
|
tomwalters@0
|
202 handles.slideredit_duration=slidereditcontrol_set_range(handles.slideredit_duration,new_duration/10);
|
tomwalters@0
|
203
|
tomwalters@0
|
204 handles.currentslidereditcombi=handles.slideredit_start;
|
tomwalters@0
|
205
|
tomwalters@0
|
206 else
|
tomwalters@0
|
207 handles.info.calculate_signal=0;
|
tomwalters@0
|
208 end
|
tomwalters@0
|
209
|
tomwalters@0
|
210 if handles.with_graphic==1
|
tomwalters@0
|
211 waitbar(0.9,wbh);
|
tomwalters@0
|
212 end
|
tomwalters@0
|
213 % set the current info in handles to the current values
|
tomwalters@0
|
214 generating_module_string=get(handles.listbox0,'String');
|
tomwalters@0
|
215 generating_module=generating_module_string(get(handles.listbox0,'Value'));
|
tomwalters@0
|
216 if ~isfield(handles.info,'current_pcp_module') || ~strcmp(handles.info.current_pcp_module,generating_module{1})
|
tomwalters@0
|
217 handles.info.calculate_pcp=1;
|
tomwalters@0
|
218 set(handles.checkbox0,'Value',1);
|
tomwalters@0
|
219 end
|
tomwalters@0
|
220 handles.info.current_pcp_module=generating_module{1};
|
tomwalters@0
|
221
|
tomwalters@0
|
222 generating_module_string=get(handles.listbox1,'String');
|
tomwalters@0
|
223 generating_module=generating_module_string(get(handles.listbox1,'Value'));
|
tomwalters@0
|
224 if ~isfield(handles.info,'current_bmm_module') || ~strcmp(handles.info.current_bmm_module,generating_module{1})
|
tomwalters@0
|
225 handles.info.calculate_bmm=1;
|
tomwalters@0
|
226 set(handles.checkbox1,'Value',1);
|
tomwalters@0
|
227 end
|
tomwalters@0
|
228 handles.info.current_bmm_module=generating_module{1};
|
tomwalters@0
|
229
|
tomwalters@0
|
230 generating_module_string=get(handles.listbox2,'String');
|
tomwalters@0
|
231 generating_module=generating_module_string(get(handles.listbox2,'Value'));
|
tomwalters@0
|
232 if ~isfield(handles.info,'current_nap_module') || ~strcmp(handles.info.current_nap_module,generating_module{1})
|
tomwalters@0
|
233 handles.info.calculate_nap=1;
|
tomwalters@0
|
234 set(handles.checkbox2,'Value',1);
|
tomwalters@0
|
235 end
|
tomwalters@0
|
236 handles.info.current_nap_module=generating_module{1};
|
tomwalters@0
|
237
|
tomwalters@0
|
238 generating_module_string=get(handles.listbox3,'String');
|
tomwalters@0
|
239 generating_module=generating_module_string(get(handles.listbox3,'Value'));
|
tomwalters@0
|
240 if ~isfield(handles.info,'current_strobes_module') || ~strcmp(handles.info.current_strobes_module,generating_module{1})
|
tomwalters@0
|
241 handles.info.calculate_strobes=1;
|
tomwalters@0
|
242 set(handles.checkbox3,'Value',1);
|
tomwalters@0
|
243 end
|
tomwalters@0
|
244 handles.info.current_strobes_module=generating_module{1};
|
tomwalters@0
|
245
|
tomwalters@0
|
246 generating_module_string=get(handles.listbox4,'String');
|
tomwalters@0
|
247 generating_module=generating_module_string(get(handles.listbox4,'Value'));
|
tomwalters@0
|
248 if ~isfield(handles.info,'current_sai_module') || ~strcmp(handles.info.current_sai_module,generating_module{1})
|
tomwalters@0
|
249 handles.info.calculate_sai=1;
|
tomwalters@0
|
250 set(handles.checkbox4,'Value',1);
|
tomwalters@0
|
251 end
|
tomwalters@0
|
252 handles.info.current_sai_module=generating_module{1};
|
tomwalters@0
|
253
|
tomwalters@0
|
254 generating_module_string=get(handles.listbox6,'String');
|
tomwalters@0
|
255 generating_module=generating_module_string(get(handles.listbox6,'Value'));
|
tomwalters@0
|
256 if ~isfield(handles.info,'current_usermodule_module') || ~strcmp(handles.info.current_usermodule_module,generating_module{1})
|
tomwalters@0
|
257 handles.info.calculate_usermodule=1;
|
tomwalters@0
|
258 set(handles.checkbox8,'Value',1);
|
tomwalters@0
|
259 end
|
tomwalters@0
|
260 handles.info.current_usermodule_module=generating_module{1};
|
tomwalters@0
|
261
|
tomwalters@0
|
262 generating_module_string=get(handles.listbox5,'String');
|
tomwalters@0
|
263 generating_module=generating_module_string(get(handles.listbox5,'Value'));
|
tomwalters@0
|
264 if ~isfield(handles.info,'current_movie_module') || ~strcmp(handles.info.current_movie_module,generating_module{1})
|
tomwalters@0
|
265 handles.info.calculate_movie=1;
|
tomwalters@0
|
266 set(handles.checkbox5,'Value',1);
|
tomwalters@0
|
267 end
|
tomwalters@0
|
268 handles.info.current_movie_module=generating_module{1};
|
tomwalters@0
|
269
|
tomwalters@0
|
270
|
tomwalters@0
|
271 % put some additional information in the info-domain
|
tomwalters@0
|
272 handles.info.save_pcp=1;
|
tomwalters@0
|
273 handles.info.save_bmm=1;
|
tomwalters@0
|
274 handles.info.save_nap=1;
|
tomwalters@0
|
275 handles.info.save_sai=1;
|
tomwalters@0
|
276 handles.info.save_strobes=1;
|
tomwalters@0
|
277 handles.info.save_usermodule=1;
|
tomwalters@0
|
278 handles.info.save_movie=1;
|
tomwalters@0
|
279
|
tomwalters@0
|
280
|
tomwalters@0
|
281 % and update the new parameters
|
tomwalters@0
|
282 handles.all_options=newoptions;
|
tomwalters@0
|
283
|
tomwalters@0
|
284 if handles.with_graphic==1
|
tomwalters@0
|
285 waitbar(1,wbh);
|
tomwalters@0
|
286 close(wbh);
|
tomwalters@0
|
287 set(handles.figure1,'Pointer','arrow');
|
tomwalters@0
|
288 end |