function control = parameter__control__create(parameter,context)

% BANDPASS - parameter__control__create

%--
% create parent controls
%--

fun = parent_fun;

control = fun(parameter, context);

%--
% get rate and nyquist from context
%--

rate = get_sound_rate(context.sound); nyq = rate / 2;

%--
% band and design tabs
%--

control(end + 1) = control_create( ...
	'space',0.1, ...
	'style','separator' ...
);

tabs = {'Band', 'Design'};

control(end + 1) = control_create( ...
	'name','filter_tabs', ...
	'style','tabs', ...
	'tab',tabs ...
);

%--
% band controls
%--

slider_inc = get_slider_inc(nyq);

control(end + 1) = control_create( ...
	'name','min_freq', ...
	'tab',tabs{1}, ...
	'style','slider', ...
	'type', 'integer', ...
	'slider_inc', slider_inc, ...
	'min', 0, ...
	'max', nyq - parameter.min_band - 1, ...
	'value', parameter.min_freq ...
);

control(end + 1) = control_create( ...
	'name','max_freq', ...
	'tab',tabs{1}, ...
	'style','slider', ...
	'type', 'integer', ...
	'slider_inc', slider_inc, ...
	'min', parameter.min_band + 1, ...
	'max', nyq, ...
	'value',parameter.max_freq ...
);

max_trans = min(nyq - parameter.max_freq, parameter.min_freq);

if max_trans < parameter.min_band
	max_trans = max(nyq - parameter.max_freq, parameter.min_freq);
end

control(end + 1) = control_create( ...
	'name','transition', ...
	'tab',tabs{1}, ...
	'style','slider', ...
	'type', 'integer', ...
	'slider_inc', slider_inc, ...
	'space',1.5, ...
	'min', parameter.min_band / 4, ...
	'max', max_trans, ...
	'value', parameter.transition ...
);

%--
% design controls
%--

control(end + 1) = control_create( ...
	'name','length', ...
	'tab',tabs{2}, ...
	'style','slider', ...
	'type', 'integer', ...
	'slider_inc', [1,2], ...
	'space', 0.75, ...
	'min',4, ...
	'max',256, ...
	'value',parameter.length ...
);

% NOTE: onload callback here sets the enable state of various controls

control(end + 1) = control_create( ...
	'name','estimate', ...
	'alias','Auto', ...
	'tab',tabs{2}, ...
	'style','checkbox', ...
	'onload', 1, ...
	'space',1, ...
	'value',parameter.estimate ...
);

control(end + 1) = control_create( ...
	'name', 'stop_ripple', ...
	'alias', 'attenuation', ...
	'tab', tabs{2}, ...
	'style', 'slider', ...
	'min', -80, ...
	'max', 0, ...
	'value', parameter.stop_ripple ...
);

control(end + 1) = control_create( ...
	'name', 'pass_ripple', ...
	'alias', 'ripple', ...
	'tab', tabs{2}, ...
	'style', 'slider', ...
	'space', 1.5, ...
	'min', -80, ...
	'max', 0, ...
	'value', parameter.pass_ripple ...
);

