1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
/* * @(#)Control.java 1.26 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.sound.sampled; /** * {@link Line Lines} often have a set of controls, such as gain and pan, that affect * the audio signal passing through the line. Java Sound's <code>Line</code> objects * let you obtain a particular control object by passing its class as the * argument to a {@link Line#getControl(Control.Type) getControl} method. * <p> * Because the various types of controls have different purposes and features, * all of their functionality is accessed from the subclasses that define * each kind of control. * * @author Kara Kytle * @version 1.26, 05/11/17 * * @see Line#getControls * @see Line#isControlSupported * @since 1.3 */ public abstract class Control { // INSTANCE VARIABLES /** * The control type. */ private final Type type; // CONSTRUCTORS /** * Constructs a Control with the specified type. * @param type the kind of control desired */ protected Control(Type type) { this.type = type; } // METHODS /** * Obtains the control's type. * @return the control's type. */ public Type getType() { return type; } // ABSTRACT METHODS /** * Obtains a String describing the control type and its current state. * @return a String representation of the Control. */ public String toString() { return new String(getType() + " Control"); } /** * An instance of the <code>Type</code> class represents the type of * the control. Static instances are provided for the * common types. */ public static class Type { // CONTROL TYPE DEFINES // INSTANCE VARIABLES /** * Type name. */ private String name; // CONSTRUCTOR /** * Constructs a new control type with the name specified. * The name should be a descriptive string appropriate for * labelling the control in an application, such as "Gain" or "Balance." * @param name the name of the new control type. */ protected Type(String name) { this.name = name; } // METHODS /** * Finalizes the equals method */ public final boolean equals(Object obj) { return super.equals(obj); } /** * Finalizes the hashCode method */ public final int hashCode() { return super.hashCode(); } /** * Provides the <code>String</code> representation of the control type. This <code>String</code> is * the same name that was passed to the constructor. * * @return the control type name */ public final String toString() { return name; } } // class Type } // class Control