0N/A/*
2362N/A * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.sound.sampled;
0N/A
0N/A
0N/A/**
0N/A * The <code>ReverbType</code> class provides methods for
0N/A * accessing various reverberation settings to be applied to
0N/A * an audio signal.
0N/A * <p>
0N/A * Reverberation simulates the reflection of sound off of
0N/A * the walls, ceiling, and floor of a room. Depending on
0N/A * the size of the room, and how absorbent or reflective the materials in the
0N/A * room's surfaces are, the sound might bounce around for a
0N/A * long time before dying away.
0N/A * <p>
0N/A * The reverberation parameters provided by <code>ReverbType</code> consist
0N/A * of the delay time and intensity of early reflections, the delay time and
0N/A * intensity of late reflections, and an overall decay time.
0N/A * Early reflections are the initial individual low-order reflections of the
0N/A * direct signal off the surfaces in the room.
0N/A * The late Relections are the dense, high-order reflections that characterize
0N/A * the room's reverberation.
0N/A * The delay times for the start of these two reflection types give the listener
0N/A * a sense of the overall size and complexity of the room's shape and contents.
0N/A * The larger the room, the longer the reflection delay times.
0N/A * The early and late reflections' intensities define the gain (in decibels) of the reflected
0N/A * signals as compared to the direct signal. These intensities give the
0N/A * listener an impression of the absorptive nature of the surfaces and objects
0N/A * in the room.
0N/A * The decay time defines how long the reverberation takes to exponentially
0N/A * decay until it is no longer perceptible ("effective zero").
0N/A * The larger and less absorbent the surfaces, the longer the decay time.
0N/A * <p>
0N/A * The set of parameters defined here may not include all aspects of reverberation
0N/A * as specified by some systems. For example, the Midi Manufacturer's Association
0N/A * (MMA) has an Interactive Audio Special Interest Group (IASIG), which has a
0N/A * 3-D Working Group that has defined a Level 2 Spec (I3DL2). I3DL2
0N/A * supports filtering of reverberation and
0N/A * control of reverb density. These properties are not included in the JavaSound 1.0
0N/A * definition of a reverb control. In such a case, the implementing system
0N/A * should either extend the defined reverb control to include additional
0N/A * parameters, or else interpret the system's additional capabilities in a way that fits
0N/A * the model described here.
0N/A * <p>
0N/A * If implementing JavaSound on a I3DL2-compliant device:
0N/A * <ul>
0N/A * <li>Filtering is disabled (high-frequency attenuations are set to 0.0 dB)
0N/A * <li>Density parameters are set to midway between minimum and maximum
0N/A * </ul>
0N/A * <p>
0N/A * The following table shows what parameter values an implementation might use for a
0N/A * representative set of reverberation settings.
0N/A * <p>
0N/A *
0N/A * <b>Reverberation Types and Parameters</b>
0N/A * <p>
0N/A * <table border=1 cellpadding=5 summary="reverb types and params: decay time, late intensity, late delay, early intensity, and early delay">
0N/A *
0N/A * <tr>
0N/A * <th>Type</th>
0N/A * <th>Decay Time (ms)</th>
0N/A * <th>Late Intensity (dB)</th>
0N/A * <th>Late Delay (ms)</th>
0N/A * <th>Early Intensity (dB)</th>
0N/A * <th>Early Delay(ms)</th>
0N/A * </tr>
0N/A *
0N/A * <tr>
0N/A * <td>Cavern</td>
0N/A * <td>2250</td>
0N/A * <td>-2.0</td>
0N/A * <td>41.3</td>
0N/A * <td>-1.4</td>
0N/A * <td>10.3</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
0N/A * <td>Dungeon</td>
0N/A * <td>1600</td>
0N/A * <td>-1.0</td>
0N/A * <td>10.3</td>
0N/A * <td>-0.7</td>
0N/A * <td>2.6</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
0N/A * <td>Garage</td>
0N/A * <td>900</td>
0N/A * <td>-6.0</td>
0N/A * <td>14.7</td>
0N/A * <td>-4.0</td>
0N/A * <td>3.9</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
0N/A * <td>Acoustic Lab</td>
0N/A * <td>280</td>
0N/A * <td>-3.0</td>
0N/A * <td>8.0</td>
0N/A * <td>-2.0</td>
0N/A * <td>2.0</td>
0N/A * </tr>
0N/A *
0N/A * <tr>
0N/A * <td>Closet</td>
0N/A * <td>150</td>
0N/A * <td>-10.0</td>
0N/A * <td>2.5</td>
0N/A * <td>-7.0</td>
0N/A * <td>0.6</td>
0N/A * </tr>
0N/A *
0N/A * </table>
0N/A *
0N/A * @author Kara Kytle
0N/A * @since 1.3
0N/A */
0N/Apublic class ReverbType {
0N/A
0N/A /**
0N/A * Descriptive name of the reverb type..
0N/A */
0N/A private String name;
0N/A
0N/A /**
0N/A * Early reflection delay in microseconds.
0N/A */
0N/A private int earlyReflectionDelay;
0N/A
0N/A /**
0N/A * Early reflection intensity.
0N/A */
0N/A private float earlyReflectionIntensity;
0N/A
0N/A /**
0N/A * Late reflection delay in microseconds.
0N/A */
0N/A private int lateReflectionDelay;
0N/A
0N/A /**
0N/A * Late reflection intensity.
0N/A */
0N/A private float lateReflectionIntensity;
0N/A
0N/A /**
0N/A * Total decay time
0N/A */
0N/A private int decayTime;
0N/A
0N/A
0N/A /**
0N/A * Constructs a new reverb type that has the specified reverberation
0N/A * parameter values.
0N/A * @param name the name of the new reverb type, or a zero-length <code>String</code>
0N/A * @param earlyReflectionDelay the new type's early reflection delay time in microseconds
0N/A * @param earlyReflectionIntensity the new type's early reflection intensity in dB
0N/A * @param lateReflectionDelay the new type's late reflection delay time in microseconds
0N/A * @param lateReflectionIntensity the new type's late reflection intensity in dB
0N/A * @param decayTime the new type's decay time in microseconds
0N/A */
0N/A protected ReverbType(String name, int earlyReflectionDelay, float earlyReflectionIntensity, int lateReflectionDelay, float lateReflectionIntensity, int decayTime) {
0N/A
0N/A this.name = name;
0N/A this.earlyReflectionDelay = earlyReflectionDelay;
0N/A this.earlyReflectionIntensity = earlyReflectionIntensity;
0N/A this.lateReflectionDelay = lateReflectionDelay;
0N/A this.lateReflectionIntensity = lateReflectionIntensity;
0N/A this.decayTime = decayTime;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Obtains the name of this reverb type.
0N/A * @return the name of this reverb type
0N/A * @since 1.5
0N/A */
0N/A public String getName() {
0N/A return name;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns the early reflection delay time in microseconds.
0N/A * This is the amount of time between when the direct signal is
0N/A * heard and when the first early reflections are heard.
0N/A * @return early reflection delay time for this reverb type, in microseconds
0N/A */
0N/A public final int getEarlyReflectionDelay() {
0N/A return earlyReflectionDelay;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns the early reflection intensity in decibels.
0N/A * This is the amplitude attenuation of the first early reflections
0N/A * relative to the direct signal.
0N/A * @return early reflection intensity for this reverb type, in dB
0N/A */
0N/A public final float getEarlyReflectionIntensity() {
0N/A return earlyReflectionIntensity;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns the late reflection delay time in microseconds.
0N/A * This is the amount of time between when the first early reflections
0N/A * are heard and when the first late reflections are heard.
0N/A * @return late reflection delay time for this reverb type, in microseconds
0N/A */
0N/A public final int getLateReflectionDelay() {
0N/A return lateReflectionDelay;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Returns the late reflection intensity in decibels.
0N/A * This is the amplitude attenuation of the first late reflections
0N/A * relative to the direct signal.
0N/A * @return late reflection intensity for this reverb type, in dB
0N/A */
0N/A public final float getLateReflectionIntensity() {
0N/A return lateReflectionIntensity;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Obtains the decay time, which is the amount of time over which the
0N/A * late reflections attenuate to effective zero. The effective zero
0N/A * value is implementation-dependent.
0N/A * @return the decay time of the late reflections, in microseconds
0N/A */
0N/A public final int getDecayTime() {
0N/A return decayTime;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Indicates whether the specified object is equal to this reverb type,
0N/A * returning <code>true</code> if the objects are identical.
0N/A * @param obj the reference object with which to compare
0N/A * @return <code>true</code> if this reverb type is the same as
0N/A * <code>obj</code>; <code>false</code> otherwise
0N/A */
0N/A public final boolean equals(Object obj) {
0N/A return super.equals(obj);
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Finalizes the hashcode method.
0N/A */
0N/A public final int hashCode() {
0N/A return super.hashCode();
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Provides a <code>String</code> representation of the reverb type,
0N/A * including its name and its parameter settings.
0N/A * The exact contents of the string may vary between implementations of
0N/A * Java Sound.
0N/A * @return reverberation type name and description
0N/A */
0N/A public final String toString() {
0N/A
0N/A //$$fb2001-07-20: fix for bug 4385060: The "name" attribute of class "ReverbType" is not accessible.
0N/A //return (super.toString() + ", early reflection delay " + earlyReflectionDelay +
0N/A return (name + ", early reflection delay " + earlyReflectionDelay +
0N/A " ns, early reflection intensity " + earlyReflectionIntensity +
0N/A " dB, late deflection delay " + lateReflectionDelay +
0N/A " ns, late reflection intensity " + lateReflectionIntensity +
0N/A " dB, decay time " + decayTime);
0N/A }
0N/A
0N/A} // class ReverbType