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


Java AudioFormat.ULAW属性代码示例

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


在下文中一共展示了AudioFormat.ULAW属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSupportedInputFormats

@Override
public Format[] getSupportedInputFormats()
{
    // TODO: query AudioSystem
    return new Format[] {
            new AudioFormat(AudioFormat.LINEAR, -1, 8, -1, -1,
                    AudioFormat.SIGNED),
            new AudioFormat(AudioFormat.LINEAR, -1, 16, -1,
                    AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
            new AudioFormat(AudioFormat.LINEAR, -1, 24, -1,
                    AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
            new AudioFormat(AudioFormat.LINEAR, -1, 32, -1,
                    AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
            new AudioFormat(AudioFormat.ULAW), // TODO: narrow down
            new AudioFormat(AudioFormat.ALAW) // TODO: narrow down
    };
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:17,代码来源:JavaSoundAUMux.java

示例2: convertFormat

/**
 * Convert javax.sound.sampled.AudioFormat to
 * javax.media.format.AudioFormat.
 */
public static AudioFormat convertFormat(
        javax.sound.sampled.AudioFormat format)
{
    Encoding encoding = format.getEncoding();
    int channels = format.getChannels();
    float frameRate = format.getFrameRate();
    int frameSize = format.getFrameSize() < 0 ? format.getFrameSize()
            : (format.getFrameSize() * 8);
    float sampleRate = format.getSampleRate();
    int sampleSize = format.getSampleSizeInBits();

    int endian = format.isBigEndian() ? AudioFormat.BIG_ENDIAN
            : AudioFormat.LITTLE_ENDIAN;

    int signed = Format.NOT_SPECIFIED;
    String encodingString = AudioFormat.LINEAR;

    if (encoding == Encoding.PCM_SIGNED)
    {
        signed = AudioFormat.SIGNED;
        encodingString = AudioFormat.LINEAR;
    } else if (encoding == Encoding.PCM_UNSIGNED)
    {
        signed = AudioFormat.UNSIGNED;
        encodingString = AudioFormat.LINEAR;
    } else if (encoding == Encoding.ALAW)
    {
        encodingString = AudioFormat.ALAW;
    } else if (encoding == Encoding.ULAW)
    {
        encodingString = AudioFormat.ULAW;
    } else
    {
        encodingString = encoding.toString();

    }

    AudioFormat jmfFormat = new AudioFormat(encodingString, sampleRate,
            sampleSize, channels, endian, signed, frameSize, frameRate,
            Format.byteArray);

    return jmfFormat;
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:47,代码来源:JavaSoundUtils.java


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