% ShowTheTrialPD
%
% Subscript that holds the code for showing the
% stimulus in the PhaseDistortDemo program.
%
% Since this is a script, it uses the same workspace as the
% main program.
%
% 3/5/97  dhb  Pulled out of main script.

if (pTest > 1)
	pTest = 1;
elseif (pTest < 0)
	pTest = 0;
end
[image1P,image2P] = ...
	ComputeImagePPD(pTest,image1Amp,image2Amp,image1Phase,image2Phase);
theSide = CoinFlip(1,0.5);
Screen(window,'SetClut',offClut);	
if (theSide == 0)
	Screen(window,'PutImage',255*Scale(image1P),theRect1);
	Screen(window,'PutImage',255*Scale(image2P),theRect2);
else
	Screen(window,'PutImage',255*Scale(image2P),theRect1);
	Screen(window,'PutImage',255*Scale(image1P),theRect2);
end
Screen(window,'DrawText',respString,50,150,0);
Screen(window,'SetClut',onClut);
