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


Java AudioFormat.matches方法代码示例

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


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

示例1: isConversionSupported

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
/**
 * Indicates whether the format converter supports conversion to one
 * particular format from another.
 * @param targetFormat desired format of outgoing data
 * @param sourceFormat format of the incoming data
 * @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
 */
public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){

    AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat );

    for(int i=0; i<targetFormats.length; i++) {
        if( targetFormat.matches( targetFormats[i] ) ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:FormatConversionProvider.java

示例2: getConvertedStream

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
/**
 * Opens the codec with the specified parameters.
 * @param stream stream from which data to be processed should be read
 * @param outputFormat desired data format of the stream after processing
 * @return stream from which processed data may be read
 * @throws IllegalArgumentException if the format combination supplied is
 * not supported.
 */
private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {

    AudioInputStream cs = null;
    AudioFormat inputFormat = stream.getFormat();

    if( inputFormat.matches(outputFormat) ) {
        cs = stream;
    } else {
        cs = new AlawCodecStream(stream, outputFormat);
    }

    return cs;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:AlawCodec.java

示例3: isFormatSupportedInHardware

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
public boolean isFormatSupportedInHardware(AudioFormat format) {
    if (format == null) return false;
    for (int i = 0; i < hardwareFormats.length; i++) {
        if (format.matches(hardwareFormats[i])) {
            return true;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:DirectAudioDevice.java

示例4: getConvertedStream

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
/**
 * Opens the codec with the specified parameters.
 * @param stream stream from which data to be processed should be read
 * @param outputFormat desired data format of the stream after processing
 * @return stream from which processed data may be read
 * @throws IllegalArgumentException if the format combination supplied is
 * not supported.
 */
private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {
    AudioInputStream cs = null;

    AudioFormat inputFormat = stream.getFormat();

    if( inputFormat.matches(outputFormat) ) {
        cs = stream;
    } else {
        cs = new UlawCodecStream(stream, outputFormat);
    }
    return cs;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:UlawCodec.java

示例5: isContains

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
private static boolean isContains(AudioFormat obj, AudioFormat[] array) {
    for (final AudioFormat format : array) {
        if (obj.matches(format)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:GetTargetIsSupported.java

示例6: open

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
public final void open(AudioFormat format, int bufferSize) throws LineUnavailableException {
    //$$fb 2001-10-09: Bug #4517739: avoiding deadlock by synchronizing to mixer !
    synchronized (mixer) {
        if (Printer.trace) Printer.trace("> AbstractDataLine.open(format, bufferSize) (class: "+getClass().getName());

        // if the line is not currently open, try to open it with this format and buffer size
        if (!isOpen()) {
            // make sure that the format is specified correctly
            // $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions
            Toolkit.isFullySpecifiedAudioFormat(format);

            if (Printer.debug) Printer.debug("  need to open the mixer...");
            // reserve mixer resources for this line
            //mixer.open(this, format, bufferSize);
            mixer.open(this);

            try {
                // open the data line.  may throw LineUnavailableException.
                implOpen(format, bufferSize);

                // if we succeeded, set the open state to true and send events
                setOpen(true);

            } catch (LineUnavailableException e) {
                // release mixer resources for this line and then throw the exception
                mixer.close(this);
                throw e;
            }
        } else {
            if (Printer.debug) Printer.debug("  dataline already open");

            // if the line is already open and the requested format differs from the
            // current settings, throw an IllegalStateException
            //$$fb 2002-04-02: fix for 4661602: Buffersize is checked when re-opening line
            if (!format.matches(getFormat())) {
                throw new IllegalStateException("Line is already open with format " + getFormat() +
                                                " and bufferSize " + getBufferSize());
            }
            //$$fb 2002-07-26: allow changing the buffersize of already open lines
            if (bufferSize > 0) {
                setBufferSize(bufferSize);
            }
        }

        if (Printer.trace) Printer.trace("< AbstractDataLine.open(format, bufferSize) completed");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:AbstractDataLine.java

示例7: getConvertedStream

import javax.sound.sampled.AudioFormat; //导入方法依赖的package包/类
/**
 * Opens the codec with the specified parameters.
 * @param stream stream from which data to be processed should be read
 * @param outputFormat desired data format of the stream after processing
 * @return stream from which processed data may be read
 * @throws IllegalArgumentException if the format combination supplied is
 * not supported.
 */
private AudioInputStream getConvertedStream(AudioFormat outputFormat, AudioInputStream stream) {

    AudioInputStream cs = null;

    AudioFormat inputFormat = stream.getFormat();

    if( inputFormat.matches(outputFormat) ) {

        cs = stream;
    } else {

        cs = new PCMtoPCMCodecStream(stream, outputFormat);
    }
    return cs;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:PCMtoPCMCodec.java


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