src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java
author darcy
Tue, 24 Sep 2019 18:25:54 -0700
changeset 58309 c6f8b2c3dc66
parent 50832 e069b9e49ca7
permissions -rw-r--r--
8231334: Suppress warnings on non-serializable instance fields in client libs serializable classes Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
50832
e069b9e49ca7 8205456: Unification of iterations over arrays
serb
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2018, 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
     */
58309
c6f8b2c3dc66 8231334: Suppress warnings on non-serializable instance fields in client libs serializable classes
darcy
parents: 50832
diff changeset
    63
    @SuppressWarnings("serial") // Not statically typed as Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    private final Type type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * 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
    68
     * 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
    69
     * 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
    70
     * 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
    71
     * this value is not known, the position value should be
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    72
     * {@link AudioSystem#NOT_SPECIFIED}.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    73
     *
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
    74
     * @see #getFramePosition
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    private final long position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    80
     * 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
    81
     * specified line.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    83
     * @param  line the source of this event
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    84
     * @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
    85
     *         or {@code STOP})
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    86
     * @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
    87
     *         processed when the event occurred, or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
    88
     *         {@link AudioSystem#NOT_SPECIFIED}
32871
f013b86386e6 6646604: Typos in documentation
serb
parents: 25859
diff changeset
    89
     * @throws IllegalArgumentException if {@code line} is {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public LineEvent(Line line, Type type, long position) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        super(line);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        this.type = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        this.position = position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * 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
   100
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @return the line responsible for this event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public final Line getLine() {
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
        return type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   118
     * 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
   119
     * 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
   120
     * 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
   121
     * 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
   122
     * 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
   123
     * one-based numbering.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   125
     * 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
   126
     * 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
   127
     * 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
   128
     * this value is not known, the position value should be
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   129
     * {@link AudioSystem#NOT_SPECIFIED}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @return the line's position as a sample frame number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /*
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   134
     * $$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
   135
     * consistent with this.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * which is a reasonable definition....
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    public final long getFramePosition() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        return position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   143
     * 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
   144
     * may vary between implementations of Java Sound.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   145
     *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   146
     * @return a string describing the event
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   148
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        String sType = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        if (type != null) sType = type.toString()+" ";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        String sLine;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        if (getLine() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            sLine = "null";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            sLine = getLine().toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        return new String(sType + "event from line " + sLine);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   162
     * 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
   163
     * 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
   164
     * START, and STOP).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @see LineEvent#getType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public static class Type {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
         * Type name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
         */
40444
afabcfc2f3ef 8163949: Cleanup of classes which are related to JavaSound
serb
parents: 32871
diff changeset
   173
        private final String name;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
         * Constructs a new event type.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   177
         *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   178
         * @param  name name of the type
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        protected Type(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   184
        //$$fb 2002-11-26: fix for 4695001: SPEC: description of equals() method contains typo
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
         * Indicates whether the specified object is equal to this event type,
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   188
         * returning {@code true} if the objects are the same.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   189
         *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   190
         * @param  obj the reference object with which to compare
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   191
         * @return {@code true} if the specified object is equal to this event
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   192
         *         type; {@code false} otherwise
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
         */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   194
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        public final boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            return super.equals(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        /**
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   200
         * Returns a hash code value for this event type.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   201
         *
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   202
         * @return a hash code value for this event type
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
         */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   204
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        public final int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            return super.hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
         * Returns the type name as the string representation.
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   211
         *
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   212
         * @return the type name as the string representation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
         */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   214
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        // LINE EVENT TYPE DEFINES
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
         * A type of event that is sent when a line opens, reserving system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
         * resources for itself.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   224
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
         * @see #CLOSE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
         * @see Line#open
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   228
        public static final Type OPEN = new Type("Open");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
         * A type of event that is sent when a line closes, freeing the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
         * resources it had obtained when it was opened.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   233
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
         * @see #OPEN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
         * @see Line#close
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   237
        public static final Type CLOSE = new Type("Close");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
         * A type of event that is sent when a line begins to engage in active
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
         * input or output of audio data in response to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
         * {@link DataLine#start start} request.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   243
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
         * @see #STOP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
         * @see DataLine#start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   247
        public static final Type START = new Type("Start");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   250
         * 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
   251
         * 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
   252
         * request, or because the end of media has been reached.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   253
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
         * @see #START
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
         * @see DataLine#stop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
         */
45012
4e9dedef0231 8178971: Uncommon formatting and typos in java.desktop module
serb
parents: 40444
diff changeset
   257
        public static final Type STOP = new Type("Stop");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
         * 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
   261
         * input or output of audio data because the end of media has been
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   262
         * reached.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        /*
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   265
         * ISSUE: we may want to get rid of this. Is JavaSound responsible for
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   266
         * reporting this??
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
         *
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   268
         * [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
   269
         * to include mention of EOM events elsewhere.]
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        //public static final Type EOM  = new Type("EOM");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
         * 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
   275
         * input or output of audio data. Examples of when this happens are when
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   276
         * a source line begins or resumes writing data to its mixer, and when a
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   277
         * target line begins or resumes reading data from its mixer.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   278
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
         * @see #STOP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
         * @see SourceDataLine#write
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
         * @see TargetDataLine#read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
         * @see DataLine#start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        //public static final Type ACTIVE       = new Type("ACTIVE");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        /**
47195
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   287
         * A type of event that is sent when a line ceases active input or
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   288
         * output of audio data.
b309b58eb190 8181566: JavaSound javadoc clarification
serb
parents: 45012
diff changeset
   289
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
         * @see #START
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
         * @see DataLine#stop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        //public static final Type INACTIVE     = new Type("INACTIVE");
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   294
    }
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 22949
diff changeset
   295
}