private int decodePacket(Packet packet) {
		// check the endianes of the computer.
		final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
		
		if (block.synthesis(packet) == 0) { 
			// test for success!
			dspState.synthesis_blockin(block);
		}

		// **pcm is a multichannel float vector.  In stereo, for
		// example, pcm[0] is left, and pcm[1] is right.  samples is
		// the size of each channel.  Convert the float values
		// (-1.<=range<=1.) to whatever PCM format and write it out
		int convOff = 0;
		int samples;
		while ((samples = dspState.synthesis_pcmout(_pcm, _index)) > 0) {
			//System.out.println("while() 4");
			float[][] pcm = _pcm[0];
			int bout = (samples < convsize ? samples : convsize);

			// convert floats to 16 bit signed ints (host order) and interleave
			for (int i = 0; i < info.channels; i++) {
				int ptr = (i << 1) + convOff;


				int mono = _index[i];

				for (int j = 0; j < bout; j++) {
					int val = (int) (pcm[i][mono + j] * 32767.);

					// might as well guard against clipping
					val = Math.max(-32768, Math.min(32767, val));
					val |= (val < 0 ? 0x8000 : 0);
					
					convbuffer[ptr + 0] = (byte) (bigEndian ? val >>> 8 : val);
					convbuffer[ptr + 1] = (byte) (bigEndian ? val : val >>> 8);
					
					ptr += (info.channels) << 1;
				}
			}

			convOff += 2 * info.channels * bout;

			// Tell orbis how many samples were consumed
			dspState.synthesis_read(bout);
		}
	
		return convOff;
	}