當前位置: 首頁>>代碼示例>>Java>>正文


Java Encoding.equals方法代碼示例

本文整理匯總了Java中javax.sound.sampled.AudioFormat.Encoding.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Encoding.equals方法的具體用法?Java Encoding.equals怎麽用?Java Encoding.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.sound.sampled.AudioFormat.Encoding的用法示例。


在下文中一共展示了Encoding.equals方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAudioInputStream

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
        AudioInputStream sourceStream) {
    if (sourceStream.getFormat().getEncoding().equals(targetEncoding))
        return sourceStream;
    AudioFormat format = sourceStream.getFormat();
    int channels = format.getChannels();
    Encoding encoding = targetEncoding;
    float samplerate = format.getSampleRate();
    int bits = format.getSampleSizeInBits();
    boolean bigendian = format.isBigEndian();
    if (targetEncoding.equals(Encoding.PCM_FLOAT))
        bits = 32;
    AudioFormat targetFormat = new AudioFormat(encoding, samplerate, bits,
            channels, channels * bits / 8, samplerate, bigendian);
    return getAudioInputStream(targetFormat, sourceStream);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:AudioFloatFormatConverter.java

示例2: getAudioInputStream

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
@Override
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
                                            AudioInputStream sourceStream) {
    if (!isConversionSupported(targetEncoding, sourceStream.getFormat())) {
        throw new IllegalArgumentException(
                "Unsupported conversion: " + sourceStream.getFormat()
                        .toString() + " to " + targetEncoding.toString());
    }
    if (sourceStream.getFormat().getEncoding().equals(targetEncoding))
        return sourceStream;
    AudioFormat format = sourceStream.getFormat();
    int channels = format.getChannels();
    Encoding encoding = targetEncoding;
    float samplerate = format.getSampleRate();
    int bits = format.getSampleSizeInBits();
    boolean bigendian = format.isBigEndian();
    if (targetEncoding.equals(Encoding.PCM_FLOAT))
        bits = 32;
    AudioFormat targetFormat = new AudioFormat(encoding, samplerate, bits,
            channels, channels * bits / 8, samplerate, bigendian);
    return getAudioInputStream(targetFormat, sourceStream);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:AudioFloatFormatConverter.java

示例3: getAudioInputStream

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
        AudioInputStream sourceStream) {
    if (!isConversionSupported(targetEncoding, sourceStream.getFormat())) {
        throw new IllegalArgumentException(
                "Unsupported conversion: " + sourceStream.getFormat()
                        .toString() + " to " + targetEncoding.toString());
    }
    if (sourceStream.getFormat().getEncoding().equals(targetEncoding))
        return sourceStream;
    AudioFormat format = sourceStream.getFormat();
    int channels = format.getChannels();
    Encoding encoding = targetEncoding;
    float samplerate = format.getSampleRate();
    int bits = format.getSampleSizeInBits();
    boolean bigendian = format.isBigEndian();
    if (targetEncoding.equals(Encoding.PCM_FLOAT))
        bits = 32;
    AudioFormat targetFormat = new AudioFormat(encoding, samplerate, bits,
            channels, channels * bits / 8, samplerate, bigendian);
    return getAudioInputStream(targetFormat, sourceStream);
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:22,代碼來源:AudioFloatFormatConverter.java

示例4: getAudioInputStream

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public AudioInputStream getAudioInputStream(Encoding targetEncoding,
        AudioInputStream sourceStream) {
    if (sourceStream.getFormat().getEncoding().equals(targetEncoding))
        return sourceStream;
    AudioFormat format = sourceStream.getFormat();
    int channels = format.getChannels();
    Encoding encoding = targetEncoding;
    float samplerate = format.getSampleRate();
    int bits = format.getSampleSizeInBits();
    boolean bigendian = format.isBigEndian();
    if (targetEncoding.equals(AudioFloatConverter.PCM_FLOAT))
        bits = 32;
    AudioFormat targetFormat = new AudioFormat(encoding, samplerate, bits,
            channels, channels * bits / 8, samplerate, bigendian);
    return getAudioInputStream(targetFormat, sourceStream);
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:17,代碼來源:AudioFloatFormatConverter.java

示例5: isConversionSupported

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public boolean isConversionSupported(Encoding targetEncoding,
        AudioFormat sourceFormat) {
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return false;
    for (int i = 0; i < formats.length; i++) {
        if (targetEncoding.equals(formats[i]))
            return true;
    }
    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:AudioFloatFormatConverter.java

示例6: test

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
static boolean test(Encoding enc) {
    out("conversion " + enc + " -> PCM_FLOAT:");
    Encoding[] encodings = AudioSystem.getTargetEncodings(enc);
    for (Encoding e: encodings) {
        if (e.equals(pcmFloatEnc)) {
            out("  - OK");
            return true;
        }
    }
    out("  - FAILED (not supported)");
    testFailed = true;
    return false;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:14,代碼來源:PCM_FLOAT_support.java

示例7: isConversionSupported

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
@Override
public boolean isConversionSupported(Encoding targetEncoding,
                                     AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return false;
    for (int i = 0; i < formats.length; i++) {
        if (targetEncoding.equals(formats[i]))
            return true;
    }
    return false;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:AudioFloatFormatConverter.java

示例8: isConversionSupported

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public boolean isConversionSupported(Encoding targetEncoding,
        AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return false;
    for (int i = 0; i < formats.length; i++) {
        if (targetEncoding.equals(formats[i]))
            return true;
    }
    return false;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:12,代碼來源:AudioFloatFormatConverter.java

示例9: getTargetFormats

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public AudioFormat[] getTargetFormats(Encoding targetEncoding,
        AudioFormat sourceFormat) {
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return new AudioFormat[0];
    int channels = sourceFormat.getChannels();

    ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();

    if (targetEncoding.equals(Encoding.PCM_SIGNED))
        formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));
    if (targetEncoding.equals(Encoding.PCM_UNSIGNED))
        formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));

    for (int bits = 16; bits < 32; bits += 8) {
        if (targetEncoding.equals(Encoding.PCM_SIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
        }
        if (targetEncoding.equals(Encoding.PCM_UNSIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
        }
    }

    if (targetEncoding.equals(Encoding.PCM_FLOAT)) {
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, true));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, true));
    }

    return formats.toArray(new AudioFormat[formats.size()]);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:54,代碼來源:AudioFloatFormatConverter.java

示例10: getTargetFormats

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
@Override
public AudioFormat[] getTargetFormats(Encoding targetEncoding,
                                      AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return new AudioFormat[0];
    int channels = sourceFormat.getChannels();

    ArrayList<AudioFormat> formats = new ArrayList<>();

    if (targetEncoding.equals(Encoding.PCM_SIGNED))
        formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));
    if (targetEncoding.equals(Encoding.PCM_UNSIGNED))
        formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));

    for (int bits = 16; bits < 32; bits += 8) {
        if (targetEncoding.equals(Encoding.PCM_SIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
        }
        if (targetEncoding.equals(Encoding.PCM_UNSIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
        }
    }

    if (targetEncoding.equals(Encoding.PCM_FLOAT)) {
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, true));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, true));
    }

    return formats.toArray(new AudioFormat[formats.size()]);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:56,代碼來源:AudioFloatFormatConverter.java

