javax.sound.sampled.AudioFileFormat#Type ( )源码实例Demo

下面列出了javax.sound.sampled.AudioFileFormat#Type ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: WaveFileFormat.java
WaveFileFormat(AudioFileFormat.Type type, int lengthInBytes, AudioFormat format, int lengthInFrames) {

        super(type,lengthInBytes,format,lengthInFrames);

        AudioFormat.Encoding encoding = format.getEncoding();

        if( encoding.equals(AudioFormat.Encoding.ALAW) ) {
            waveType = WAVE_FORMAT_ALAW;
        } else if( encoding.equals(AudioFormat.Encoding.ULAW) ) {
            waveType = WAVE_FORMAT_MULAW;
        } else if( encoding.equals(AudioFormat.Encoding.PCM_SIGNED) ||
                   encoding.equals(AudioFormat.Encoding.PCM_UNSIGNED) ) {
            waveType = WAVE_FORMAT_PCM;
        } else {
            waveType = WAVE_FORMAT_UNKNOWN;
        }
    }
 
源代码2 项目: Bytecoder   文件: AiffFileWriter.java
@Override
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
    Objects.requireNonNull(stream);
    Objects.requireNonNull(fileType);
    Objects.requireNonNull(out);

    //$$fb the following check must come first ! Otherwise
    // the next frame length check may throw an IOException and
    // interrupt iterating File Writers. (see bug 4351296)

    // throws IllegalArgumentException if not supported
    AiffFileFormat aiffFileFormat = (AiffFileFormat)getAudioFileFormat(fileType, stream);

    // we must know the total data length to calculate the file length
    if( stream.getFrameLength() == AudioSystem.NOT_SPECIFIED ) {
        throw new IOException("stream length not specified");
    }

    return writeAiffFile(stream, aiffFileFormat, out);
}
 
源代码3 项目: hottub   文件: WaveFileWriter.java
public AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {

        AudioFileFormat.Type[] filetypes = new AudioFileFormat.Type[types.length];
        System.arraycopy(types, 0, filetypes, 0, types.length);

        // make sure we can write this stream
        AudioFormat format = stream.getFormat();
        AudioFormat.Encoding encoding = format.getEncoding();

        if( AudioFormat.Encoding.ALAW.equals(encoding) ||
            AudioFormat.Encoding.ULAW.equals(encoding) ||
            AudioFormat.Encoding.PCM_SIGNED.equals(encoding) ||
            AudioFormat.Encoding.PCM_UNSIGNED.equals(encoding) ) {

            return filetypes;
        }

        return new AudioFileFormat.Type[0];
    }
 
源代码4 项目: jdk1.8-source-analysis   文件: AudioFileWriter.java
/**
 * Indicates whether file writing support for the specified file type is provided
 * by this audio file writer.
 * @param fileType the file type for which write capabilities are queried
 * @return <code>true</code> if the file type is supported,
 * otherwise <code>false</code>
 */
public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {

    AudioFileFormat.Type types[] = getAudioFileTypes();

    for(int i=0; i<types.length; i++) {
        if( fileType.equals( types[i] ) ) {
            return true;
        }
    }
    return false;
}
 
源代码5 项目: jdk8u-jdk   文件: AudioFileWriter.java
/**
 * Indicates whether file writing support for the specified file type is provided
 * by this audio file writer.
 * @param fileType the file type for which write capabilities are queried
 * @return <code>true</code> if the file type is supported,
 * otherwise <code>false</code>
 */
public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {

    AudioFileFormat.Type types[] = getAudioFileTypes();

    for(int i=0; i<types.length; i++) {
        if( fileType.equals( types[i] ) ) {
            return true;
        }
    }
    return false;
}
 
源代码6 项目: jdk8u60   文件: AuFileFormat.java
AuFileFormat(AudioFileFormat.Type type, int lengthInBytes, AudioFormat format, int lengthInFrames) {

        super(type,lengthInBytes,format,lengthInFrames);

        AudioFormat.Encoding encoding = format.getEncoding();

        auType = -1;

        if( AudioFormat.Encoding.ALAW.equals(encoding) ) {
            if( format.getSampleSizeInBits()==8 ) {
                auType = AU_ALAW_8;
            }
        } else if( AudioFormat.Encoding.ULAW.equals(encoding) ) {
            if( format.getSampleSizeInBits()==8 ) {
                auType = AU_ULAW_8;
            }
        } else if( AudioFormat.Encoding.PCM_SIGNED.equals(encoding) ) {
            if( format.getSampleSizeInBits()==8 ) {
                auType = AU_LINEAR_8;
            } else if( format.getSampleSizeInBits()==16 ) {
                auType = AU_LINEAR_16;
            } else if( format.getSampleSizeInBits()==24 ) {
                auType = AU_LINEAR_24;
            } else if( format.getSampleSizeInBits()==32 ) {
                auType = AU_LINEAR_32;
            }
        }

    }
 
