src/share/classes/javax/sound/sampled/LineEvent.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29  * The <code>LineEvent</code> class encapsulates information that a line
  30  * sends its listeners whenever the line opens, closes, starts, or stops.
  31  * Each of these four state changes is represented by a corresponding
  32  * type of event.  A listener receives the event as a parameter to its
  33  * {@link LineListener#update update} method.  By querying the event,
  34  * the listener can learn the type of event, the line responsible for
  35  * the event, and how much data the line had processed when the event occurred.
  36  *
  37  * <p>Although this class implements Serializable, attempts to
  38  * serialize a <code>LineEvent</code> object will fail.
  39  *
  40  * @author Kara Kytle
  41  *
  42  * @see Line
  43  * @see LineListener#update
  44  * @since 1.3
  45  *
  46  * @serial exclude
  47  */
  48 public class LineEvent extends java.util.EventObject {

  49 
  50     // INSTANCE VARIABLES
  51 
  52     /**
  53      * The kind of line event (<code>OPEN</code>, <code>CLOSE</code>,
  54      * <code>START</code>, or <code>STOP</code>).
  55      * @see #getType
  56      * @serial
  57      */
  58     private final Type type;
  59 
  60     /**
  61      * The media position when the event occurred, expressed in sample frames.
  62      * Note that this field is only relevant to certain events generated by
  63      * data lines, such as <code>START</code> and <code>STOP</code>.  For
  64      * events generated by lines that do not count sample frames, and for any
  65      * other events for which this value is not known, the position value
  66      * should be {@link AudioSystem#NOT_SPECIFIED}.
  67      * @serial
  68      * @see #getFramePosition


   1 /*
   2  * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29  * The <code>LineEvent</code> class encapsulates information that a line
  30  * sends its listeners whenever the line opens, closes, starts, or stops.
  31  * Each of these four state changes is represented by a corresponding
  32  * type of event.  A listener receives the event as a parameter to its
  33  * {@link LineListener#update update} method.  By querying the event,
  34  * the listener can learn the type of event, the line responsible for
  35  * the event, and how much data the line had processed when the event occurred.
  36  *
  37  * <p>Although this class implements Serializable, attempts to
  38  * serialize a <code>LineEvent</code> object will fail.
  39  *
  40  * @author Kara Kytle
  41  *
  42  * @see Line
  43  * @see LineListener#update
  44  * @since 1.3
  45  *
  46  * @serial exclude
  47  */
  48 public class LineEvent extends java.util.EventObject {
  49     private static final long serialVersionUID = -1274246333383880410L;
  50 
  51     // INSTANCE VARIABLES
  52 
  53     /**
  54      * The kind of line event (<code>OPEN</code>, <code>CLOSE</code>,
  55      * <code>START</code>, or <code>STOP</code>).
  56      * @see #getType
  57      * @serial
  58      */
  59     private final Type type;
  60 
  61     /**
  62      * The media position when the event occurred, expressed in sample frames.
  63      * Note that this field is only relevant to certain events generated by
  64      * data lines, such as <code>START</code> and <code>STOP</code>.  For
  65      * events generated by lines that do not count sample frames, and for any
  66      * other events for which this value is not known, the position value
  67      * should be {@link AudioSystem#NOT_SPECIFIED}.
  68      * @serial
  69      * @see #getFramePosition