function mos = pesq_wrap(clean, noisy)
% mos = pesq_wrap(clean, noisy)
%   Wrapper to execute Loizou's PESQ implementation, either from M
%   files or from pfiles
% 2011-02-24 Dan Ellis dpwe@ee.columbia.edu

PREFER_PESQ_M = 0;

if exist('pesq') == 0
  % Need to add path
  if PREFER_PESQ_M && exist('pesq_m','dir') > 0
    % prefer M-file if available
    addpath('pesq_m');
  else
    % hope we have it
    addpath('pesq_p');
  end
end

if exist('pesq') == 0
  error('can not find pesq implementation');
elseif exist('pesq') == 6
  % p-file
  % read SR
%  [len,sr] = wavread(clean,'size');
%  mos = pesq(sr,clean,noisy);
  % 2011-10-28: rebuilt pesq_p has same syntax as m-files
  mos = pesq(clean,noisy);
else
  % assume m-file
  mos = pesq(clean,noisy);
end
