Java Code Examples for javax.sound.sampled.spi.FormatConversionProvider#getTargetFormats()

The following examples show how to use javax.sound.sampled.spi.FormatConversionProvider#getTargetFormats() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioSystem.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 2
Source File: AudioSystem.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 3
Source File: AudioSystem.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 4
Source File: AudioSystem.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 5
Source File: AudioSystem.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 6
Source File: AudioSystem.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 7
Source File: AudioSystem.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 8
Source File: AudioSystem.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 9
Source File: AudioSystem.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 10
Source File: AudioSystem.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 11
Source File: AudioSystem.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system
 * can obtain from a stream of the specified format using the set of
 * installed format converters.
 *
 * @param  targetEncoding the desired encoding after conversion
 * @param  sourceFormat the audio format before conversion
 * @return array of formats. If no formats of the specified encoding are
 *         supported, an array of length 0 is returned.
 * @throws NullPointerException if {@code targetEncoding} or
 *         {@code sourceFormat} are {@code null}
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    Objects.requireNonNull(sourceFormat);

    List<FormatConversionProvider> codecs = getFormatConversionProviders();
    List<AudioFormat> formats = new ArrayList<>();

    boolean matchFound = false;
    // gather from all the codecs
    for (final FormatConversionProvider codec : codecs) {
        AudioFormat[] elements = codec
                .getTargetFormats(targetEncoding, sourceFormat);
        for (AudioFormat format : elements) {
            formats.add(format);
            if (sourceFormat.matches(format)) {
                matchFound = true;
            }
        }
    }

    if (targetEncoding.equals(sourceFormat.getEncoding())) {
        if (!matchFound) {
            formats.add(sourceFormat);
        }
    }
    return formats.toArray(new AudioFormat[formats.size()]);
}
 
Example 12
Source File: AudioSystem.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system
 * can obtain from a stream of the specified format using the set of
 * installed format converters.
 *
 * @param  targetEncoding the desired encoding after conversion
 * @param  sourceFormat the audio format before conversion
 * @return array of formats. If no formats of the specified encoding are
 *         supported, an array of length 0 is returned.
 * @throws NullPointerException if {@code targetEncoding} or
 *         {@code sourceFormat} are {@code null}
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
    Objects.requireNonNull(targetEncoding);
    Objects.requireNonNull(sourceFormat);

    List<FormatConversionProvider> codecs = getFormatConversionProviders();
    List<AudioFormat> formats = new ArrayList<>();

    boolean matchFound = false;
    // gather from all the codecs
    for (final FormatConversionProvider codec : codecs) {
        AudioFormat[] elements = codec
                .getTargetFormats(targetEncoding, sourceFormat);
        for (AudioFormat format : elements) {
            formats.add(format);
            if (sourceFormat.matches(format)) {
                matchFound = true;
            }
        }
    }

    if (targetEncoding.equals(sourceFormat.getEncoding())) {
        if (!matchFound) {
            formats.add(sourceFormat);
        }
    }
    return formats.toArray(new AudioFormat[formats.size()]);
}
 
Example 13
Source File: AudioSystem.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 14
Source File: AudioSystem.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 15
Source File: AudioSystem.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 16
Source File: AudioSystem.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 17
Source File: AudioSystem.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}
 
Example 18
Source File: AudioSystem.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains the formats that have a particular encoding and that the system can
 * obtain from a stream of the specified format using the set of
 * installed format converters.
 * @param targetEncoding the desired encoding after conversion
 * @param sourceFormat the audio format before conversion
 * @return array of formats.  If no formats of the specified
 * encoding are supported, an array of length 0 is returned.
 */
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

    List codecs = getFormatConversionProviders();
    Vector formats = new Vector();

    int size = 0;
    int index = 0;
    AudioFormat fmts[] = null;

    // gather from all the codecs

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = (FormatConversionProvider) codecs.get(i);
        fmts = codec.getTargetFormats(targetEncoding, sourceFormat);
        size += fmts.length;
        formats.addElement( fmts );
    }

    // now build a new array

    AudioFormat fmts2[] = new AudioFormat[size];
    for(int i=0; i<formats.size(); i++ ) {
        fmts = (AudioFormat [])(formats.get(i));
        for(int j=0; j<fmts.length; j++ ) {
            fmts2[index++] = fmts[j];
        }
    }
    return fmts2;
}