< prev index next >

src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  72  * a whole series of samples, as well as additional, non-sample data. For such
  73  * encodings, the sample rate and sample size refer to the data after it is
  74  * decoded into PCM, and so they are completely different from the frame rate
  75  * and frame size.
  76  * <p>
  77  * An {@code AudioFormat} object can include a set of properties. A property is
  78  * a pair of key and value: the key is of type {@code String}, the associated
  79  * property value is an arbitrary object. Properties specify additional format
  80  * specifications, like the bit rate for compressed formats. Properties are
  81  * mainly used as a means to transport additional information of the audio
  82  * format to and from the service providers. Therefore, properties are ignored
  83  * in the {@link #matches(AudioFormat)} method. However, methods which rely on
  84  * the installed service providers, like
  85  * {@link AudioSystem#isConversionSupported (AudioFormat, AudioFormat)
  86  * isConversionSupported} may consider properties, depending on the respective
  87  * service provider implementation.
  88  * <p>
  89  * The following table lists some common properties which service providers
  90  * should use, if applicable:
  91  *
  92  * <table border=0>
  93  *  <caption>Audio Format Properties</caption>

  94  *  <tr>
  95  *   <th>Property key</th>
  96  *   <th>Value type</th>
  97  *   <th>Description</th>
  98  *  </tr>


  99  *  <tr>
 100  *   <td>&quot;bitrate&quot;</td>
 101  *   <td>{@link java.lang.Integer Integer}</td>
 102  *   <td>average bit rate in bits per second</td>
 103  *  </tr>
 104  *  <tr>
 105  *   <td>&quot;vbr&quot;</td>
 106  *   <td>{@link java.lang.Boolean Boolean}</td>
 107  *   <td>{@code true}, if the file is encoded in variable bit
 108  *       rate (VBR)</td>
 109  *  </tr>
 110  *  <tr>
 111  *   <td>&quot;quality&quot;</td>
 112  *   <td>{@link java.lang.Integer Integer}</td>
 113  *   <td>encoding/conversion quality, 1..100</td>
 114  *  </tr>

 115  * </table>
 116  * <p>
 117  * Vendors of service providers (plugins) are encouraged to seek information
 118  * about other already established properties in third party plugins, and follow
 119  * the same conventions.
 120  *
 121  * @author Kara Kytle
 122  * @author Florian Bomers
 123  * @see DataLine#getFormat
 124  * @see AudioInputStream#getFormat
 125  * @see AudioFileFormat
 126  * @see javax.sound.sampled.spi.FormatConversionProvider
 127  * @since 1.3
 128  */
 129 public class AudioFormat {
 130 
 131     /**
 132      * The audio encoding technique used by this format.
 133      */
 134     protected Encoding encoding;


   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  72  * a whole series of samples, as well as additional, non-sample data. For such
  73  * encodings, the sample rate and sample size refer to the data after it is
  74  * decoded into PCM, and so they are completely different from the frame rate
  75  * and frame size.
  76  * <p>
  77  * An {@code AudioFormat} object can include a set of properties. A property is
  78  * a pair of key and value: the key is of type {@code String}, the associated
  79  * property value is an arbitrary object. Properties specify additional format
  80  * specifications, like the bit rate for compressed formats. Properties are
  81  * mainly used as a means to transport additional information of the audio
  82  * format to and from the service providers. Therefore, properties are ignored
  83  * in the {@link #matches(AudioFormat)} method. However, methods which rely on
  84  * the installed service providers, like
  85  * {@link AudioSystem#isConversionSupported (AudioFormat, AudioFormat)
  86  * isConversionSupported} may consider properties, depending on the respective
  87  * service provider implementation.
  88  * <p>
  89  * The following table lists some common properties which service providers
  90  * should use, if applicable:
  91  *
  92  * <table class="striped">
  93  * <caption>Audio Format Properties</caption>
  94  * <thead>
  95  *  <tr>
  96  *   <th>Property key</th>
  97  *   <th>Value type</th>
  98  *   <th>Description</th>
  99  *  </tr>
 100  * </thead>
 101  * <tbody>
 102  *  <tr>
 103  *   <td>&quot;bitrate&quot;</td>
 104  *   <td>{@link java.lang.Integer Integer}</td>
 105  *   <td>average bit rate in bits per second</td>
 106  *  </tr>
 107  *  <tr>
 108  *   <td>&quot;vbr&quot;</td>
 109  *   <td>{@link java.lang.Boolean Boolean}</td>
 110  *   <td>{@code true}, if the file is encoded in variable bit
 111  *       rate (VBR)</td>
 112  *  </tr>
 113  *  <tr>
 114  *   <td>&quot;quality&quot;</td>
 115  *   <td>{@link java.lang.Integer Integer}</td>
 116  *   <td>encoding/conversion quality, 1..100</td>
 117  *  </tr>
 118  * </tbody>
 119  * </table>
 120  * <p>
 121  * Vendors of service providers (plugins) are encouraged to seek information
 122  * about other already established properties in third party plugins, and follow
 123  * the same conventions.
 124  *
 125  * @author Kara Kytle
 126  * @author Florian Bomers
 127  * @see DataLine#getFormat
 128  * @see AudioInputStream#getFormat
 129  * @see AudioFileFormat
 130  * @see javax.sound.sampled.spi.FormatConversionProvider
 131  * @since 1.3
 132  */
 133 public class AudioFormat {
 134 
 135     /**
 136      * The audio encoding technique used by this format.
 137      */
 138     protected Encoding encoding;


< prev index next >