本文整理汇总了Java中com.sun.media.sound.AudioFloatConverter.toFloatArray方法的典型用法代码示例。如果您正苦于以下问题:Java AudioFloatConverter.toFloatArray方法的具体用法?Java AudioFloatConverter.toFloatArray怎么用?Java AudioFloatConverter.toFloatArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.media.sound.AudioFloatConverter
的用法示例。
在下文中一共展示了AudioFloatConverter.toFloatArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import com.sun.media.sound.AudioFloatConverter; //导入方法依赖的package包/类
private static void test(final Encoding enc, final byte[] expected,
boolean end) {
AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
end);
byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
conv.toByteArray(FLOATS, bytes);
if (!Arrays.equals(bytes, expected)) {
System.err.println("Actual: " + Arrays.toString(bytes));
System.err.println("Expected: " + Arrays.toString(expected));
throw new RuntimeException();
}
float[] floats = new float[bytes.length / af.getFrameSize()];
conv.toFloatArray(bytes, floats);
if (!Arrays.equals(floats, FLOATS)) {
System.err.println("Actual: " + Arrays.toString(floats));
System.err.println("Expected: " + Arrays.toString(FLOATS));
throw new RuntimeException();
}
}
示例2: test
import com.sun.media.sound.AudioFloatConverter; //导入方法依赖的package包/类
private static void test(final Encoding enc, final byte[] expected,
boolean end) {
System.err.println(enc);
AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
end);
byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
conv.toByteArray(FLOATS, bytes);
if (!Arrays.equals(bytes, expected)) {
System.err.println("Actual: " + Arrays.toString(bytes));
System.err.println("Expected: " + Arrays.toString(expected));
throw new RuntimeException();
}
float[] floats = new float[bytes.length / af.getFrameSize()];
conv.toFloatArray(bytes, floats);
if (!Arrays.equals(floats, FLOATS)) {
System.err.println("Actual: " + Arrays.toString(floats));
System.err.println("Expected: " + Arrays.toString(FLOATS));
throw new RuntimeException();
}
}
示例3: test
import com.sun.media.sound.AudioFloatConverter; //导入方法依赖的package包/类
private static void test(final Encoding enc, final byte[] expected,
boolean end) {
System.err.println(enc);
AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
end);
byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
conv.toByteArray(FLOATS, bytes);
if (!Arrays.equals(bytes, expected)) {
System.err.println("Actual: " + Arrays.toString(bytes));
System.err.println("Expected: " + Arrays.toString(expected));
throw new RuntimeException();
}
float[] floats = new float[bytes.length / af.getFrameSize()];
conv.toFloatArray(bytes, floats);
if (!Arrays.equals(floats, FLOATS)) {
System.err.println("Actual: " + Arrays.toString(floats));
System.err.println("Expected: " + Arrays.toString(FLOATS));
throw new RuntimeException();
}
}
示例4: test
import com.sun.media.sound.AudioFloatConverter; //导入方法依赖的package包/类
private static void test(final Encoding enc, final byte[] expected,
boolean end) {
System.err.println("enc = " + enc);
AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
end);
byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
conv.toByteArray(FLOATS, bytes);
if (!Arrays.equals(bytes, expected)) {
System.err.println("Actual: " + Arrays.toString(bytes));
System.err.println("Expected: " + Arrays.toString(expected));
throw new RuntimeException();
}
float[] floats = new float[bytes.length / af.getFrameSize()];
conv.toFloatArray(bytes, floats);
if (!Arrays.equals(floats, FLOATS)) {
System.err.println("Actual: " + Arrays.toString(floats));
System.err.println("Expected: " + Arrays.toString(FLOATS));
throw new RuntimeException();
}
}
示例5: test
import com.sun.media.sound.AudioFloatConverter; //导入方法依赖的package包/类
private static void test(final Encoding enc, final byte[] expected) {
AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
true);
byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
conv.toByteArray(FLOATS, bytes);
if (!Arrays.equals(bytes, expected)) {
System.err.println("Actual: " + Arrays.toString(bytes));
System.err.println("Expected: " + Arrays.toString(expected));
throw new RuntimeException();
}
float[] floats = new float[bytes.length / af.getFrameSize()];
conv.toFloatArray(bytes, floats);
if (!Arrays.equals(floats, FLOATS)) {
System.err.println("Actual: " + Arrays.toString(floats));
System.err.println("Expected: " + Arrays.toString(FLOATS));
throw new RuntimeException();
}
}