/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*
* @author Karl Helgason
*/
public abstract class AudioFloatConverter {
/***************************************************************************
*
* LSB Filter, used filter least significant byte in samples arrays.
*
* Is used filter out data in lsb byte when SampleSizeInBits is not
* dividable by 8.
*
**************************************************************************/
final private int offset;
final private int stepsize;
final private byte mask;
private byte[] mask_buffer;
if (lsb_bits == 0)
mask = (byte) 0x00;
else if (lsb_bits == 1)
mask = (byte) 0x80;
else if (lsb_bits == 2)
mask = (byte) 0xC0;
else if (lsb_bits == 3)
mask = (byte) 0xE0;
else if (lsb_bits == 4)
mask = (byte) 0xF0;
else if (lsb_bits == 5)
mask = (byte) 0xF8;
else if (lsb_bits == 6)
mask = (byte) 0xFC;
else if (lsb_bits == 7)
mask = (byte) 0xFE;
else
mask = (byte) 0xFF;
}
byte[] out_buff, int out_offset) {
}
return ret;
}
}
return ret;
}
}
/***************************************************************************
*
* 64 bit float, little/big-endian
*
**************************************************************************/
// PCM 64 bit float, little-endian
}
if (double_buff == null
for (int i = out_offset; i < out_offset_end; i++) {
out_buff[i] = (float) double_buff[i];
}
return out_buff;
}
byte[] out_buff, int out_offset) {
}
for (int i = in_offset; i < in_offset_end; i++) {
double_buff[i] = in_buff[i];
}
return out_buff;
}
}
// PCM 64 bit float, big-endian
}
if (double_buff == null
for (int i = out_offset; i < out_offset_end; i++) {
out_buff[i] = (float) double_buff[i];
}
return out_buff;
}
byte[] out_buff, int out_offset) {
}
for (int i = in_offset; i < in_offset_end; i++) {
double_buff[i] = in_buff[i];
}
return out_buff;
}
}
/***************************************************************************
*
* 32 bit float, little/big-endian
*
**************************************************************************/
// PCM 32 bit float, little-endian
}
return out_buff;
}
byte[] out_buff, int out_offset) {
}
return out_buff;
}
}
// PCM 32 bit float, big-endian
}
return out_buff;
}
byte[] out_buff, int out_offset) {
}
return out_buff;
}
}
/***************************************************************************
*
*
**************************************************************************/
// PCM 8 bit, signed
int ox = out_offset;
for (int i = 0; i < out_len; i++)
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++)
return out_buff;
}
}
// PCM 8 bit, unsigned
int ox = out_offset;
for (int i = 0; i < out_len; i++)
* (1.0f / 127.0f);
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++)
return out_buff;
}
}
/***************************************************************************
*
* 16 bit signed/unsigned, little/big-endian
*
**************************************************************************/
// PCM 16 bit, signed, little-endian
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
}
return out_buff;
}
}
// PCM 16 bit, signed, big-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
}
return out_buff;
}
}
// PCM 16 bit, unsigned, little-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
}
return out_buff;
}
}
// PCM 16 bit, unsigned, big-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
}
return out_buff;
}
}
/***************************************************************************
*
* 24 bit signed/unsigned, little/big-endian
*
**************************************************************************/
// PCM 24 bit, signed, little-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
if (x > 0x7FFFFF)
x -= 0x1000000;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
if (x < 0)
x += 0x1000000;
}
return out_buff;
}
}
// PCM 24 bit, signed, big-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
if (x > 0x7FFFFF)
x -= 0x1000000;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
if (x < 0)
x += 0x1000000;
}
return out_buff;
}
}
// PCM 24 bit, unsigned, little-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
x -= 0x7FFFFF;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
x += 0x7FFFFF;
}
return out_buff;
}
}
// PCM 24 bit, unsigned, big-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
x -= 0x7FFFFF;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
x += 0x7FFFFF;
}
return out_buff;
}
}
/***************************************************************************
*
* 32 bit signed/unsigned, little/big-endian
*
**************************************************************************/
// PCM 32 bit, signed, little-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
}
return out_buff;
}
}
// PCM 32 bit, signed, big-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
}
return out_buff;
}
}
// PCM 32 bit, unsigned, little-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
x -= 0x7FFFFFFF;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
x += 0x7FFFFFFF;
}
return out_buff;
}
}
// PCM 32 bit, unsigned, big-endian
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
x -= 0x7FFFFFFF;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
x += 0x7FFFFFFF;
}
return out_buff;
}
}
/***************************************************************************
*
* 32+ bit signed/unsigned, little/big-endian
*
**************************************************************************/
// PCM 32+ bit, signed, little-endian
final int xbytes;
}
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
for (int j = 0; j < xbytes; j++) {
}
}
return out_buff;
}
}
// PCM 32+ bit, signed, big-endian
final int xbytes;
}
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
for (int j = 0; j < xbytes; j++) {
}
}
return out_buff;
}
}
// PCM 32+ bit, unsigned, little-endian
final int xbytes;
}
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
x -= 0x7FFFFFFF;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
x += 0x7FFFFFFF;
for (int j = 0; j < xbytes; j++) {
}
}
return out_buff;
}
}
// PCM 32+ bit, unsigned, big-endian
final int xbytes;
}
int ox = out_offset;
for (int i = 0; i < out_len; i++) {
x -= 2147483647;
}
return out_buff;
}
byte[] out_buff, int out_offset) {
int ox = out_offset;
for (int i = 0; i < in_len; i++) {
x += 2147483647;
for (int j = 0; j < xbytes; j++) {
}
}
return out_buff;
}
}
return null;
if (format.getFrameSize() !=
return null;
}
if (format.isBigEndian()) {
conv = new AudioFloatConversion8S();
conv = new AudioFloatConversion16SB();
conv = new AudioFloatConversion24SB();
conv = new AudioFloatConversion32SB();
}
} else {
conv = new AudioFloatConversion8S();
conv = new AudioFloatConversion16SL();
conv = new AudioFloatConversion24SL();
conv = new AudioFloatConversion32SL();
}
}
if (format.isBigEndian()) {
conv = new AudioFloatConversion8U();
conv = new AudioFloatConversion16UB();
conv = new AudioFloatConversion24UB();
conv = new AudioFloatConversion32UB();
conv = new AudioFloatConversion32xUB(((
}
} else {
conv = new AudioFloatConversion8U();
conv = new AudioFloatConversion16UL();
conv = new AudioFloatConversion24UL();
conv = new AudioFloatConversion32UL();
conv = new AudioFloatConversion32xUL(((
}
}
if (format.isBigEndian())
conv = new AudioFloatConversion32B();
else
conv = new AudioFloatConversion32L();
if (format.isBigEndian())
conv = new AudioFloatConversion64B();
else
conv = new AudioFloatConversion64L();
}
}
}
return conv;
}
return format;
}
int out_offset, int out_len) {
}
}
int out_len) {
}
}
byte[] out_buff, int out_offset) {
}
byte[] out_buff) {
}
byte[] out_buff) {
}
}
}