< prev index next >

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

Print this page

        

@@ -38,10 +38,11 @@
  * Every data line has an audio format associated with its data stream. The
  * audio format of a source (playback) data line indicates what kind of data the
  * data line expects to receive for output. For a target (capture) data line,
  * the audio format specifies the kind of the data that can be read from the
  * line.
+ * <p>
  * Sound files also have audio formats, of course. The {@link AudioFileFormat}
  * class encapsulates an {@code AudioFormat} in addition to other, file-specific
  * information. Similarly, an {@link AudioInputStream} has an
  * {@code AudioFormat}.
  * <p>

@@ -91,32 +92,27 @@
  *
  * <table class="striped">
  * <caption>Audio Format Properties</caption>
  * <thead>
  *  <tr>
- *   <th>Property key</th>
- *   <th>Value type</th>
- *   <th>Description</th>
- *  </tr>
+ *     <th>Property key
+ *     <th>Value type
+ *     <th>Description
  * </thead>
  * <tbody>
  *  <tr>
- *   <td>&quot;bitrate&quot;</td>
- *   <td>{@link java.lang.Integer Integer}</td>
- *   <td>average bit rate in bits per second</td>
- *  </tr>
+ *     <td>&quot;bitrate&quot;
+ *     <td>{@link java.lang.Integer Integer}
+ *     <td>average bit rate in bits per second
  *  <tr>
- *   <td>&quot;vbr&quot;</td>
- *   <td>{@link java.lang.Boolean Boolean}</td>
- *   <td>{@code true}, if the file is encoded in variable bit
- *       rate (VBR)</td>
- *  </tr>
+ *     <td>&quot;vbr&quot;
+ *     <td>{@link java.lang.Boolean Boolean}
+ *     <td>{@code true}, if the file is encoded in variable bit rate (VBR)
  *  <tr>
- *   <td>&quot;quality&quot;</td>
- *   <td>{@link java.lang.Integer Integer}</td>
- *   <td>encoding/conversion quality, 1..100</td>
- *  </tr>
+ *     <td>&quot;quality&quot;
+ *     <td>{@link java.lang.Integer Integer}
+ *     <td>encoding/conversion quality, 1..100
  * </tbody>
  * </table>
  * <p>
  * Vendors of service providers (plugins) are encouraged to seek information
  * about other already established properties in third party plugins, and follow

@@ -181,12 +177,12 @@
      * are further explained in the {@link AudioFormat class description}.
      *
      * @param  encoding the audio encoding technique
      * @param  sampleRate the number of samples per second
      * @param  sampleSizeInBits the number of bits in each sample
-     * @param  channels the number of channels (1 for mono, 2 for stereo,
-     *         and so on)
+     * @param  channels the number of channels (1 for mono, 2 for stereo, and so
+     *         on)
      * @param  frameSize the number of bytes in each frame
      * @param  frameRate the number of frames per second
      * @param  bigEndian indicates whether the data for a single sample is
      *         stored in big-endian byte order ({@code false} means
      *         little-endian)

@@ -215,11 +211,12 @@
      * @param  channels the number of channels (1 for mono, 2 for stereo, and so
      *         on)
      * @param  frameSize the number of bytes in each frame
      * @param  frameRate the number of frames per second
      * @param  bigEndian indicates whether the data for a single sample is