示例11: getTargetFormats

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public AudioFormat[] getTargetFormats(Encoding targetEncoding,
        AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return new AudioFormat[0];
    int channels = sourceFormat.getChannels();

    ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();

    if (targetEncoding.equals(Encoding.PCM_SIGNED))
        formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));
    if (targetEncoding.equals(Encoding.PCM_UNSIGNED))
        formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));

    for (int bits = 16; bits < 32; bits += 8) {
        if (targetEncoding.equals(Encoding.PCM_SIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
        }
        if (targetEncoding.equals(Encoding.PCM_UNSIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
        }
    }

    if (targetEncoding.equals(Encoding.PCM_FLOAT)) {
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, true));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, true));
    }

    return formats.toArray(new AudioFormat[formats.size()]);
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:55,代碼來源:AudioFloatFormatConverter.java

示例12: getTargetFormats

import javax.sound.sampled.AudioFormat.Encoding; //導入方法依賴的package包/類
public AudioFormat[] getTargetFormats(Encoding targetEncoding,
        AudioFormat sourceFormat) {
    if (AudioFloatConverter.getConverter(sourceFormat) == null)
        return new AudioFormat[0];
    int channels = sourceFormat.getChannels();

    ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();

    if (targetEncoding.equals(Encoding.PCM_SIGNED))
        formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));
    if (targetEncoding.equals(Encoding.PCM_UNSIGNED))
        formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                AudioSystem.NOT_SPECIFIED, 8, channels, channels,
                AudioSystem.NOT_SPECIFIED, false));

    for (int bits = 16; bits < 32; bits += 8) {
        if (targetEncoding.equals(Encoding.PCM_SIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
            formats.add(new AudioFormat(Encoding.PCM_SIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
        }
        if (targetEncoding.equals(Encoding.PCM_UNSIGNED)) {
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, true));
            formats.add(new AudioFormat(Encoding.PCM_UNSIGNED,
                    AudioSystem.NOT_SPECIFIED, bits, channels, channels
                            * bits / 8, AudioSystem.NOT_SPECIFIED, false));
        }
    }

    if (targetEncoding.equals(AudioFloatConverter.PCM_FLOAT)) {
        formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                AudioSystem.NOT_SPECIFIED, true));
        formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, false));
        formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
                AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                AudioSystem.NOT_SPECIFIED, true));
    }

    return formats.toArray(new AudioFormat[formats.size()]);
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:54,代碼來源:AudioFloatFormatConverter.java


注:本文中的javax.sound.sampled.AudioFormat.Encoding.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。