tomwalters@0
|
1 % procedure for 'aim-mat'
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % INPUT VALUES:
|
tomwalters@0
|
4 % the new soundfilename
|
tomwalters@0
|
5 % RETURN VALUE:
|
tomwalters@0
|
6 % the updated handles
|
tomwalters@0
|
7 %
|
tomwalters@0
|
8 % changes the soundfile and updates
|
tomwalters@0
|
9 %
|
bleeck@3
|
10 %
|
tomwalters@0
|
11 % (c) 2011, University of Southampton
|
bleeck@3
|
12 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
13 % download of current version is on the soundsoftware site:
|
bleeck@3
|
14 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
15 % documentation and everything is on http://www.acousticscale.org
|
bleeck@3
|
16
|
bleeck@3
|
17
|
tomwalters@0
|
18
|
tomwalters@0
|
19
|
tomwalters@0
|
20 function handles=aim_exchange_sound_file(handles,signame)
|
tomwalters@0
|
21 % exchanges the sound file and keeps the parameters
|
tomwalters@0
|
22 % this works by deleting the directory
|
tomwalters@0
|
23 % saving the parameter file under new name
|
tomwalters@0
|
24 % recalculation of all stages up to the chosen one
|
tomwalters@0
|
25
|
tomwalters@0
|
26 % save some old values
|
tomwalters@0
|
27 oldhandles=handles;
|
tomwalters@0
|
28 slider_start=handles.slideredit_start;
|
tomwalters@0
|
29 slider_duration=handles.slideredit_duration;
|
tomwalters@0
|
30 slider_scale=handles.slideredit_scale;
|
tomwalters@0
|
31 slider_combi=handles.currentslidereditcombi;
|
tomwalters@0
|
32 slider_frames=handles.slideredit_frames;
|
tomwalters@0
|
33
|
tomwalters@0
|
34
|
tomwalters@0
|
35 handles=setupnames(handles,signame);
|
tomwalters@0
|
36 dirname=handles.info.directoryname;
|
tomwalters@0
|
37
|
tomwalters@0
|
38
|
tomwalters@0
|
39 loadswitch=0;
|
tomwalters@0
|
40 if exist(dirname)~=7 % is not a directory so far
|
tomwalters@0
|
41 % load the project
|
tomwalters@0
|
42 handles=init_aim_parameters(handles,signame);
|
tomwalters@0
|
43 loadswitch=1;
|
tomwalters@0
|
44 end
|
tomwalters@0
|
45
|
tomwalters@0
|
46 % if exist(dirname)==7 % is a directory with a project in (hopefully)
|
tomwalters@0
|
47 wave_switch=get(handles.checkbox10,'Value');
|
tomwalters@0
|
48 spectral_switch=get(handles.checkbox6,'Value');
|
tomwalters@0
|
49 temporal_switch=get(handles.checkbox7,'Value');
|
tomwalters@0
|
50
|
tomwalters@0
|
51 % copy the project-file to the new directory:
|
tomwalters@0
|
52 oldpfile=fullfile(pwd,oldhandles.info.projectfilename);
|
tomwalters@0
|
53 newpfile=fullfile(pwd,handles.info.projectfilename);
|
tomwalters@0
|
54 try
|
tomwalters@0
|
55 copyfile(oldpfile,newpfile);
|
tomwalters@0
|
56 catch
|
tomwalters@0
|
57 what=0;
|
tomwalters@0
|
58 end
|
tomwalters@0
|
59
|
tomwalters@0
|
60 if loadswitch==0
|
tomwalters@0
|
61 % load the project
|
tomwalters@0
|
62 handles=init_aim_parameters(handles,signame);
|
tomwalters@0
|
63 end
|
tomwalters@0
|
64
|
tomwalters@0
|
65 tempinfo=handles.info;
|
tomwalters@0
|
66 % the signal options have been overwritten, so set them back:
|
tomwalters@0
|
67 handles.all_options.signal.start_time=oldhandles.all_options.signal.start_time;
|
tomwalters@0
|
68 handles.all_options.signal.duration=oldhandles.all_options.signal.duration;
|
tomwalters@0
|
69 handles.all_options.signal.samplerate=oldhandles.all_options.signal.samplerate;
|
tomwalters@0
|
70 handles=init_aim_gui(handles);
|
tomwalters@0
|
71
|
tomwalters@0
|
72 tempoptions=handles.all_options;
|
tomwalters@0
|
73 % tempinfo=handles.info;
|
tomwalters@0
|
74
|
tomwalters@0
|
75 % copy the parameter file to the new directory
|
tomwalters@0
|
76 oldpfile=fullfile(pwd,oldhandles.info.parameterfilename);
|
tomwalters@0
|
77 newpfile=fullfile(pwd,handles.info.parameterfilename);
|
tomwalters@0
|
78 try
|
tomwalters@0
|
79 copyfile(oldpfile,newpfile);
|
tomwalters@0
|
80 catch
|
tomwalters@0
|
81 disp('error in aim_exchange_sound_file: parameter file could not be copied');
|
tomwalters@0
|
82 end
|
tomwalters@0
|
83
|
tomwalters@0
|
84 % handles.info.current_pcp_module=
|
tomwalters@0
|
85 handles=do_aim_updateparameters(handles);
|
tomwalters@0
|
86
|
tomwalters@0
|
87 % set the current modules to the new ones, and set ticks if neccessary:
|
tomwalters@0
|
88 handles=setselection(handles,'pcp',oldhandles.info.current_pcp_module);
|
tomwalters@0
|
89 handles=setselection(handles,'bmm',oldhandles.info.current_bmm_module);
|
tomwalters@0
|
90 handles=setselection(handles,'nap',oldhandles.info.current_nap_module);
|
tomwalters@0
|
91 handles=setselection(handles,'strobes',oldhandles.info.current_strobes_module);
|
tomwalters@0
|
92 handles=setselection(handles,'sai',oldhandles.info.current_sai_module);
|
tomwalters@0
|
93 handles=setselection(handles,'usermodule',oldhandles.info.current_usermodule_module);
|
tomwalters@0
|
94 handles=setselection(handles,'movie',oldhandles.info.current_movie_module);
|
tomwalters@0
|
95
|
tomwalters@0
|
96 % handles=init_aim_gui(handles);
|
tomwalters@0
|
97
|
tomwalters@0
|
98 changepcp=get(handles.checkbox0,'Value') || handles.info.calculate_pcp;
|
tomwalters@0
|
99 changebmm=get(handles.checkbox1,'Value')|| handles.info.calculate_bmm;
|
tomwalters@0
|
100 changenap=get(handles.checkbox2,'Value')|| handles.info.calculate_nap;
|
tomwalters@0
|
101 changestrobes=get(handles.checkbox3,'Value')|| handles.info.calculate_strobes;
|
tomwalters@0
|
102 changesai=get(handles.checkbox4,'Value')|| handles.info.calculate_sai;
|
tomwalters@0
|
103 changeusermodule=get(handles.checkbox8,'Value')|| handles.info.calculate_usermodule;
|
tomwalters@0
|
104 changemovie=get(handles.checkbox5,'Value')|| handles.info.calculate_movie;
|
tomwalters@0
|
105 if oldhandles.info.pcp_loaded==1 && (handles.info.pcp_loaded==0 || changepcp==1)
|
tomwalters@0
|
106 handles.info.calculate_pcp=1;
|
tomwalters@0
|
107 changepcp=1;
|
tomwalters@0
|
108 set(handles.checkbox0,'Value',1);
|
tomwalters@0
|
109 end
|
tomwalters@0
|
110 if oldhandles.info.bmm_loaded==1 && (handles.info.bmm_loaded==0 || changebmm==1 || (handles.info.bmm_loaded==1 && changepcp==1))
|
tomwalters@0
|
111 handles.info.calculate_bmm=1;
|
tomwalters@0
|
112 changebmm=1;
|
tomwalters@0
|
113 set(handles.checkbox1,'Value',1);
|
tomwalters@0
|
114 end
|
tomwalters@0
|
115 if oldhandles.info.nap_loaded==1 && (handles.info.nap_loaded==0 || changenap==1 || (handles.info.nap_loaded==1 && changebmm==1))
|
tomwalters@0
|
116 handles.info.calculate_nap=1;
|
tomwalters@0
|
117 changenap=1;
|
tomwalters@0
|
118 set(handles.checkbox2,'Value',1);
|
tomwalters@0
|
119 end
|
tomwalters@0
|
120 if oldhandles.info.strobes_loaded==1 && (handles.info.strobes_loaded==0 || changestrobes==1|| (handles.info.strobes_loaded==1 && changenap==1))
|
tomwalters@0
|
121 handles.info.calculate_strobes=1;
|
tomwalters@0
|
122 changestrobes=1;
|
tomwalters@0
|
123 set(handles.checkbox3,'Value',1);
|
tomwalters@0
|
124 end
|
tomwalters@0
|
125 if oldhandles.info.sai_loaded==1 && (handles.info.sai_loaded==0 || changesai==1|| (handles.info.sai_loaded==1 && changestrobes==1))
|
tomwalters@0
|
126 handles.info.calculate_sai=1;
|
tomwalters@0
|
127 changesai=1;
|
tomwalters@0
|
128 set(handles.checkbox4,'Value',1);
|
tomwalters@0
|
129 end
|
tomwalters@0
|
130 if oldhandles.info.usermodule_loaded==1 && (handles.info.usermodule_loaded==0 || changeusermodule==1 || (handles.info.usermodule_loaded==1 && changesai==1))
|
tomwalters@0
|
131 handles.info.calculate_usermodule=1;
|
tomwalters@0
|
132 changeusermodule=1;
|
tomwalters@0
|
133 set(handles.checkbox8,'Value',1);
|
tomwalters@0
|
134 end
|
tomwalters@0
|
135 if oldhandles.info.movie_loaded==1 && (handles.info.movie_loaded==0 || changemovie==1 || (handles.info.movie_loaded==1 && changesai==1))
|
tomwalters@0
|
136 handles.info.calculate_movie=1;
|
tomwalters@0
|
137 changemovie=1;
|
tomwalters@0
|
138 set(handles.checkbox5,'Value',1);
|
tomwalters@0
|
139 end
|
tomwalters@0
|
140
|
tomwalters@0
|
141 % if the new project has more columns active then the old one, then
|
tomwalters@0
|
142 % delete the surplus
|
tomwalters@0
|
143 if oldhandles.info.pcp_loaded ==0
|
tomwalters@0
|
144 handles=aim_deletefile(handles,'pcp');
|
tomwalters@0
|
145 end
|
tomwalters@0
|
146 if oldhandles.info.bmm_loaded ==0
|
tomwalters@0
|
147 handles=aim_deletefile(handles,'bmm');
|
tomwalters@0
|
148 end
|
tomwalters@0
|
149 if oldhandles.info.nap_loaded ==0
|
tomwalters@0
|
150 handles=aim_deletefile(handles,'nap');
|
tomwalters@0
|
151 end
|
tomwalters@0
|
152 if oldhandles.info.strobes_loaded==0
|
tomwalters@0
|
153 handles=aim_deletefile(handles,'strobes');
|
tomwalters@0
|
154 end
|
tomwalters@0
|
155 if oldhandles.info.sai_loaded==0
|
tomwalters@0
|
156 handles=aim_deletefile(handles,'sai');
|
tomwalters@0
|
157 end
|
tomwalters@0
|
158 if oldhandles.info.usermodule_loaded==0
|
tomwalters@0
|
159 handles=aim_deletefile(handles,'usermodule');
|
tomwalters@0
|
160 end
|
tomwalters@0
|
161
|
tomwalters@0
|
162
|
tomwalters@0
|
163 handles=do_aim_calculate(handles);
|
tomwalters@0
|
164
|
tomwalters@0
|
165 % reset the signal options to the new ones:
|
tomwalters@0
|
166 handles.all_options.signal=tempoptions.signal;
|
tomwalters@0
|
167 handles=aim_saveparameters(handles,handles.info.parameterfilename,1);
|
tomwalters@0
|
168
|
tomwalters@0
|
169
|
tomwalters@0
|
170 % force the sliders to the same values as before:
|
tomwalters@0
|
171 handles.slideredit_start=slider_start;
|
tomwalters@0
|
172 handles.slideredit_duration=slider_duration;
|
tomwalters@0
|
173 handles.slideredit_scale=slider_scale;
|
tomwalters@0
|
174 handles.currentslidereditcombi=slider_combi;
|
tomwalters@0
|
175 handles.slideredit_frames=slider_frames;
|
tomwalters@0
|
176
|
tomwalters@0
|
177 set(handles.checkbox10,'Value',wave_switch);
|
tomwalters@0
|
178 set(handles.checkbox6,'Value',spectral_switch);
|
tomwalters@0
|
179 set(handles.checkbox7,'Value',temporal_switch);
|
tomwalters@0
|
180
|
tomwalters@0
|
181 return
|
tomwalters@0
|
182
|
tomwalters@0
|
183
|
tomwalters@0
|
184 function handles=setselection(handles,selstr,curmod)
|
tomwalters@0
|
185 switch selstr
|
tomwalters@0
|
186 case('pcp')
|
tomwalters@0
|
187 hand=handles.listbox0;
|
tomwalters@0
|
188 hand2=handles.checkbox0;
|
tomwalters@0
|
189 oldnam=handles.info.current_pcp_module;
|
tomwalters@0
|
190 handles.info.current_pcp_module=curmod;
|
tomwalters@0
|
191 case('bmm')
|
tomwalters@0
|
192 hand=handles.listbox1;
|
tomwalters@0
|
193 hand2=handles.checkbox1;
|
tomwalters@0
|
194 oldnam=handles.info.current_bmm_module;
|
tomwalters@0
|
195 handles.info.current_bmm_module=curmod;
|
tomwalters@0
|
196 case('nap')
|
tomwalters@0
|
197 hand=handles.listbox2;
|
tomwalters@0
|
198 hand2=handles.checkbox2;
|
tomwalters@0
|
199 oldnam=handles.info.current_nap_module;
|
tomwalters@0
|
200 handles.info.current_nap_module=curmod;
|
tomwalters@0
|
201 case('strobes')
|
tomwalters@0
|
202 hand=handles.listbox3;
|
tomwalters@0
|
203 hand2=handles.checkbox3;
|
tomwalters@0
|
204 oldnam=handles.info.current_strobes_module;
|
tomwalters@0
|
205 handles.info.current_strobes_module=curmod;
|
tomwalters@0
|
206 case('sai')
|
tomwalters@0
|
207 hand=handles.listbox4;
|
tomwalters@0
|
208 hand2=handles.checkbox4;
|
tomwalters@0
|
209 oldnam=handles.info.current_sai_module;
|
tomwalters@0
|
210 handles.info.current_sai_module=curmod;
|
tomwalters@0
|
211 case('usermodule')
|
tomwalters@0
|
212 hand=handles.listbox6;
|
tomwalters@0
|
213 hand2=handles.checkbox8;
|
tomwalters@0
|
214 oldnam=handles.info.current_usermodule_module;
|
tomwalters@0
|
215 handles.info.current_usermodule_module=curmod;
|
tomwalters@0
|
216 case('movie')
|
tomwalters@0
|
217 hand=handles.listbox5;
|
tomwalters@0
|
218 hand2=handles.checkbox5;
|
tomwalters@0
|
219 oldnam=handles.info.current_movie_module;
|
tomwalters@0
|
220 handles.info.current_movie_module=curmod;
|
tomwalters@0
|
221 end
|
tomwalters@0
|
222 % it the new module is different from the old one, then set the tick
|
tomwalters@0
|
223 if ~strcmp(oldnam,curmod)
|
tomwalters@0
|
224 set(hand2,'Value',1);
|
tomwalters@0
|
225 end
|
tomwalters@0
|
226
|
tomwalters@0
|
227 names=get(hand,'String');
|
tomwalters@0
|
228 for i=1:length(names)
|
tomwalters@0
|
229 if strcmp(names{i},curmod)
|
tomwalters@0
|
230 set(hand,'Value',i);
|
tomwalters@0
|
231 return
|
tomwalters@0
|
232 end
|
tomwalters@0
|
233 end
|
tomwalters@0
|
234 return
|