Package com.jme3.cinematic.events
Class SoundEvent
java.lang.Object
com.jme3.cinematic.events.AbstractCinematicEvent
com.jme3.cinematic.events.SoundEvent
- All Implemented Interfaces:
CinematicEvent
,Savable
- Direct Known Subclasses:
SoundTrack
A sound track to be played in a cinematic.
-
Field Summary
Fields inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
initialDuration, listeners, loopMode, playState, resuming, speed, time
-
Constructor Summary
ConstructorDescriptioncreates a sound event used for serializationSoundEvent
(String path) creates a sound track from the given resource pathSoundEvent
(String path, boolean stream) creates a sound track from the given resource pathSoundEvent
(String path, boolean stream, float initialDuration) creates a sound track from the given resource pathSoundEvent
(String path, boolean stream, float initialDuration, LoopMode loopMode) creates a sound track from the given resource pathSoundEvent
(String path, boolean stream, LoopMode loopMode) creates a sound track from the given resource pathSoundEvent
(String path, float initialDuration) creates a sound track from the given resource pathSoundEvent
(String path, float initialDuration, LoopMode loopMode) creates a sound track from the given resource pathSoundEvent
(String path, LoopMode loopMode) creates a sound track from the given resource path -
Method Summary
Modifier and TypeMethodDescriptionReturns the underlying audio node of this sound trackvoid
initEvent
(Application app, Cinematic cinematic) Initialize this event (called internally only).void
onPause()
Implement this method with code that you want to execute when the event is paused.void
onPlay()
Implement this method with code that you want to execute when the event is started.void
onStop()
Implement this method with code that you want to execute when the event is stopped.void
onUpdate
(float tpf) Implement this method with the code that you want to execute on update (only called when the event is playing).void
read
(JmeImporter im) Used for serialization only.void
setLoopMode
(LoopMode loopMode) Sets the loopMode of the animation.void
setTime
(float time) Fast-forwards the event to the given timestamp.void
write
(JmeExporter ex) Used for serialization only.Methods inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
addListener, dispose, forceStop, getDuration, getInitialDuration, getLoopMode, getPlayState, getSpeed, getTime, internalUpdate, pause, play, removeListener, setInitialDuration, setSpeed, stop
-
Field Details
-
path
-
audioNode
-
stream
protected boolean stream
-
-
Constructor Details
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")stream
- true to make the audio data streamed
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")stream
- true to make the audio data streamedinitialDuration
- the initial duration of the event
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")stream
- true to make the audio data streamedloopMode
- the loopMode- See Also:
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")stream
- true to make the audio data streamedinitialDuration
- the initial duration of the eventloopMode
- the loopMode- See Also:
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")initialDuration
- the initial duration of the event
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")loopMode
- the loopMode- See Also:
-
SoundEvent
creates a sound track from the given resource path- Parameters:
path
- the path to an audio file (ie : "Sounds/mySound.wav")initialDuration
- the initial duration of the eventloopMode
- the loopMode- See Also:
-
SoundEvent
public SoundEvent()creates a sound event used for serialization
-
-
Method Details
-
initEvent
Description copied from class:AbstractCinematicEvent
Initialize this event (called internally only).- Specified by:
initEvent
in interfaceCinematicEvent
- Overrides:
initEvent
in classAbstractCinematicEvent
- Parameters:
app
- ignoredcinematic
- ignored
-
setTime
public void setTime(float time) Description copied from class:AbstractCinematicEvent
Fast-forwards the event to the given timestamp. Time=0 is the start of the event.- Specified by:
setTime
in interfaceCinematicEvent
- Overrides:
setTime
in classAbstractCinematicEvent
- Parameters:
time
- the time to fast-forward to.
-
onPlay
public void onPlay()Description copied from class:AbstractCinematicEvent
Implement this method with code that you want to execute when the event is started.- Specified by:
onPlay
in classAbstractCinematicEvent
-
onStop
public void onStop()Description copied from class:AbstractCinematicEvent
Implement this method with code that you want to execute when the event is stopped.- Specified by:
onStop
in classAbstractCinematicEvent
-
onPause
public void onPause()Description copied from class:AbstractCinematicEvent
Implement this method with code that you want to execute when the event is paused.- Specified by:
onPause
in classAbstractCinematicEvent
-
onUpdate
public void onUpdate(float tpf) Description copied from class:AbstractCinematicEvent
Implement this method with the code that you want to execute on update (only called when the event is playing).- Specified by:
onUpdate
in classAbstractCinematicEvent
- Parameters:
tpf
- time per frame
-
getAudioNode
Returns the underlying audio node of this sound track- Returns:
- the pre-existing instance
-
setLoopMode
Description copied from class:AbstractCinematicEvent
Sets the loopMode of the animation.- Specified by:
setLoopMode
in interfaceCinematicEvent
- Overrides:
setLoopMode
in classAbstractCinematicEvent
- Parameters:
loopMode
- the desired mode (default=DontLoop)- See Also:
-
write
Description copied from class:AbstractCinematicEvent
Used for serialization only.- Specified by:
write
in interfaceSavable
- Overrides:
write
in classAbstractCinematicEvent
- Parameters:
ex
- exporter- Throws:
IOException
- from the exporter
-
read
Description copied from class:AbstractCinematicEvent
Used for serialization only.- Specified by:
read
in interfaceSavable
- Overrides:
read
in classAbstractCinematicEvent
- Parameters:
im
- importer- Throws:
IOException
- from the importer
-