- java.lang.Object
-
- java.util.EventObject
-
- javax.sound.sampled.LineEvent
-
- All Implemented Interfaces:
- Serializable
public class LineEvent extends EventObject
TheLineEvent
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 itsupdate
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.- Since:
- 1.3
- See Also:
Line
,LineListener.update(javax.sound.sampled.LineEvent)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
LineEvent.Type
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
Constructors Constructor and Description LineEvent(Line line, LineEvent.Type type, long position)
Constructs a new event of the specified type, originating from the specified line.
-
Method Summary
Methods Modifier and Type Method and Description long
getFramePosition()
Obtains the position in the line's audio data when the event occurred, expressed in sample frames.Line
getLine()
Obtains the audio line that is the source of this event.LineEvent.Type
getType()
Obtains the event's type.String
toString()
Obtains a string representation of the event.-
Methods inherited from class java.util.EventObject
getSource
-
-
-
-
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 eventtype
- the event type (OPEN
,CLOSE
,START
, orSTOP
)position
- the number of sample frames that the line had already processed when the event occurred, orAudioSystem.NOT_SPECIFIED
- Throws:
IllegalArgumentException
- ifline
isnull
.
-
-
Method Detail
-
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 (
LineEvent.Type.OPEN
,LineEvent.Type.CLOSE
,LineEvent.Type.START
, orLineEvent.Type.STOP
)
-
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
andSTOP
. 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 beAudioSystem.NOT_SPECIFIED
.- Returns:
- the line's position as a sample frame number
-
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 classEventObject
- Returns:
- a string describing the event.
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
05/11/2024 22:04:34 Cette version de la page est en cache (à la date du 05/11/2024 22:04:34) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/sound/sampled/LineEvent.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.