当前位置: 首页>>代码示例>>Java>>正文


Java AudioFloatConverter.getConverter方法代码示例

本文整理汇总了Java中com.sun.media.sound.AudioFloatConverter.getConverter方法的典型用法代码示例。如果您正苦于以下问题:Java AudioFloatConverter.getConverter方法的具体用法?Java AudioFloatConverter.getConverter怎么用?Java AudioFloatConverter.getConverter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.media.sound.AudioFloatConverter的用法示例。


在下文中一共展示了AudioFloatConverter.getConverter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:Bits32ToFromFloatArray.java

示例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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Bits64ToFromFloatArray.java

示例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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Bits24ToFromFloatArray.java

示例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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Bits16ToFromFloatArray.java

示例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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:Bits8ToFromFloatArray.java

示例6: SoftAudioBuffer

import com.sun.media.sound.AudioFloatConverter; //导入方法依赖的package包/类
public SoftAudioBuffer(int size, AudioFormat format) {
    this.size = size;
    this.format = format;
    converter = AudioFloatConverter.getConverter(format);
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:6,代码来源:SoftAudioBuffer.java


注:本文中的com.sun.media.sound.AudioFloatConverter.getConverter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。