function setrec(src, No)

% set recording source of your mixer (only Linux/*BSD)
% you need `mixer' program from snd-util by Hannu Savolainen 1993
%
%    setrec([src] [, No])
%        src : recording source (ex, 'line', 'mic', etc)
%        No  : mixer number (default: 0)
%    ex.)  setrec()       displays current recording source
%          setrec('line') changes current recording source to line-in
%
%   see also setaudio

if nargin < 1
  if(is_matlab)
    eval('!mixer \?rec');
  else
    system('mixer ?rec');
  end
else
  if(nargin < 2)
    mixern = 'mixer';
  else
    if(No == 0)
      mixern = 'mixer';
    else
      mixern = sprintf('mixer%d', No);
    end
  end
  if(is_matlab)
    eval(sprintf('!%s +rec %s', mixern, src));
  else
    eval(system(sprintf('%s +rec %s', mixern, src)));
  end
end
