jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java
author serb
Thu, 31 Aug 2017 13:00:23 -0700
changeset 47195 b309b58eb190
parent 45012 4e9dedef0231
permissions -rw-r--r--
8181566: JavaSound javadoc clarification Reviewed-by: amenkov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
     2
 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.sound.sampled;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    28
import java.util.EventObject;
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    29
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    31
 * The {@code LineEvent} class encapsulates information that a line sends its
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    32
 * listeners whenever the line opens, closes, starts, or stops. Each of these
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    33
 * four state changes is represented by a corresponding type of event. A
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    34
 * listener receives the event as a parameter to its
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    35
 * {@link LineListener#update update} method. By querying the event, the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    36
 * listener can learn the type of event, the line responsible for the event, and
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    37
 * how much data the line had processed when the event occurred.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    38
 * <p>
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    39
 * Although this class implements Serializable, attempts to serialize a
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    40
 * {@code LineEvent} object will fail.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @author Kara Kytle
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @see Line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @see LineListener#update
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @serial exclude
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    49
public class LineEvent extends EventObject {
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    50
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
    51
    /**
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
    52
     * Use serialVersionUID from JDK 1.3 for interoperability.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
    53
     */
22949
459e9fe0bbf8 8034046: Fix serial lint warnings in javax.sound
darcy
parents: 5506
diff changeset
    54
    private static final long serialVersionUID = -1274246333383880410L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    57
     * The kind of line event ({@code OPEN}, {@code CLOSE}, {@code START}, or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    58
     * {@code STOP}).
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    59
     *
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
    60
     * @see #getType
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    61
     * @serial
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private final Type type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * The media position when the event occurred, expressed in sample frames.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    67
     * Note that this field is only relevant to certain events generated by data
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    68
     * lines, such as {@code START} and {@code STOP}. For events generated by
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    69
     * lines that do not count sample frames, and for any other events for which
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    70
     * this value is not known, the position value should be
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    71
     * {@link AudioSystem#NOT_SPECIFIED}.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    72
     *
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
    73
     * @see #getFramePosition
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private final long position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    79
     * Constructs a new event of the specified type, originating from the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    80
     * specified line.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    82
     * @param  line the source of this event
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    83
     * @param  type the event type ({@code OPEN}, {@code CLOSE}, {@code START},
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    84
     *         or {@code STOP})
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    85
     * @param  position the number of sample frames that the line had already
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    86
     *         processed when the event occurred, or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    87
     *         {@link AudioSystem#NOT_SPECIFIED}
32871
f013b86386e6 6646604: Typos in documentation
serb
parents: 25859
diff changeset
    88
     * @throws IllegalArgumentException if {@code line} is {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    public LineEvent(Line line, Type type, long position) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        super(line);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        this.type = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        this.position = position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Obtains the audio line that is the source of this event.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    99
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @return the line responsible for this event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public final Line getLine() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        return (Line)getSource();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Obtains the event's type.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   109
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @return this event's type ({@link Type#OPEN}, {@link Type#CLOSE},
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   111
     *         {@link Type#START}, or {@link Type#STOP})
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public final Type getType() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        return type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   119
     * Obtains the position in the line's audio data when the event occurred,
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   120
     * expressed in sample frames. For example, if a source line had already
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   121
     * played back 14 sample frames at the time it was paused, the pause event
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   122
     * would report the line's position as 14. The next frame to be processed
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   123
     * would be frame number 14 using zero-based numbering, or 15 using
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   124
     * one-based numbering.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   126
     * Note that this field is relevant only to certain events generated by data
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   127
     * lines, such as {@code START} and {@code STOP}. For events generated by
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   128
     * lines that do not count sample frames, and for any other events for which
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   129
     * this value is not known, the position value should be
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   130
     * {@link AudioSystem#NOT_SPECIFIED}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @return the line's position as a sample frame number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    /*
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   135
     * $$kk: 04.20.99: note to myself: should make sure our implementation is
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   136
     * consistent with this.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * which is a reasonable definition....
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public final long getFramePosition() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   145
     * Obtains a string representation of the event. The contents of the string
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   146
     * may vary between implementations of Java Sound.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   147
     *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   148
     * @return a string describing the event
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   150
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        String sType = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        if (type != null) sType = type.toString()+" ";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        String sLine;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        if (getLine() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            sLine = "null";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            sLine = getLine().toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        return new String(sType + "event from line " + sLine);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   164
     * The LineEvent.Type inner class identifies what kind of event occurred on
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   165
     * a line. Static instances are provided for the common types (OPEN, CLOSE,
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   166
     * START, and STOP).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @see LineEvent#getType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    public static class Type {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
         * Type name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
         */
40444
afabcfc2f3ef 8163949: Cleanup of classes which are related to JavaSound
serb
parents: 32871
diff changeset
   175
        private final String name;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
         * Constructs a new event type.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   179
         *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   180
         * @param  name name of the type
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        protected Type(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   186
        //$$fb 2002-11-26: fix for 4695001: SPEC: description of equals() method contains typo
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
         * Indicates whether the specified object is equal to this event type,
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   190
         * returning {@code true} if the objects are the same.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   191
         *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   192
         * @param  obj the reference object with which to compare
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   193
         * @return {@code true} if the specified object is equal to this event
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   194
         *         type; {@code false} otherwise
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
         */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   196
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        public final boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            return super.equals(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        /**
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   202
         * Returns a hash code value for this event type.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   203
         *
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   204
         * @return a hash code value for this event type
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
         */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   206
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        public final int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            return super.hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
         * Returns the type name as the string representation.
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   213
         *
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   214
         * @return the type name as the string representation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
         */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   216
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        // LINE EVENT TYPE DEFINES
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
         * A type of event that is sent when a line opens, reserving system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
         * resources for itself.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   226
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
         * @see #CLOSE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
         * @see Line#open
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   230
        public static final Type OPEN = new Type("Open");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
         * A type of event that is sent when a line closes, freeing the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
         * resources it had obtained when it was opened.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   235
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
         * @see #OPEN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
         * @see Line#close
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   239
        public static final Type CLOSE = new Type("Close");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
         * A type of event that is sent when a line begins to engage in active
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
         * input or output of audio data in response to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
         * {@link DataLine#start start} request.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   245
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
         * @see #STOP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
         * @see DataLine#start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   249
        public static final Type START = new Type("Start");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   252
         * A type of event that is sent when a line ceases active input or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   253
         * output of audio data in response to a {@link DataLine#stop stop}
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   254
         * request, or because the end of media has been reached.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   255
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
         * @see #START
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
         * @see DataLine#stop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   259
        public static final Type STOP = new Type("Stop");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
         * A type of event that is sent when a line ceases to engage in active
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   263
         * input or output of audio data because the end of media has been
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   264
         * reached.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        /*
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   267
         * ISSUE: we may want to get rid of this. Is JavaSound responsible for
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   268
         * reporting this??
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
         *
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   270
         * [If it's decided to keep this API, the docs will need to be updated
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   271
         * to include mention of EOM events elsewhere.]
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        //public static final Type EOM  = new Type("EOM");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
         * A type of event that is sent when a line begins to engage in active
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   277
         * input or output of audio data. Examples of when this happens are when
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   278
         * a source line begins or resumes writing data to its mixer, and when a
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   279
         * target line begins or resumes reading data from its mixer.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   280
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
         * @see #STOP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
         * @see SourceDataLine#write
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
         * @see TargetDataLine#read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
         * @see DataLine#start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        //public static final Type ACTIVE       = new Type("ACTIVE");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        /**
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   289
         * A type of event that is sent when a line ceases active input or
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   290
         * output of audio data.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   291
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
         * @see #START
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
         * @see DataLine#stop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        //public static final Type INACTIVE     = new Type("INACTIVE");
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   296
    }
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   297
}