tomwalters@0: % procedure for 'aim-mat' tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % handles : all relevant parameters tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % reset the graphic and everything in the GUI tomwalters@0: % tomwalters@0: % bleeck@3: % tomwalters@0: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: function handles=init_aim_gui(handles) tomwalters@0: tomwalters@0: % TCW AIM2006 tomwalters@0: handles.hand_scaling=1; tomwalters@0: tomwalters@0: modus=handles.screen_modus; tomwalters@0: tomwalters@0: switch modus tomwalters@0: case 'screen' tomwalters@0: % set some colors: (green for display) tomwalters@0: %handles.colors.background=[0 .502 0]; %Old AIM tomwalters@0: handles.colors.background=[236/255 233/255 240/255]; tomwalters@0: handles.colors.green1=[0 0.75 0]; tomwalters@0: handles.colors.green2=[0 1 0]; tomwalters@0: handles.colors.blue2=[0 0 1]; tomwalters@0: handles.colors.blue1=[0.5 0 0]; tomwalters@0: handles.colors.white=[1 1 1]; tomwalters@0: handles.colors.black=[0 0 0]; tomwalters@0: handles.colors.blue3=[0 0.5 0.5]; tomwalters@0: handles.colors.textonbackground=handles.colors.black; tomwalters@0: handles.colors.textonbuttons=handles.colors.black; tomwalters@0: handles.colors.buttoncolor=[0.831 0.816 0.784]; tomwalters@0: case 'paper' tomwalters@0: % set some colors: (gray for publication) tomwalters@0: handles.colors.background=[0.83 0.83 0.83]; tomwalters@0: handles.colors.green1=[0.75 0.75 0.75]; tomwalters@0: handles.colors.green2=[0.6 0.6 0.6]; tomwalters@0: handles.colors.blue2=[0.5 0.5 0.5]; tomwalters@0: handles.colors.blue1=[0.4 0.4 0.4]; tomwalters@0: handles.colors.white=[1 1 1]; tomwalters@0: handles.colors.black=[0 0 0]; tomwalters@0: handles.colors.blue3=[0.8 0.8 0.8]; tomwalters@0: handles.colors.textonbackground=handles.colors.black; tomwalters@0: handles.colors.textonbuttons=handles.colors.white; tomwalters@0: handles.colors.buttoncolor=handles.colors.green1; tomwalters@0: end tomwalters@0: tomwalters@0: set(handles.figure1,'Color',handles.colors.background); tomwalters@0: set(handles.text23,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text23,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text19,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text19,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text17,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text17,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.displayduration,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.displayduration,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text20,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text20,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text28,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text28,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text29,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text29,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text30,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text30,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text27,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text27,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text25,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text25,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text24,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text24,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text9,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text9,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text10,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text10,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text8,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text8,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text7,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text7,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text21,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text21,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text22,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text22,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.text13,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.text13,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: tomwalters@0: set(handles.frame16,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame15,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame18,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame17,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame17,'ForegroundColor',handles.colors.black); tomwalters@0: set(handles.frame14,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame14,'ForegroundColor',handles.colors.black); tomwalters@0: set(handles.frame19,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame19,'ForegroundColor',handles.colors.background); tomwalters@0: tomwalters@0: set(handles.frame7,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.frame10,'BackgroundColor',handles.colors.blue3); tomwalters@0: tomwalters@0: set(handles.checkbox10,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox10,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.checkbox6,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox6,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: set(handles.checkbox7,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox7,'ForegroundColor',handles.colors.textonbackground); tomwalters@0: tomwalters@0: set(handles.checkbox0,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox1,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox2,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox3,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox4,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox8,'BackgroundColor',handles.colors.background); tomwalters@0: set(handles.checkbox5,'BackgroundColor',handles.colors.blue3); tomwalters@0: tomwalters@0: set(handles.pushbutton24,'BackgroundColor',handles.colors.buttoncolor); tomwalters@0: set(handles.pushbutton25,'BackgroundColor',handles.colors.buttoncolor); tomwalters@0: set(handles.pushbuttonautoscale,'BackgroundColor',handles.colors.buttoncolor); tomwalters@0: set(handles.slider1,'BackgroundColor',handles.colors.buttoncolor); tomwalters@0: set(handles.slider2,'BackgroundColor',handles.colors.buttoncolor); tomwalters@0: set(handles.slider3,'BackgroundColor',handles.colors.buttoncolor); tomwalters@0: tomwalters@0: tomwalters@0: % % % first load the default values from the default parameter file: tomwalters@0: % handles=loadallparameterfiles(handles); tomwalters@0: all_options=handles.all_options; tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% PCP tomwalters@0: pcpnames = fieldnames(all_options.pcp); tomwalters@0: finalpcpnames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: tomwalters@0: % TCW AIM2006 Reorder the list so that the default value comes first tomwalters@0: for i=1:length(pcpnames) tomwalters@0: if strcmp(pcpnames{i},handles.info.default_start_module_pcp) tomwalters@0: finalpcpnames=[pcpnames(i) finalpcpnames]; tomwalters@0: else tomwalters@0: finalpcpnames=[finalpcpnames pcpnames(i)]; tomwalters@0: end tomwalters@0: end tomwalters@0: %%% tomwalters@0: tomwalters@0: for i=1:length(finalpcpnames) tomwalters@0: if strcmp(finalpcpnames{i},handles.info.default_start_module_pcp) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_pcp_module') tomwalters@0: if strcmp(finalpcpnames{i},handles.info.init.calculated_pcp_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: set(handles.listbox0,'String',finalpcpnames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_pcp_module=finalpcpnames{findold}; tomwalters@0: set(handles.listbox0,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_pcp_module=finalpcpnames{finddefault}; tomwalters@0: set(handles.listbox0,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_pcp_module=finddefault; tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% BMM tomwalters@0: bmmnames = fieldnames(all_options.bmm); tomwalters@0: finalbmmnames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: % TCW AIM2006 Reorder the list so that the default value comes first tomwalters@0: for i=1:length(bmmnames) tomwalters@0: if strcmp(bmmnames{i},handles.info.default_start_module_bmm) tomwalters@0: finalbmmnames=[bmmnames(i) finalbmmnames]; tomwalters@0: else tomwalters@0: finalbmmnames=[finalbmmnames bmmnames(i)]; tomwalters@0: end tomwalters@0: end tomwalters@0: %%% tomwalters@0: tomwalters@0: for i=1:length(finalbmmnames) tomwalters@0: if strcmp(finalbmmnames{i},handles.info.default_start_module_bmm) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_bmm_module') tomwalters@0: if strcmp(finalbmmnames{i},handles.info.init.calculated_bmm_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: set(handles.listbox1,'String',finalbmmnames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_bmm_module=finalbmmnames{findold}; tomwalters@0: set(handles.listbox1,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_bmm_module=finalbmmnames{finddefault}; tomwalters@0: set(handles.listbox1,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_bmm_module=finddefault; tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% NAP tomwalters@0: napnames = fieldnames(all_options.nap); tomwalters@0: finalnapnames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: % TCW AIM2006 Reorder the list so that the default value comes first tomwalters@0: for i=1:length(napnames) tomwalters@0: if strcmp(napnames{i},handles.info.default_start_module_nap) tomwalters@0: finalnapnames=[napnames(i) finalnapnames]; tomwalters@0: else tomwalters@0: finalnapnames=[finalnapnames napnames(i)]; tomwalters@0: end tomwalters@0: end tomwalters@0: %%% tomwalters@0: tomwalters@0: for i=1:length(finalnapnames) tomwalters@0: if strcmp(finalnapnames{i},handles.info.default_start_module_nap) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_nap_module') tomwalters@0: if strcmp(finalnapnames{i},handles.info.init.calculated_nap_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: set(handles.listbox2,'String',finalnapnames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_nap_module=finalnapnames{findold}; tomwalters@0: set(handles.listbox2,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_nap_module=finalnapnames{finddefault}; tomwalters@0: set(handles.listbox2,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_nap_module=finddefault; tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% STROBES tomwalters@0: strobesnames = fieldnames(all_options.strobes); tomwalters@0: finalstrobesnames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: tomwalters@0: % TCW AIM2006 Reorder the list so that the default value comes first tomwalters@0: for i=1:length(strobesnames) tomwalters@0: if strcmp(strobesnames{i},handles.info.default_start_module_strobes) tomwalters@0: finalstrobesnames=[strobesnames(i) finalstrobesnames]; tomwalters@0: else tomwalters@0: finalstrobesnames=[finalstrobesnames strobesnames(i)]; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: for i=1:length(finalstrobesnames) tomwalters@0: %finalstrobesnames=[finalstrobesnames strobesnames(i)]; tomwalters@0: % default value is sf2003: tomwalters@0: if strcmp(finalstrobesnames{i},handles.info.default_start_module_strobes) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: % if loaded from a project, set the settings to the loaded ones tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_strobes_module') tomwalters@0: if strcmp(finalstrobesnames{i},handles.info.init.calculated_strobes_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: set(handles.listbox3,'String',finalstrobesnames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_strobes_module=finalstrobesnames{findold}; tomwalters@0: set(handles.listbox3,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_strobes_module=finalstrobesnames{finddefault}; tomwalters@0: set(handles.listbox3,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_strobes_module=finddefault; tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% SAI tomwalters@0: sainames = fieldnames(all_options.sai); tomwalters@0: finalsainames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: tomwalters@0: % TCW AIM2006 Reorder the list so that the default value comes first tomwalters@0: for i=1:length(sainames) tomwalters@0: if strcmp(sainames{i},handles.info.default_start_module_sai) tomwalters@0: finalsainames=[sainames(i) finalsainames]; tomwalters@0: else tomwalters@0: finalsainames=[finalsainames sainames(i)]; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: for i=1:length(finalsainames) tomwalters@0: if strcmp(finalsainames{i},handles.info.default_start_module_sai) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_sai_module') tomwalters@0: if strcmp(finalsainames{i},handles.info.init.calculated_sai_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: set(handles.listbox4,'String',finalsainames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_sai_module=finalsainames{findold}; tomwalters@0: set(handles.listbox4,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_sai_module=finalsainames{finddefault}; tomwalters@0: set(handles.listbox4,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_sai_module=finddefault; tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% USERMODULES tomwalters@0: usermodulenames = fieldnames(all_options.usermodule); tomwalters@0: finalusermodulenames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: tomwalters@0: % TCW AIM2006 Reorder the list so that the default value comes first tomwalters@0: for i=1:length(usermodulenames) tomwalters@0: if strcmp(usermodulenames{i},handles.info.default_start_module_usermodule) tomwalters@0: finalusermodulenames=[usermodulenames(i) finalusermodulenames]; tomwalters@0: else tomwalters@0: finalusermodulenames=[finalusermodulenames usermodulenames(i)]; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: for i=1:length(finalusermodulenames) tomwalters@0: %finalusermodulenames=[finalusermodulenames usermodulenames(i)]; tomwalters@0: % default value is dualprofile: tomwalters@0: if strcmp(finalusermodulenames{i},handles.info.default_start_module_usermodule) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_usermodule_module') tomwalters@0: if strcmp(finalusermodulenames{i},handles.info.init.calculated_usermodule_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: end tomwalters@0: set(handles.listbox6,'String',finalusermodulenames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_usermodule_module=finalusermodulenames{findold}; tomwalters@0: set(handles.listbox6,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_usermodule_module=finalusermodulenames{finddefault}; tomwalters@0: set(handles.listbox6,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_usermodule_module=finddefault; tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: %%%%%%%%% MOVIES tomwalters@0: movienames = fieldnames(all_options.movie); tomwalters@0: finalmovienames=[]; tomwalters@0: finddefault=1; tomwalters@0: findold=-1; tomwalters@0: for i=1:length(movienames) tomwalters@0: finalmovienames=[finalmovienames movienames(i)]; tomwalters@0: % default value is dpai: tomwalters@0: if strcmp(finalmovienames{i},handles.info.default_start_module_movie) tomwalters@0: finddefault=i; tomwalters@0: end tomwalters@0: if isfield(handles.info,'init') tomwalters@0: if isfield(handles.info.init,'calculated_movie_module') tomwalters@0: if strcmp(finalmovienames{i},handles.info.init.calculated_movie_module) tomwalters@0: findold=i; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: end tomwalters@0: set(handles.listbox5,'String',finalmovienames); tomwalters@0: if findold>0 tomwalters@0: handles.info.current_movie_module=finalmovienames{findold}; tomwalters@0: set(handles.listbox5,'Value',findold); tomwalters@0: else tomwalters@0: handles.info.current_movie_module=finalmovienames{finddefault}; tomwalters@0: set(handles.listbox5,'Value',finddefault); tomwalters@0: end tomwalters@0: handles.info.defaults.default_movie_module=finddefault; tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: % set all calculation orders to false tomwalters@0: handles.info.calculate_signal=0; tomwalters@0: handles.info.calculate_pcp=0; tomwalters@0: handles.info.calculate_bmm=0; tomwalters@0: handles.info.calculate_nap=0; tomwalters@0: handles.info.calculate_strobes=0; tomwalters@0: handles.info.calculate_sai=0; tomwalters@0: handles.info.calculate_usermodule=0; tomwalters@0: handles.info.calculate_movie=0; tomwalters@0: tomwalters@0: % in the graphic version, store the results tomwalters@0: handles.info.save_signal=1; tomwalters@0: handles.info.save_pcp=1; tomwalters@0: handles.info.save_bmm=1; tomwalters@0: handles.info.save_nap=1; tomwalters@0: handles.info.save_strobes=1; tomwalters@0: handles.info.save_sai=1; tomwalters@0: handles.info.save_usermodule=1; tomwalters@0: handles.info.save_movie=1; tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: if isfield(handles.info,'init') tomwalters@0: set(handles.checkbox6,'Value',handles.info.init.hastime); tomwalters@0: set(handles.checkbox7,'Value',handles.info.init.hasfreq); tomwalters@0: set(handles.checkbox10,'Value',handles.info.init.hassignal); tomwalters@0: handles.info.old_current_plot=0; tomwalters@0: tomwalters@0: else tomwalters@0: % set the frequency profile off tomwalters@0: set(handles.checkbox6,'Value',0); tomwalters@0: % set the temporal profile off tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: % set the signal on tomwalters@0: set(handles.checkbox10,'Value',1); tomwalters@0: % set the current visible plot (the signal alone) tomwalters@0: handles.info.current_plot=-1; tomwalters@0: handles.info.old_current_plot=0; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: if isfield(handles.info,'init') tomwalters@0: duration=handles.info.init.duration; tomwalters@0: start_time=handles.info.init.start_time; tomwalters@0: scale=handles.info.init.scale; tomwalters@0: else tomwalters@0: duration=0.04; tomwalters@0: start_time=0; tomwalters@0: scale=1; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: sig=handles.data.signal; tomwalters@0: tomwalters@0: tomwalters@0: % set up the combicontrols tomwalters@0: handles.slideredit_start=slidereditcontrol_setup(... tomwalters@0: handles.slider2,... % handle of the slider tomwalters@0: handles.edit2,...% handle of the edit control tomwalters@0: getminimumtime(sig), ... % min value tomwalters@0: getmaximumtime(sig), ... % max value tomwalters@0: max(start_time,getminimumtime(sig)), ... % current value tomwalters@0: 0, ... % islog tomwalters@0: 1000, ...% multiplier on the edit control tomwalters@0: 1); % nr digits in the edit control after comma tomwalters@0: handles.slideredit_duration=slidereditcontrol_setup(... tomwalters@0: handles.slider3,... % handle of the slider tomwalters@0: handles.edit3,...% handle of the edit control tomwalters@0: 0.001, ... % min value tomwalters@0: getlength(sig), ... % max value tomwalters@0: duration, ... % current value tomwalters@0: 0, ... % islog tomwalters@0: 1000, ...% multiplier on the edit control tomwalters@0: 1); % nr digits in the edit control after comma tomwalters@0: handles.slideredit_scale=slidereditcontrol_setup(... tomwalters@0: handles.slider1,... % handle of the slider tomwalters@0: handles.edit1,...% handle of the edit control tomwalters@0: 0.001, ... % min value tomwalters@0: 1000, ... % max value tomwalters@0: scale, ... % current value tomwalters@0: 1, ... % islog tomwalters@0: 1, ...% multiplier on the edit control tomwalters@0: 3); % nr digits in the edit control after comma tomwalters@0: handles.slideredit_frames=slidereditcontrol_setup(... tomwalters@0: handles.slider2,... % handle of the slider tomwalters@0: handles.edit2,...% handle of the edit control tomwalters@0: 1, ... % min value tomwalters@0: 100, ... % max value tomwalters@0: start_time, ... % current value tomwalters@0: 0, ... % islog tomwalters@0: 1, ...% multiplier on the edit control tomwalters@0: 0); % nr digits in the edit control after comma tomwalters@0: tomwalters@0: current_plot=handles.info.current_plot; tomwalters@0: if current_plot<6 tomwalters@0: handles.currentslidereditcombi=handles.slideredit_start; tomwalters@0: else tomwalters@0: handles.slideredit_frames.maxvalue=length(handles.data.sai); tomwalters@0: handles.currentslidereditcombi=handles.slideredit_frames; tomwalters@0: % handles.currentslidereditcombi= tomwalters@0: end tomwalters@0: % handles.slideredit_scale=slidereditcontrol_set_value(handles.slideredit_scale,scale); tomwalters@0: % handles.slideredit_duration=slidereditcontrol_set_value(handles.slideredit_duration,duration); tomwalters@0: handles.slideredit_start=slidereditcontrol_set_range(handles.slideredit_start,duration); tomwalters@0: tomwalters@0: handles=aim_set_current_slider(handles); tomwalters@0: tomwalters@0: % display the signal lenght and samplerate tomwalters@0: len=getlength(sig); tomwalters@0: if len>1 tomwalters@0: set(handles.displayduration,'String',num2str(fround(getlength(sig),2))); tomwalters@0: set(handles.text20,'String','sec'); tomwalters@0: else tomwalters@0: set(handles.displayduration,'String',num2str(fround(getlength(sig)*1000,0))); tomwalters@0: set(handles.text20,'String','ms'); tomwalters@0: end tomwalters@0: % samlerate tomwalters@0: set(handles.text25,'String',num2str(fround(getsr(sig)/1000,1))); tomwalters@0: tomwalters@0: % offset tomwalters@0: if start_time>0 tomwalters@0: set(handles.text29,'String',num2str(fround(start_time*1000,1))); tomwalters@0: set(handles.text29,'Visible','on'); tomwalters@0: set(handles.text30,'Visible','on'); tomwalters@0: else tomwalters@0: set(handles.text29,'Visible','off'); tomwalters@0: set(handles.text30,'Visible','off'); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: set(handles.edit1,'Enable','on'); tomwalters@0: set(handles.slider1,'Enable','on'); tomwalters@0: set(handles.edit2,'Enable','on'); tomwalters@0: set(handles.slider2,'Enable','on'); tomwalters@0: set(handles.edit3,'Enable','on'); tomwalters@0: set(handles.slider3,'Enable','on'); tomwalters@0: tomwalters@0: tomwalters@0: % set the displayed module name to the one that was loaded tomwalters@0: if handles.info.pcp_loaded tomwalters@0: setstring(handles.listbox0,handles.info.current_pcp_module);end tomwalters@0: if handles.info.bmm_loaded tomwalters@0: setstring(handles.listbox1,handles.info.current_bmm_module);end tomwalters@0: if handles.info.nap_loaded tomwalters@0: setstring(handles.listbox2,handles.info.current_nap_module);end tomwalters@0: if handles.info.strobes_loaded tomwalters@0: setstring(handles.listbox3,handles.info.current_strobes_module);end tomwalters@0: if handles.info.sai_loaded tomwalters@0: setstring(handles.listbox4,handles.info.current_sai_module);end tomwalters@0: if handles.info.usermodule_loaded tomwalters@0: setstring(handles.listbox6,handles.info.current_usermodule_module);end tomwalters@0: if handles.info.movie_loaded tomwalters@0: setstring(handles.listbox5,handles.info.current_movie_module);end tomwalters@0: tomwalters@0: if isfield(handles.info,'init') tomwalters@0: set(handles.checkbox6,'Value',handles.info.init.hastime); tomwalters@0: set(handles.checkbox7,'Value',handles.info.init.hasfreq); tomwalters@0: set(handles.checkbox10,'Value',handles.info.init.hassignal); tomwalters@0: handles.info.old_current_plot=0; tomwalters@0: tomwalters@0: else tomwalters@0: % set the frequency profile off tomwalters@0: set(handles.checkbox6,'Value',0); tomwalters@0: % set the temporal profile off tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: % set the signal on tomwalters@0: set(handles.checkbox10,'Value',1); tomwalters@0: % set the current visible plot (the signal alone) tomwalters@0: handles.info.current_plot=-1; tomwalters@0: handles.info.old_current_plot=0; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: handles.audioplayer_enabled = true; tomwalters@0: try tomwalters@0: y=getvalues(sig); tomwalters@0: Fs=getsr(sig); tomwalters@0: player = audioplayer(y / abs(max(y)), Fs); %make a player for the normalized signal tomwalters@0: set(player, 'UserData', handles.figure1, 'TimerPeriod', 0.05, 'TimerFcn', @update_audio_position, ... tomwalters@0: 'StartFcn', @start_function); tomwalters@0: % the toolbar callback fcns look for these named bits of appdata tomwalters@0: setappdata(hfig, 'theAudioPlayer', player); tomwalters@0: setappdata(hfig, 'theAudioRecorder', []); tomwalters@0: selection.inPoint = 1; tomwalters@0: selection.outPoint = length(y); tomwalters@0: setappdata(hfig, 'audioSelection', selection); % selection starts as "full" tomwalters@0: catch tomwalters@0: audioplayer_enabled = false; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: return tomwalters@0: tomwalters@0: function handles=setstring(hand,name) tomwalters@0: strings=get(hand,'String'); tomwalters@0: nrstring=size(strings); tomwalters@0: for i=1:nrstring tomwalters@0: if strcmp(strings{i},name) tomwalters@0: set(hand,'Value',i); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: return