/hg/icedtea6: 2009-12-03 Gary Benson <gbenson at redhat.com>
gbenson at icedtea.classpath.org
gbenson at icedtea.classpath.org
Thu Dec 3 01:11:00 PST 2009
changeset 1d33b4733b4b in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=1d33b4733b4b
author: Gary Benson <gbenson at redhat.com>
date: Thu Dec 03 09:16:00 2009 +0000
2009-12-03 Gary Benson <gbenson at redhat.com>
*
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/:
Removed.
diffstat:
104 files changed, 5 insertions(+), 29276 deletions(-)
ChangeLog | 5
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java | 131
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java | 1058 ---
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java | 617 --
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatInputStream.java | 281 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizer.java | 128
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java | 76
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/CHANGES.txt | 313 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSInfo.java | 109
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java | 448 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSModulator.java | 351 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSRegion.java | 150
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSSample.java | 122
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSSampleLoop.java | 63
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSSampleOptions.java | 80
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSSoundbank.java | 1287 ----
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/DLSSoundbankReader.java | 74
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/EmergencySoundbank.java | 2695 ----------
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/FFT.java | 748 --
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/InvalidDataException.java | 45
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/InvalidFormatException.java | 44
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/JARSoundbankReader.java | 120
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/LICENSE | 347 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelAbstractChannelMixer.java | 126
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelAbstractOscillator.java | 200
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelByteBuffer.java | 329 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelByteBufferWavetable.java | 281 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelChannelMixer.java | 50
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java | 135
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelDestination.java | 117
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelDirectedPlayer.java | 36
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelDirector.java | 46
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelIdentifier.java | 169
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelInstrument.java | 136
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelInstrumentComparator.java | 52
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelMappedInstrument.java | 62
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelOscillator.java | 44
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelOscillatorStream.java | 48
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelPatch.java | 52
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelPerformer.java | 143
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelSource.java | 109
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelStandardDirector.java | 86
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelStandardTransform.java | 139
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelTransform.java | 35
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/ModelWavetable.java | 49
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/README.txt | 402 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/RIFFInvalidDataException.java | 43
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/RIFFInvalidFormatException.java | 44
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/RIFFReader.java | 332 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/RIFFWriter.java | 365 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2GlobalRegion.java | 33
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2Instrument.java | 911 ---
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2InstrumentRegion.java | 43
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2Layer.java | 78
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2LayerRegion.java | 43
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2Modulator.java | 97
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2Region.java | 167
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2Sample.java | 216
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2Soundbank.java | 973 ---
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SF2SoundbankReader.java | 73
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SimpleInstrument.java | 196
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SimpleSoundbank.java | 145
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAbstractResampler.java | 390 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java | 128
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioProcessor.java | 48
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java | 92
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java | 1576 -----
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChannelProxy.java | 202
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java | 337 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftControl.java | 36
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftCubicResampler.java | 87
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java | 298 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java | 616 --
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java | 82
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java | 277 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLanczosResampler.java | 118
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java | 191
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler.java | 70
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLinearResampler2.java | 108
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLowFrequencyOscillator.java | 130
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java | 1146 ----
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java | 214
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingClip.java | 539 --
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java | 522 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingMainMixer.java | 259
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingMixer.java | 529 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingMixerProvider.java | 66
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java | 519 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java | 775 --
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftPointResampler.java | 63
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftProcess.java | 41
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java | 51
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java | 88
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftResampler.java | 35
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftResamplerStreamer.java | 38
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java | 515 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftShortMessage.java | 58
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftSincResampler.java | 139
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java | 1201 ----
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java | 256
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java | 892 ---
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java | 339 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java | 166
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/WaveFloatFileWriter.java | 147
diffs (truncated from 29701 to 500 lines):
diff -r 0ebce150b496 -r 1d33b4733b4b ChangeLog
--- a/ChangeLog Wed Dec 02 20:24:30 2009 -0500
+++ b/ChangeLog Thu Dec 03 09:16:00 2009 +0000
@@ -1,3 +1,8 @@ 2009-12-02 Deepak Bhole <dbhole at redhat.
+2009-12-03 Gary Benson <gbenson at redhat.com>
+
+ * overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/:
+ Removed.
+
2009-12-02 Deepak Bhole <dbhole at redhat.com>
* plugin/icedteanp/IcedTeaJavaRequestProcessor.cc
diff -r 0ebce150b496 -r 1d33b4733b4b overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java Wed Dec 02 20:24:30 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.media.sound;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.Soundbank;
-import javax.sound.midi.spi.SoundbankReader;
-import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioSystem;
-import javax.sound.sampled.UnsupportedAudioFileException;
-
-/**
- * Soundbank reader that uses audio files as soundbanks.
- *
- * @author Karl Helgason
- */
-public class AudioFileSoundbankReader extends SoundbankReader {
-
- public Soundbank getSoundbank(URL url)
- throws InvalidMidiDataException, IOException {
- try {
- AudioInputStream ais = AudioSystem.getAudioInputStream(url);
- Soundbank sbk = getSoundbank(ais);
- ais.close();
- return sbk;
- } catch (UnsupportedAudioFileException e) {
- return null;
- } catch (IOException e) {
- return null;
- }
- }
-
- public Soundbank getSoundbank(InputStream stream)
- throws InvalidMidiDataException, IOException {
- stream.mark(512);
- try {
- AudioInputStream ais = AudioSystem.getAudioInputStream(stream);
- Soundbank sbk = getSoundbank(ais);
- if (sbk != null)
- return sbk;
- } catch (UnsupportedAudioFileException e) {
- } catch (IOException e) {
- }
- stream.reset();
- return null;
- }
-
- public Soundbank getSoundbank(AudioInputStream ais)
- throws InvalidMidiDataException, IOException {
- try {
- byte[] buffer;
- if (ais.getFrameLength() == -1) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buff = new byte[1024
- - (1024 % ais.getFormat().getFrameSize())];
- int ret;
- while ((ret = ais.read(buff)) != -1) {
- baos.write(buff, 0, ret);
- }
- ais.close();
- buffer = baos.toByteArray();
- } else {
- buffer = new byte[(int) (ais.getFrameLength()
- * ais.getFormat().getFrameSize())];
- new DataInputStream(ais).readFully(buffer);
- }
- ModelByteBufferWavetable osc = new ModelByteBufferWavetable(
- new ModelByteBuffer(buffer), ais.getFormat(), -4800);
- ModelPerformer performer = new ModelPerformer();
- performer.getOscillators().add(osc);
-
- SimpleSoundbank sbk = new SimpleSoundbank();
- SimpleInstrument ins = new SimpleInstrument();
- ins.add(performer);
- sbk.addInstrument(ins);
- return sbk;
- } catch (Exception e) {
- return null;
- }
- }
-
- public Soundbank getSoundbank(File file)
- throws InvalidMidiDataException, IOException {
- try {
- AudioInputStream ais = AudioSystem.getAudioInputStream(file);
- ais.close();
- ModelByteBufferWavetable osc = new ModelByteBufferWavetable(
- new ModelByteBuffer(file, 0, file.length()), -4800);
- ModelPerformer performer = new ModelPerformer();
- performer.getOscillators().add(osc);
- SimpleSoundbank sbk = new SimpleSoundbank();
- SimpleInstrument ins = new SimpleInstrument();
- ins.add(performer);
- sbk.addInstrument(ins);
- return sbk;
- } catch (UnsupportedAudioFileException e1) {
- return null;
- } catch (IOException e) {
- return null;
- }
- }
-}
diff -r 0ebce150b496 -r 1d33b4733b4b overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatConverter.java Wed Dec 02 20:24:30 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1058 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package com.sun.media.sound;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.DoubleBuffer;
-import java.nio.FloatBuffer;
-
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioFormat.Encoding;
-
-/**
- * This class is used to convert between 8,16,24,32,32+ bit signed/unsigned
- * big/litle endian fixed/floating point byte buffers and float buffers.
- *
- * @author Karl Helgason
- */
-public abstract class AudioFloatConverter {
-
- public static final Encoding PCM_FLOAT = new Encoding("PCM_FLOAT");
-
- /***************************************************************************
- *
- * 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.
- *
- **************************************************************************/
-
- private static class AudioFloatLSBFilter extends AudioFloatConverter {
-
- private AudioFloatConverter converter;
-
- final private int offset;
-
- final private int stepsize;
-
- final private byte mask;
-
- private byte[] mask_buffer;
-
- public AudioFloatLSBFilter(AudioFloatConverter converter,
- AudioFormat format) {
- int bits = format.getSampleSizeInBits();
- boolean bigEndian = format.isBigEndian();
- this.converter = converter;
- stepsize = (bits + 7) / 8;
- offset = bigEndian ? (stepsize - 1) : 0;
- int lsb_bits = bits % 8;
- 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;
- }
-
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
- byte[] ret = converter.toByteArray(in_buff, in_offset, in_len,
- out_buff, out_offset);
-
- int out_offset_end = in_len * stepsize;
- for (int i = out_offset + offset; i < out_offset_end; i += stepsize) {
- out_buff[i] = (byte) (out_buff[i] & mask);
- }
-
- return ret;
- }
-
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- if (mask_buffer == null || mask_buffer.length < in_buff.length)
- mask_buffer = new byte[in_buff.length];
- System.arraycopy(in_buff, 0, mask_buffer, 0, in_buff.length);
- int in_offset_end = out_len * stepsize;
- for (int i = in_offset + offset; i < in_offset_end; i += stepsize) {
- mask_buffer[i] = (byte) (mask_buffer[i] & mask);
- }
- float[] ret = converter.toFloatArray(mask_buffer, in_offset,
- out_buff, out_offset, out_len);
- return ret;
- }
-
- }
-
- /***************************************************************************
- *
- * 64 bit float, little/big-endian
- *
- **************************************************************************/
-
- // PCM 64 bit float, little-endian
- private static class AudioFloatConversion64L extends AudioFloatConverter {
- ByteBuffer bytebuffer = null;
-
- DoubleBuffer floatbuffer = null;
-
- double[] double_buff = null;
-
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- int in_len = out_len * 8;
- if (bytebuffer == null || bytebuffer.capacity() < in_len) {
- bytebuffer = ByteBuffer.allocate(in_len).order(
- ByteOrder.LITTLE_ENDIAN);
- floatbuffer = bytebuffer.asDoubleBuffer();
- }
- bytebuffer.position(0);
- floatbuffer.position(0);
- bytebuffer.put(in_buff, in_offset, in_len);
- if (double_buff == null
- || double_buff.length < out_len + out_offset)
- double_buff = new double[out_len + out_offset];
- floatbuffer.get(double_buff, out_offset, out_len);
- int out_offset_end = out_offset + out_len;
- for (int i = out_offset; i < out_offset_end; i++) {
- out_buff[i] = (float) double_buff[i];
- }
- return out_buff;
- }
-
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
- int out_len = in_len * 8;
- if (bytebuffer == null || bytebuffer.capacity() < out_len) {
- bytebuffer = ByteBuffer.allocate(out_len).order(
- ByteOrder.LITTLE_ENDIAN);
- floatbuffer = bytebuffer.asDoubleBuffer();
- }
- floatbuffer.position(0);
- bytebuffer.position(0);
- if (double_buff == null || double_buff.length < in_offset + in_len)
- double_buff = new double[in_offset + in_len];
- int in_offset_end = in_offset + in_len;
- for (int i = in_offset; i < in_offset_end; i++) {
- double_buff[i] = in_buff[i];
- }
- floatbuffer.put(double_buff, in_offset, in_len);
- bytebuffer.get(out_buff, out_offset, out_len);
- return out_buff;
- }
- }
-
- // PCM 64 bit float, big-endian
- private static class AudioFloatConversion64B extends AudioFloatConverter {
- ByteBuffer bytebuffer = null;
-
- DoubleBuffer floatbuffer = null;
-
- double[] double_buff = null;
-
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- int in_len = out_len * 8;
- if (bytebuffer == null || bytebuffer.capacity() < in_len) {
- bytebuffer = ByteBuffer.allocate(in_len).order(
- ByteOrder.BIG_ENDIAN);
- floatbuffer = bytebuffer.asDoubleBuffer();
- }
- bytebuffer.position(0);
- floatbuffer.position(0);
- bytebuffer.put(in_buff, in_offset, in_len);
- if (double_buff == null
- || double_buff.length < out_len + out_offset)
- double_buff = new double[out_len + out_offset];
- floatbuffer.get(double_buff, out_offset, out_len);
- int out_offset_end = out_offset + out_len;
- for (int i = out_offset; i < out_offset_end; i++) {
- out_buff[i] = (float) double_buff[i];
- }
- return out_buff;
- }
-
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
- int out_len = in_len * 8;
- if (bytebuffer == null || bytebuffer.capacity() < out_len) {
- bytebuffer = ByteBuffer.allocate(out_len).order(
- ByteOrder.BIG_ENDIAN);
- floatbuffer = bytebuffer.asDoubleBuffer();
- }
- floatbuffer.position(0);
- bytebuffer.position(0);
- if (double_buff == null || double_buff.length < in_offset + in_len)
- double_buff = new double[in_offset + in_len];
- int in_offset_end = in_offset + in_len;
- for (int i = in_offset; i < in_offset_end; i++) {
- double_buff[i] = in_buff[i];
- }
- floatbuffer.put(double_buff, in_offset, in_len);
- bytebuffer.get(out_buff, out_offset, out_len);
- return out_buff;
- }
- }
-
- /***************************************************************************
- *
- * 32 bit float, little/big-endian
- *
- **************************************************************************/
-
- // PCM 32 bit float, little-endian
- private static class AudioFloatConversion32L extends AudioFloatConverter {
- ByteBuffer bytebuffer = null;
-
- FloatBuffer floatbuffer = null;
-
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- int in_len = out_len * 4;
- if (bytebuffer == null || bytebuffer.capacity() < in_len) {
- bytebuffer = ByteBuffer.allocate(in_len).order(
- ByteOrder.LITTLE_ENDIAN);
- floatbuffer = bytebuffer.asFloatBuffer();
- }
- bytebuffer.position(0);
- floatbuffer.position(0);
- bytebuffer.put(in_buff, in_offset, in_len);
- floatbuffer.get(out_buff, out_offset, out_len);
- return out_buff;
- }
-
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
- int out_len = in_len * 4;
- if (bytebuffer == null || bytebuffer.capacity() < out_len) {
- bytebuffer = ByteBuffer.allocate(out_len).order(
- ByteOrder.LITTLE_ENDIAN);
- floatbuffer = bytebuffer.asFloatBuffer();
- }
- floatbuffer.position(0);
- bytebuffer.position(0);
- floatbuffer.put(in_buff, in_offset, in_len);
- bytebuffer.get(out_buff, out_offset, out_len);
- return out_buff;
- }
- }
-
- // PCM 32 bit float, big-endian
- private static class AudioFloatConversion32B extends AudioFloatConverter {
- ByteBuffer bytebuffer = null;
-
- FloatBuffer floatbuffer = null;
-
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- int in_len = out_len * 4;
- if (bytebuffer == null || bytebuffer.capacity() < in_len) {
- bytebuffer = ByteBuffer.allocate(in_len).order(
- ByteOrder.BIG_ENDIAN);
- floatbuffer = bytebuffer.asFloatBuffer();
- }
- bytebuffer.position(0);
- floatbuffer.position(0);
- bytebuffer.put(in_buff, in_offset, in_len);
- floatbuffer.get(out_buff, out_offset, out_len);
- return out_buff;
- }
-
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
- int out_len = in_len * 4;
- if (bytebuffer == null || bytebuffer.capacity() < out_len) {
- bytebuffer = ByteBuffer.allocate(out_len).order(
- ByteOrder.BIG_ENDIAN);
- floatbuffer = bytebuffer.asFloatBuffer();
- }
- floatbuffer.position(0);
- bytebuffer.position(0);
- floatbuffer.put(in_buff, in_offset, in_len);
- bytebuffer.get(out_buff, out_offset, out_len);
- return out_buff;
- }
- }
-
- /***************************************************************************
- *
- * 8 bit signed/unsigned
- *
- **************************************************************************/
-
- // PCM 8 bit, signed
- private static class AudioFloatConversion8S extends AudioFloatConverter {
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- int ix = in_offset;
- int ox = out_offset;
- for (int i = 0; i < out_len; i++)
- out_buff[ox++] = in_buff[ix++] * (1.0f / 127.0f);
- return out_buff;
- }
-
- public byte[] toByteArray(float[] in_buff, int in_offset, int in_len,
- byte[] out_buff, int out_offset) {
- int ix = in_offset;
- int ox = out_offset;
- for (int i = 0; i < in_len; i++)
- out_buff[ox++] = (byte) (in_buff[ix++] * 127.0f);
- return out_buff;
- }
- }
-
- // PCM 8 bit, unsigned
- private static class AudioFloatConversion8U extends AudioFloatConverter {
- public float[] toFloatArray(byte[] in_buff, int in_offset,
- float[] out_buff, int out_offset, int out_len) {
- int ix = in_offset;
- int ox = out_offset;
- for (int i = 0; i < out_len; i++)
- out_buff[ox++] = ((in_buff[ix++] & 0xFF) - 127)
- * (1.0f / 127.0f);
- return out_buff;
More information about the distro-pkg-dev
mailing list