Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sound/sampled/Control.java
38918 views
/*1* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sound.sampled;2627/**28* {@link Line Lines} often have a set of controls, such as gain and pan, that affect29* the audio signal passing through the line. Java Sound's <code>Line</code> objects30* let you obtain a particular control object by passing its class as the31* argument to a {@link Line#getControl(Control.Type) getControl} method.32* <p>33* Because the various types of controls have different purposes and features,34* all of their functionality is accessed from the subclasses that define35* each kind of control.36*37* @author Kara Kytle38*39* @see Line#getControls40* @see Line#isControlSupported41* @since 1.342*/43public abstract class Control {444546// INSTANCE VARIABLES4748/**49* The control type.50*/51private final Type type;52535455// CONSTRUCTORS5657/**58* Constructs a Control with the specified type.59* @param type the kind of control desired60*/61protected Control(Type type) {62this.type = type;63}646566// METHODS6768/**69* Obtains the control's type.70* @return the control's type.71*/72public Type getType() {73return type;74}757677// ABSTRACT METHODS7879/**80* Obtains a String describing the control type and its current state.81* @return a String representation of the Control.82*/83public String toString() {84return new String(getType() + " Control");85}868788/**89* An instance of the <code>Type</code> class represents the type of90* the control. Static instances are provided for the91* common types.92*/93public static class Type {9495// CONTROL TYPE DEFINES9697// INSTANCE VARIABLES9899/**100* Type name.101*/102private String name;103104105// CONSTRUCTOR106107/**108* Constructs a new control type with the name specified.109* The name should be a descriptive string appropriate for110* labelling the control in an application, such as "Gain" or "Balance."111* @param name the name of the new control type.112*/113protected Type(String name) {114this.name = name;115}116117118// METHODS119120/**121* Finalizes the equals method122*/123public final boolean equals(Object obj) {124return super.equals(obj);125}126127/**128* Finalizes the hashCode method129*/130public final int hashCode() {131return super.hashCode();132}133134/**135* Provides the <code>String</code> representation of the control type. This <code>String</code> is136* the same name that was passed to the constructor.137*138* @return the control type name139*/140public final String toString() {141return name;142}143} // class Type144145} // class Control146147148