tomwalters@0: % procedure for 'aim-mat' tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % 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: function handles=edit_duration(hObject, eventdata, handles) tomwalters@0: tomwalters@0: tomwalters@0: curval=get(hObject,'String'); tomwalters@0: curval=str2num(curval); tomwalters@0: tomwalters@0: handles.slideredit_duration=... tomwalters@0: slidereditcontrol_set_raweditvalue(handles.slideredit_duration,curval); tomwalters@0: tomwalters@0: sig=handles.data.signal; tomwalters@0: tomwalters@0: if handles.info.current_plot>=6 %sai has additionally the start time below: tomwalters@0: current_start_time=slidereditcontrol_get_value(handles.slideredit_duration); % the new value tomwalters@0: framelen=getcurrentframestarttime(handles.data.sai{2})-getcurrentframestarttime(handles.data.sai{1}); tomwalters@0: tomwalters@0: nr_frames=length(handles.data.sai); tomwalters@0: current_frame_nr=round((current_start_time-getminimumtime(sig))/framelen)+1; % plus 1 because of the duration of the frame itself tomwalters@0: current_frame_nr=min(nr_frames,current_frame_nr); tomwalters@0: current_frame_nr=max(1,current_frame_nr); tomwalters@0: handles.currentslidereditcombi=slidereditcontrol_set_value(handles.currentslidereditcombi,current_frame_nr); tomwalters@0: realval=(current_frame_nr-1)*framelen+getminimumtime(sig); tomwalters@0: handles.slideredit_duration=... tomwalters@0: slidereditcontrol_set_value(handles.slideredit_duration,realval); tomwalters@0: else tomwalters@0: % check range tomwalters@0: start=slidereditcontrol_get_value(handles.currentslidereditcombi); tomwalters@0: dur=slidereditcontrol_get_value(handles.slideredit_duration); tomwalters@0: siglen=getmaximumtime(sig); tomwalters@0: if start+dur>siglen tomwalters@0: dur=siglen-start; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: handles.slideredit_duration=... tomwalters@0: slidereditcontrol_set_value(handles.slideredit_duration,dur); tomwalters@0: tomwalters@0: % set the range of the start_slider accordingly tomwalters@0: len=slidereditcontrol_get_value(handles.slideredit_duration); tomwalters@0: handles.currentslidereditcombi=slidereditcontrol_set_range(handles.currentslidereditcombi,len); % the duration tomwalters@0: tomwalters@0: end