This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.sound.sampled
class LineEvent

java.lang.Object extended by java.util.EventObject extended by javax.sound.sampled.LineEvent
All Implemented Interfaces:
Serializable

public class LineEvent
extends EventObject

The LineEvent class encapsulates information that a line sends its listeners whenever the line opens, closes, starts, or stops. Each of these four state changes is represented by a corresponding type of event. A listener receives the event as a parameter to its {@link LineListener#update update} method. By querying the event, the listener can learn the type of event, the line responsible for the event, and how much data the line had processed when the event occurred.

Although this class implements Serializable, attempts to serialize a LineEvent object will fail.


Nested Class Summary
static class

           The LineEvent.Type inner class identifies what kind of event occurred on a line.
 
Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
LineEvent(Line line, LineEvent.Type type, long position)

          Constructs a new event of the specified type, originating from the specified line.
 
Method Summary
 long

          Obtains the position in the line's audio data when the event occurred, expressed in sample frames.
 Line

          Obtains the audio line that is the source of this event.
 LineEvent.Type

          Obtains the event's type.
 String

          Obtains a string representation of the event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineEvent

public LineEvent(Line line,
                 LineEvent.Type type,
                 long position)
Constructs a new event of the specified type, originating from the specified line.

Parameters:
line - the source of this event
type - the event type (OPEN, CLOSE, START, or STOP)
position - the number of sample frames that the line had already processed when the event occurred, or {@link AudioSystem#NOT_SPECIFIED}
Method Detail

getFramePosition

public final long getFramePosition()
Obtains the position in the line's audio data when the event occurred, expressed in sample frames. For example, if a source line had already played back 14 sample frames at the time it was paused, the pause event would report the line's position as 14. The next frame to be processed would be frame number 14 using zero-based numbering, or 15 using one-based numbering.

Note that this field is relevant only to certain events generated by data lines, such as START and STOP. For events generated by lines that do not count sample frames, and for any other events for which this value is not known, the position value should be {@link AudioSystem#NOT_SPECIFIED}.

Returns:
the line's position as a sample frame number

getLine

public final Line getLine()
Obtains the audio line that is the source of this event.

Returns:
the line responsible for this event

getType

public final LineEvent.Type getType()
Obtains the event's type.

Returns:
this event's type ({@link Type#OPEN}, {@link Type#CLOSE}, {@link Type#START}, or {@link Type#STOP})

toString

public String toString()
Obtains a string representation of the event. The contents of the string may vary between implementations of Java Sound.

Overrides:
toString in class EventObject
Returns:
a string describing the event.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.