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
FieldsFields inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
initialDuration, listeners, loopMode, playState, resuming, speed, time -
Constructor Summary
ConstructorsConstructorDescriptioncreates 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 trackvoidinitEvent(Application app, Cinematic cinematic) Initialize this event (called internally only).voidonPause()Implement this method with code that you want to execute when the event is paused.voidonPlay()Implement this method with code that you want to execute when the event is started.voidonStop()Implement this method with code that you want to execute when the event is stopped.voidonUpdate(float tpf) Implement this method with the code that you want to execute on update (only called when the event is playing).voidread(JmeImporter im) Used for serialization only.voidsetLoopMode(LoopMode loopMode) Sets the loopMode of the animation.voidsetTime(float time) Fast-forwards the event to the given timestamp.voidwrite(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:AbstractCinematicEventInitialize this event (called internally only).- Specified by:
initEventin interfaceCinematicEvent- Overrides:
initEventin classAbstractCinematicEvent- Parameters:
app- ignoredcinematic- ignored
-
setTime
public void setTime(float time) Description copied from class:AbstractCinematicEventFast-forwards the event to the given timestamp. Time=0 is the start of the event.- Specified by:
setTimein interfaceCinematicEvent- Overrides:
setTimein classAbstractCinematicEvent- Parameters:
time- the time to fast-forward to.
-
onPlay
public void onPlay()Description copied from class:AbstractCinematicEventImplement this method with code that you want to execute when the event is started.- Specified by:
onPlayin classAbstractCinematicEvent
-
onStop
public void onStop()Description copied from class:AbstractCinematicEventImplement this method with code that you want to execute when the event is stopped.- Specified by:
onStopin classAbstractCinematicEvent
-
onPause
public void onPause()Description copied from class:AbstractCinematicEventImplement this method with code that you want to execute when the event is paused.- Specified by:
onPausein classAbstractCinematicEvent
-
onUpdate
public void onUpdate(float tpf) Description copied from class:AbstractCinematicEventImplement this method with the code that you want to execute on update (only called when the event is playing).- Specified by:
onUpdatein 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:AbstractCinematicEventSets the loopMode of the animation.- Specified by:
setLoopModein interfaceCinematicEvent- Overrides:
setLoopModein classAbstractCinematicEvent- Parameters:
loopMode- the desired mode (default=DontLoop)- See Also:
-
write
Description copied from class:AbstractCinematicEventUsed for serialization only.- Specified by:
writein interfaceSavable- Overrides:
writein classAbstractCinematicEvent- Parameters:
ex- exporter- Throws:
IOException- from the exporter
-
read
Description copied from class:AbstractCinematicEventUsed for serialization only.- Specified by:
readin interfaceSavable- Overrides:
readin classAbstractCinematicEvent- Parameters:
im- importer- Throws:
IOException- from the importer
-