源代码7 项目: openjdk-jdk8u-backup   文件: AudioFileWriter.java
/**
 * Indicates whether file writing support for the specified file type is provided
 * by this audio file writer.
 * @param fileType the file type for which write capabilities are queried
 * @return <code>true</code> if the file type is supported,
 * otherwise <code>false</code>
 */
public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {

    AudioFileFormat.Type types[] = getAudioFileTypes();

    for(int i=0; i<types.length; i++) {
        if( fileType.equals( types[i] ) ) {
            return true;
        }
    }
    return false;
}
 
源代码8 项目: openjdk-8-source   文件: AudioFileWriter.java
/**
 * Indicates whether file writing support for the specified file type is provided
 * by this audio file writer.
 * @param fileType the file type for which write capabilities are queried
 * @return <code>true</code> if the file type is supported,
 * otherwise <code>false</code>
 */
public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {

    AudioFileFormat.Type types[] = getAudioFileTypes();

    for(int i=0; i<types.length; i++) {
        if( fileType.equals( types[i] ) ) {
            return true;
        }
    }
    return false;
}
 
源代码9 项目: Bytecoder   文件: SunFileWriter.java
@Override
public final AudioFileFormat.Type[] getAudioFileTypes(){
    AudioFileFormat.Type[] localArray = new AudioFileFormat.Type[types.length];
    System.arraycopy(types, 0, localArray, 0, types.length);
    return localArray;
}
 
源代码10 项目: TencentKona-8   文件: WriterCloseInput.java
static void test(AudioFileFormat.Type fileType) {
    test(fileType, frameLength);
    test(fileType, AudioSystem.NOT_SPECIFIED);
}
 
源代码11 项目: openjdk-8-source   文件: SunFileWriter.java
/**
 * Constructs a new SunParser object.
 */
SunFileWriter(AudioFileFormat.Type types[]) {
    this.types = types;
}
 
源代码12 项目: jdk8u_jdk   文件: AiffFileWriter.java
/**
 * Constructs a new AiffFileWriter object.
 */
public AiffFileWriter() {
    super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AIFF});
}
 
源代码13 项目: openjdk-jdk8u-backup   文件: AuFileWriter.java
/**
 * Constructs a new AuFileWriter object.
 */
public AuFileWriter() {
    super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AU});
}
 
源代码14 项目: dragonwell8_jdk   文件: AuFileWriter.java
/**
 * Constructs a new AuFileWriter object.
 */
public AuFileWriter() {
    super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AU});
}
 
源代码15 项目: openjdk-8-source   文件: AuFileWriter.java
/**
 * Constructs a new AuFileWriter object.
 */
public AuFileWriter() {
    super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AU});
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: AudioFileWriter.java
/**
 * Obtains the file types for which file writing support is provided by this
 * audio file writer.
 * @return array of file types.  If no file types are supported,
 * an array of length 0 is returned.
 */
public abstract AudioFileFormat.Type[] getAudioFileTypes();
 
源代码17 项目: dragonwell8_jdk   文件: AudioFileWriter.java
/**
 * Obtains the file types for which file writing support is provided by this
 * audio file writer.
 * @return array of file types.  If no file types are supported,
 * an array of length 0 is returned.
 */
public abstract AudioFileFormat.Type[] getAudioFileTypes();
 
源代码18 项目: Java8CN   文件: AudioFileWriter.java
/**
 * Obtains the file types that this audio file writer can write from the
 * audio input stream specified.
 * @param stream the audio input stream for which audio file type support
 * is queried
 * @return array of file types.  If no file types are supported,
 * an array of length 0 is returned.
 */
public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);
 
源代码19 项目: openjdk-8   文件: SunFileWriter.java
public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException; 
源代码20 项目: openjdk-8-source   文件: SunFileWriter.java
public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);