/** * Reads samples from the stream. * * @see AudioStream#readSamples(byte[], int, int) * @param buf Buffer where to read the samples * @return number of bytes read. */ public int readSamples(byte[] buf) { return readSamples(buf, 0, buf.length); }
private boolean fillBuffer(AudioStream stream, int id) { int size = 0; int result; while (size < arrayBuf.length) { result = stream.readSamples(arrayBuf, size, arrayBuf.length - size); if (result > 0) { size += result; } else { break; } } if (size == 0) { return false; } nativeBuf.clear(); nativeBuf.put(arrayBuf, 0, size); nativeBuf.flip(); al.alBufferData(id, convertFormat(stream), nativeBuf, size, stream.getSampleRate()); return true; }
/** * Reads samples from the stream. * * @see AudioStream#readSamples(byte[], int, int) * @param buf Buffer where to read the samples * @return number of bytes read. */ public int readSamples(byte[] buf){ return readSamples(buf, 0, buf.length); }
/** * Reads samples from the stream. * * @see AudioStream#readSamples(byte[], int, int) * @param buf Buffer where to read the samples * @return number of bytes read. */ public int readSamples(byte[] buf) { return readSamples(buf, 0, buf.length); }
private boolean fillBuffer(AudioStream stream, int id) { int size = 0; int result; while (size < arrayBuf.length) { result = stream.readSamples(arrayBuf, size, arrayBuf.length - size); if (result > 0) { size += result; } else { break; } } if (size == 0) { return false; } nativeBuf.clear(); nativeBuf.put(arrayBuf, 0, size); nativeBuf.flip(); al.alBufferData(id, convertFormat(stream), nativeBuf, size, stream.getSampleRate()); return true; }