public void play(byte[] b, int length, int offset) {
		int val;

		if (totalLength != 0) {
			totalLength--;

			for (int r = offset; r < offset + length; r++) {

				int samplePos = (31 * cyclePos) / cycleLength;
				val = unsign(waveform[samplePos % 32]) >> volumeShift << 1;
			//    System.out.print(" " + val);

			if ((channel & CHAN_LEFT) != 0) b[r * 2] += val;
			if ((channel & CHAN_RIGHT) != 0) b[r * 2 + 1] += val;
			if ((channel & CHAN_MONO) != 0) b[r] += val;

			//   System.out.print(val + " ");
			cyclePos = (cyclePos + 256) % cycleLength;
			}
		}
	}