function gowave2(wavefile,C)

%gowave2  
%
%   gowave2(wavefile,C) reads from a wavefile to simulate
%   a stream of audio data.  It breaks the signal into
%   blocks, processes them,  and displays the possible
%   source positions to a plot.  The blocks overlap by
%   half of a block size, so no impulse is lost because it
%   fell between blocks.
%
%   See also: maxt, fshift, go2, twomicplot, blargh3.

% NOTE: should take in a STEREO wavefile
% C is the distance between microphones

EBlockSize=2^11;
ablocksize=2*EBlockSize;


%Check for stereo wavefile
siz = wavread(wavefile,'size');
if siz(2) ~= 2, 'Input wavefile must be stereo', return, end
BigN = siz(1);

FullEBlocks=floor(BigN/EBlockSize);

%initialize the polar plot
initpolar(C);

%Begin calculating on the blocks
for i = 0:FullEBlocks-2; %must stop short because of the staggered blocks.
   
   Startindex=i*EBlockSize+1;
   
   Endindex=Startindex + ablocksize-1;
   
   [input, SF, nbits]  = wavread(wavefile, [Startindex Endindex]);
   xleft = input(:,1)';
   xright = input(:,2)';
   
   %%THESE LINES WERE FOR TESTING PURPOSES ONLY
   %%n1 = noise(.001,ablocksize);
   %%n2 = noise(.001,ablocksize);
   %%xleft = xleft + n1;
   %%xright = xright + n1;
   
   %SNR = 10*log(norm(xleft)/norm(n1))/log(10)
   
   SampleShiftDelay = -fshift(xleft,xright);
   twomicplot(SampleShiftDelay,C,SF);
   
   pause(.1)
   
end
hold off

title('Plots of Possible Signal Source Position')
Number_Of_Blocks_Computed = FullEBlocks-1