-     *         stored in big-endian byte order ({@code false} means little-endian)
+     *         stored in big-endian byte order ({@code false} means
+     *         little-endian)
      * @param  properties a {@code Map<String, Object>} object containing format
      *         properties
      * @since 1.5
      */
     public AudioFormat(Encoding encoding, float sampleRate,

@@ -274,13 +271,14 @@
         return encoding;
     }
 
     /**
      * Obtains the sample rate. For compressed formats, the return value is the
-     * sample rate of the uncompressed audio data. When this AudioFormat is used
-     * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
-     * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * sample rate of the uncompressed audio data. When this {@code AudioFormat}
+     * is used for queries (e.g.
+     * {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample rate
      * of {@code AudioSystem.NOT_SPECIFIED} means that any sample rate is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
      * sample rate is not defined for this audio format.
      *

@@ -294,14 +292,14 @@
         return sampleRate;
     }
 
     /**
      * Obtains the size of a sample. For compressed formats, the return value is
-     * the sample size of the uncompressed audio data. When this AudioFormat is
-     * used for queries (e.g. {@link AudioSystem#isConversionSupported(
-     * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
-     * capabilities (e.g.
+     * the sample size of the uncompressed audio data. When this
+     * {@code AudioFormat} is used for queries (e.g.
+     * {@link AudioSystem#isConversionSupported(AudioFormat,AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample size
      * of {@code AudioSystem.NOT_SPECIFIED} means that any sample size is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
      * sample size is not defined for this audio format.
      *

@@ -314,13 +312,13 @@
 
         return sampleSizeInBits;
     }
 
     /**
-     * Obtains the number of channels. When this AudioFormat is used for queries
-     * (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * Obtains the number of channels. When this {@code AudioFormat} is used for
+     * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+     * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a return
      * value of {@code AudioSystem.NOT_SPECIFIED} means that any (positive)
      * number of channels is acceptable.
      *
      * @return The number of channels (1 for mono, 2 for stereo, etc.), or

@@ -331,12 +329,12 @@
 
         return channels;
     }
 
     /**
-     * Obtains the frame size in bytes. When this AudioFormat is used for
-     * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+     * Obtains the frame size in bytes. When this {@code AudioFormat} is used
+     * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
      * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame size
      * of {@code AudioSystem.NOT_SPECIFIED} means that any frame size is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
      * frame size is not defined for this audio format.

@@ -350,14 +348,14 @@
 
         return frameSize;
     }
 
     /**
-     * Obtains the frame rate in frames per second. When this AudioFormat is
-     * used for queries (e.g. {@link AudioSystem#isConversionSupported(
-     * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
-     * capabilities (e.g.
+     * Obtains the frame rate in frames per second. When this
+     * {@code AudioFormat} is used for queries (e.g.
+     * {@link AudioSystem#isConversionSupported(AudioFormat,AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame rate
      * of {@code AudioSystem.NOT_SPECIFIED} means that any frame rate is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
      * frame rate is not defined for this audio format.
      *

@@ -549,13 +547,14 @@
      * The numbers may be signed or unsigned integers or floats. Besides PCM,
      * other encodings include mu-law and a-law, which are nonlinear mappings of
      * the sound amplitude that are often used for recording speech.
      * <p>
      * You can use a predefined encoding by referring to one of the static
-     * objects created by this class, such as PCM_SIGNED or PCM_UNSIGNED.
-     * Service providers can create new encodings, such as compressed audio
-     * formats, and make these available through the {@link AudioSystem} class.
+     * objects created by this class, such as {@code PCM_SIGNED} or
+     * {@code PCM_UNSIGNED}. Service providers can create new encodings, such as
+     * compressed audio formats, and make these available through the
+     * {@link AudioSystem} class.
      * <p>
      * The {@code Encoding} class is static, so that all {@code AudioFormat}
      * objects that have the same encoding will refer to the same object (rather
      * than different instances of the same class). This allows matches to be
      * made by checking that two format's encodings are equal.

@@ -607,11 +606,16 @@
         public Encoding(final String name) {
             this.name = name;
         }
 
         /**
-         * Finalizes the equals method.
+         * Indicates whether the specified object is equal to this encoding,
+         * returning {@code true} if the objects are the same.
+         *
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if this encoding is the same as the {@code obj}
+         *         argument; {@code false} otherwise
          */
         @Override
         public final boolean equals(final Object obj) {
             if (this == obj) {
                 return true;

@@ -621,11 +625,13 @@
             }
             return Objects.equals(name, ((Encoding) obj).name);
         }
 
         /**
-         * Finalizes the hashCode method.
+         * Returns a hash code value for this encoding.
+         *
+         * @return a hash code value for this encoding
          */
         @Override
         public final int hashCode() {
             return name != null ? name.hashCode() : 0;
         }
< prev index next >