if (ok && s > 0) { ok = player.write(samples, 0, s); if (ok) { ok = player.end(); } s = 0; }
if (s > 0) { ok = player.write(samples, 0, s); s = 0; }   if (ok) { ok = player.end(); }
    private boolean  playWaveSamples(AudioPlayer player, int numberSamples) {	boolean ok = true;	int numberChannels = getNumberOfChannels();	int pmSizeSamples;	float pp = 0;	byte[] samples = new byte[MAX_SAMPLE_SIZE];	byte[] residuals = getResiduals();	int[] residualSizes = getResidualSizes();		FloatList outBuffer = FloatList.createList(numberChannels + 1);	FloatList lpcCoefficients = FloatList.createList(numberChannels);		double multiplier = (double) getLPCRange() / 65535.0;	int s = 0;	boolean firstPlay = true;	// for each frame in the LPC result	player.begin(getNumberOfSamples() * 2);	for (int r = 0, i = 0; ok && i < numberOfFrames; i++) {	    	    // unpack the LPC coefficients	    short[] frame =  getFrame(i);	    FloatList lpcCoeffs = lpcCoefficients;	    for (int k = 0; k < numberChannels; k++) {		lpcCoeffs.value = (float) ( (frame[k] + 32768.0) 		    * multiplier) + lpcMinimum;		lpcCoeffs = lpcCoeffs.next;	    }	    	    pmSizeSamples = residualSizes[i];	    // resynthesis the signal, pmSizeSamples ~= 90	    // what's in the loop is done for each residual	    for (int j = 0; j < pmSizeSamples; j++, r++) {		FloatList backBuffer = outBuffer.prev;		float ob = residualToFloatMap[residuals[r] + 128];		lpcCoeffs = lpcCoefficients;		do {		    ob += lpcCoeffs.value * backBuffer.value;		    backBuffer = backBuffer.prev;		    lpcCoeffs = lpcCoeffs.next;		} while (lpcCoeffs != lpcCoefficients);		int sample = (int) (ob + (pp * POST_EMPHASIS));		samples[s++] = hibyte(sample);		samples[s++] = lobyte(sample);		if (s >= MAX_SAMPLE_SIZE) {		    if (!player.write(samples)) {			ok = false;		    }		    s = 0;		}		outBuffer.value = pp = ob;		outBuffer = outBuffer.next;	    }	}	if (ok && s > 0) {	    ok = player.write(samples, 0, s);	    if (ok) {		ok = player.end();	    }	    s = 0;	}	return ok;    }