fig=createmadfig('vowelExplorer'); 
fig=createmadmenus(fig);

ud.maxdb=20;
ud.mindb=-20;

ud.vowelmenu1 = uicontrol('Parent',fig, ...
'Callback','vowelExplorer vowel1changed', ...
'Position',[0.06 0.87 0.1 0.07], ...
'String',{'ar','er','ee','or','oo'}, ...
'Style','popupmenu', ...
'Value',1);

ud.vowelmenu2 = uicontrol('Parent',fig, ...
'Callback','vowelExplorer vowel2changed', ...
'Position',[0.06 0.78 0.1 0.07], ...
'String',{'ar','er','ee','or','oo'}, ...
'Style','popupmenu', ...
'Value',2);

ud.semitonemenu1 = uicontrol('Parent',fig, ...
'Callback','vowelExplorer semitone1changed', ...
'Position',[0.2 0.87 0.16 0.07], ...
'String',{'zero','quarter','half','one','two','four'}, ...
'Style','popupmenu', ...
'Value',1);

ud.semitonemenu2 = uicontrol('Parent',fig, ...
'Callback','vowelExplorer semitone2changed', ...
'Position',[0.2 0.78 0.16 0.07], ...
'String',{'zero','quarter','half','one','two','four'}, ...
'Style','popupmenu', ...
'Value',6);

ud.playonebutton = uicontrol('Parent',fig, ...
'Callback','vowelExplorer playOne', ...
'Position',[0.44 0.65 0.17 0.07], ...
'String','play ar zero');

ud.playtwobutton = uicontrol('Parent',fig, ...
'Callback','vowelExplorer playTwo', ...
'Position',[0.63 0.65 0.17 0.07], ...
'String','play er four');

uicontrol('Parent',fig, ...
'Callback','vowelExplorer playBoth', ...
'Position',[0.81 0.65 0.17 0.07], ...
'String','play mixture');

ud.slider1= uicontrol('Parent',fig, ...
'Callback','vowelExplorer sliderChanged', ...
'Max',ud.maxdb, ...
'Min',ud.mindb, ...
'Position',[0.06 0.66 0.21 0.05], ...
'Style','slider', ...
'Value',0.0);

ud.edit1 = uicontrol('Parent',fig, ...
'BackgroundColor',[1 1 1], ...
'Callback','vowelExplorer boxChanged', ...
'Position',[0.2793 0.6562 0.0781 0.0521], ...
'String','1', ...
'Style','edit');

ud.ratiotext=uicontrol('Parent',fig, ...
'HorizontalAlignment','left', ...
'Position',[0.06 0.72 0.30 0.04], ...
'String','ar/er amplitude ratio (dB)', ...
'Style','text');

ud.check1 = uicontrol('Parent',fig, ...
'Callback','vowelExplorer boxchanged', ...
'Position',[0.25 0.08 0.25 0.04], ...
'String','Automatically update', ...
'Style','checkbox', ...
'Value',1);

ud.showpitch = uicontrol('Parent',fig, ...
'Callback','vowelExplorer ppboxchanged', ...
'Position',[0.25 0.03 0.25 0.04], ...
'String','Show pitch periods', ...
'Style','checkbox', ...
'Value',1);

uicontrol('Parent',fig, ...
'Callback','vowelExplorer recompute', ...
'Position',[0.07 0.03 0.16 0.09], ...
'String','recompute');

% WAVE AXES
ud.waveaxes = axes('Parent',fig, ...
'Box','on', ...
'DrawMode','fast', ...
'NextPlot','replacechildren', ...
'Position',[0.44 0.79 0.55 0.17], ...
'XLim',[0 500], ...
'XLimMode','manual', ...
'XTick',[0 100 200 300 400 500], ...
'XTickLabel',['0 ';'10';'20';'30';'40';'50'], ...	
'YLim',[-1600 1600], ...
'YLimMode','manual', ...
'ZLimMode','manual');

ud.bmaxes = axes('Parent',fig, ...
'Box','on', ...
'DrawMode','fast', ...
'NextPlot','add', ...
'Position',[0.1 0.19 0.39 0.37], ...
'XLim',[1 256], ...
'XLimMode','manual', ...
'XTick',[0 50 100 150 200 250], ...
'XTickLabel',['0 ';'5 ';'10';'15';'20';'25'], ...
'YLim',[0 1000], ...
'YLimMode','manual', ...
'YTick',[0 250 500 750 1000], ...
'YTickLabel',['80  ';'328 ';'866 ';'1924';'4000'], ...
'ZLimMode','manual');
title('Basilar Membrane');			
xlabel('Time [ms]'); 
ylabel('Channel Centre Frequency [Hz]');

% ACG AXES
ud.acgaxes = axes('Parent',fig, ...
'Box','on', ...
'DrawMode','fast', ...
'NextPlot','add', ...
'Position',[0.59 0.19 0.39 0.37], ...
'XLim',[1 128], ...
'XLimMode','manual', ...
'XTick',[0 25 50 75 100 125], ...
'XTickLabel',['0.0 ';'2.5 ';'5.0 ';'7.5 ';'10.0';'12.5'], ...	
'YLim',[0 1000], ...
'YLimMode','manual', ...
'YTick',[0 250 500 750 1000], ...
'YTickLabel',['80  ';'328 ';'866 ';'1924';'4000'], ...
'YTickLabelMode','manual', ...
'YTickMode','manual', ...
'ZLimMode','manual');

title('Autocorrelogram');
ylabel('Channel Centre Frequency [Hz]');

ud.summaryaxes = axes('Parent',fig, ...
'Box','on', ...
'DrawMode','fast', ...
'NextPlot','replacechildren', ...
'Position',[0.59 0.07 0.39 0.07], ...
'Tag','summaryaxes', ...
'XLim',[1 128], ...
'XLimMode','manual', ...
'XTick',[0 25 50 75 100 125], ...
'XTickLabel',['0.0 ';'2.5 ';'5.0 ';'7.5 ';'10.0';'12.5'], ...	
'YLim',[0 1.1], ...
'YLimMode','manual');

xlabel('Autocorrelation Lag [ms]');

set(gcf,'UserData',ud);
