fig=createmadfig('distortion'); 
fig=createmadloadmenu(fig);
presetsmenu=uimenu('Parent',fig, 'Label','Presets');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','all bands','Enable','off');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','no bands','Enable','off');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','low pass','Enable','off');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','high pass','Enable','off');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','band pass','Enable','off');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','band stop','Enable','off');
uimenu('Parent',presetsmenu, 'Tag','pmenu','Callback','distortion presets','Label','2 bands','Enable','off');

% also need a save menu at some point
%    ud.save=uimenu('Parent',filemenu, 'Callback','distortion saveSignal','Label','&save ...','Accelerator','S');
fig=createmadmenus(fig);

% major row & column positions

left=0.1;
top=0.9;
bottom=0.05;
mid=0.5;
right=0.75;

ud.wavAxes = axes('Parent',fig,...
'Position',[left bottom right-left 0.6],...
'DrawMode','fast',...
'NextPlot','add',...
'XTick',[],...
'Box','on'); 

ud.wavstatus=uicontrol('Parent',fig,...
'Position',[left bottom+0.62 right-left 0.04],...
'String','',...
'Style','text');

ud.spectAxes = axes('Parent',fig,...
'Position',[left bottom+0.68 right-left 0.22],...
'DrawMode','fast',...
'NextPlot','replacechildren',...
'Box','on',...
'XTick',[],...
'YTick',[]);

ud.spectstatus=uicontrol('Parent',fig,...
'Position',[left bottom+0.9 right-left 0.04],...
'String','NO DATA LOADED YET',...
'Style','text');

cy=top-0.1;
right=right+0.02;

uicontrol('Parent',fig, ...
'Position',[right cy 0.17 0.05], ...
'String','num chans:', ...
'Style','text');

gap=0.05;
cy=cy-gap;

ud.chansmenu=uicontrol('Parent',fig, ...
'Callback','distortion changeNumchans', ...
'Position',[right cy 0.17 0.05], ...
'String','3|4|5|8|10|20|40', ...
'Style','popupmenu', ...
'Value',5);

cy=cy-2*gap;

uicontrol('Parent',fig, ...
'Position',[right cy 0.17 0.05], ...
'String','envelope:', ...
'Style','text');

cy=cy-gap;
ud.envmenu=uicontrol('Parent',fig, ...
'Callback','distortion distortEnvelope', ...
'Position',[right cy 0.17 0.05], ...
'String','natural|noise|constant', ...
'Style','popupmenu', ...
'Value',1);

cy=cy-2*gap;

uicontrol('Parent',fig, ...
'Position',[right cy 0.17 0.05], ...
'String','carrier:', ...
'Style','text');

cy=cy-gap;

ud.carriermenu=uicontrol('Parent',fig, ...
'Callback','distortion distortCarrier', ...
'Position',[right cy 0.17 0.05], ...
'String','natural|noise|tone', ...
'Style','popupmenu', ...
'Value',1);

cy=cy-2*gap;

uicontrol('Parent',fig, ...
'Position',[right cy 0.17 0.05], ...
'String','time shift:', ...
'Style','text');

cy=cy-gap;

ud.timemenu=uicontrol('Parent',fig, ...
'Callback','distortion distortTime', ...
'Position',[right cy 0.17 0.05], ...
'String','0|10|20|30|40|50|80|120|150|200|300|500|1000', ...
'Style','popupmenu', ...
'Value',1);

cy=cy-2*gap;

uicontrol('Parent',fig, ...
'Position',[right cy 0.17 0.05], ...
'String','shuffle size:', ...
'Style','text');

cy=cy-gap;

ud.shufflemenu=uicontrol('Parent',fig, ...
'Callback','distortion distortShuffle', ...
'Position',[right cy 0.17 0.05], ...
'String','0|1|2|4|6|10|20|50|100|200', ...
'Style','popupmenu', ...
'Value',1,...
'Enable','off');	

set(gcf,'UserData',ud);

