Drag[en]gine Script Module DragonScript
1.23
|
Behavior element behavior adding speaker support. More...
Classes | |
class | BlockListenerFactory |
Factory creating listeners using block. More... | |
class | DefaultListener |
Default implementation of behavior instance listener. More... | |
class | Instance |
Behavior instance. More... | |
interface | Listener |
Listener for behavior instance events. More... | |
interface | ListenerFactory |
Factory creating listeners. More... | |
Public Member Functions | |
void | addListenerFactory (Block blockFactory) |
Add listener factory using block. More... | |
void | addListenerFactory (ListenerFactory factory) |
Add listener factory. More... | |
void | createListeners (Instance instance) |
Create listeners from factories adding them to behavior instance. More... | |
void | dispose () |
Dispose of behavior. More... | |
void | forEachListenerFactory (Block ablock) |
Visit listener factories with block with argument ListenerFactory. More... | |
ECComposeAttachResource | getAttach () |
Attach resource. More... | |
ECBehaviorCollider | getCollider () |
Collider behavior or null to not attach. More... | |
ECComposeSpeaker | getSpeaker () |
Composeable speaker for element class. More... | |
ECBehaviorSpeaker | getSyncTrigger () |
ECBehaviorSpeaker to synchronize triggers with or null to disable. More... | |
ECBehaviorTriggered | getTrigger () |
Trigger playing. More... | |
ECBehaviorTriggered | getTriggerMuted () |
Trigger muted. More... | |
TSTriggerTable | getTriggerTable () |
Trigger table or null if not used. More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorSpeaker | new (BehaviorElementClass eclass, ECBehaviorCollider collider) |
Create behavior element class. More... | |
ECBehaviorSpeaker | new (BehaviorElementClass eclass, ECBehaviorCollider collider, Loaders loaders, TSTriggerTable triggerTable) |
Create behavior element class. More... | |
ECBehaviorSpeaker | new (BehaviorElementClass eclass, ECBehaviorCollider collider, Loaders loaders, TSTriggerTable triggerTable, String id) |
Create behavior element class. More... | |
ECBehaviorSpeaker | new (BehaviorElementClass eclass, ECBehaviorCollider collider, Loaders loaders, TSTriggerTable triggerTable, String id, String subID) |
ECBehaviorSpeaker | new (BehaviorElementClass eclass, ECBehaviorCollider collider, Loaders loaders, TSTriggerTable triggerTable, String id, String subID, String prefix) |
ECBehaviorSpeaker | new (BehaviorElementClass eclass, ECBehaviorCollider collider, String id) |
Create behavior element class. More... | |
void | set (String sound, float range, float volume, Vector position) |
void | set (String sound, float range, float volume, Vector position, Vector orientation) |
void | set (String sound, float range, float volume, Vector position, Vector orientation, String bone) |
void | setSyncTrigger (ECBehaviorSpeaker behavior) |
Set ECBehaviorSpeaker to synchronize triggers with or null to disable. More... | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
String | getID () |
Identifier. More... | |
int | getInstanceIndex () |
Instance index. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Public Member Functions inherited from Dragengine.Scenery.ECBehavior | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
Static Public Member Functions | |
static ECBehaviorSpeaker | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
Protected Member Functions | |
void | setTriggerTable (Loaders loaders, TSTriggerTable triggerTable) |
Set trigger table or null if not used. More... | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
DefaultECBehavior | new (BehaviorElementClass eclass) |
Create default composeable behavior with empty identifier. More... | |
DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
Create default composeable behavior. More... | |
void | setBehaviorID (String identifier) |
Set behavior identifier. More... | |
void | useClassNameAsBehaviorID () |
Set behavior identifier to "<class-name>:<identifier>". More... | |
void | useFullyQualifiedClassNameAsBehaviorID () |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More... | |
Behavior element behavior adding speaker support.
Behavior adds a Speaker resource to the the behavior element. This behavior can be added multiple times to an element. Each instance creates one speaker attached to the element collider which can be individually modified. To distinguish the speakers each instance has an identifier which can be used to retrieve a specific instance. Hence to use more than one speaker use code like this in your subclass constructor:
You can now define the parameters to use for both speakers using for example the properties "speaker.volume" for the first speaker and "speaker(subSpeaker).volume" for the second speaker.
It is recommended to always specify an identifier even if only one speaker is used. This avoids potentially name conflicts especially if other behaviors are added attaching other resources too.
If the ECBehaviorCollider behavior is present in the behavior element before this behavior is added the speaker is attached. The speaker is attached to the named bone if defined otherwise it is attached statically.
Element class properties have the prefix "speaker{(id)}.".
This behavior does require the element class to be persistable (setPersistable).
Speakers can play either a static Sound resource or use a Synthesizer. By using a synthesizer dynamic sound can be played. To use a synthesizer use the "speaker{(id)}.synthesizer" property instead of the "speaker{(id)}.sound" property. If both properties are present the synthesizer one is used if valid otherwise sound.
If synthesizer is valid a SynthesizerInstance will be created. Subclasses of ECBehaviorSpeaker or other behaviors can then obtain SynthesizerController from the SynthesizerInstance to modify the played sound. Since controllers use curves behaviors have to set the value ahead of time before playing back the speaker. It is possible to change the controller curves while sound is playing. In this case though care has to be taken to be set the curve early enough since audio modules typically render sound into buffered blocks. If the curve is changed too late the changes can be missed or result in strange sound jumping.
void Dragengine.Scenery.ECBehaviorSpeaker.addListenerFactory | ( | Block | blockFactory | ) |
void Dragengine.Scenery.ECBehaviorSpeaker.addListenerFactory | ( | ListenerFactory | factory | ) |
Add listener factory.
void Dragengine.Scenery.ECBehaviorSpeaker.createListeners | ( | Instance | instance | ) |
Create listeners from factories adding them to behavior instance.
void Dragengine.Scenery.ECBehaviorSpeaker.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
void Dragengine.Scenery.ECBehaviorSpeaker.forEachListenerFactory | ( | Block | ablock | ) |
Visit listener factories with block with argument ListenerFactory.
ECComposeAttachResource Dragengine.Scenery.ECBehaviorSpeaker.getAttach | ( | ) |
Attach resource.
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorCollider.
ECBehaviorCollider Dragengine.Scenery.ECBehaviorSpeaker.getCollider | ( | ) |
Collider behavior or null to not attach.
ECComposeSpeaker Dragengine.Scenery.ECBehaviorSpeaker.getSpeaker | ( | ) |
Composeable speaker for element class.
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.getSyncTrigger | ( | ) |
ECBehaviorSpeaker to synchronize triggers with or null to disable.
ECBehaviorTriggered Dragengine.Scenery.ECBehaviorSpeaker.getTrigger | ( | ) |
Trigger playing.
ECBehaviorTriggered Dragengine.Scenery.ECBehaviorSpeaker.getTriggerMuted | ( | ) |
Trigger muted.
TSTriggerTable Dragengine.Scenery.ECBehaviorSpeaker.getTriggerTable | ( | ) |
Trigger table or null if not used.
Instance Dragengine.Scenery.ECBehaviorSpeaker.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider | ||
) |
Create behavior element class.
These value are optional and can be null: collider.
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
Loaders | loaders, | ||
TSTriggerTable | triggerTable | ||
) |
Create behavior element class.
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
String | id | ||
) |
Create behavior element class.
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
String | id, | ||
String | subID | ||
) |
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
Loaders | loaders, | ||
TSTriggerTable | triggerTable, | ||
String | id, | ||
String | subID, | ||
String | prefix | ||
) |
ECBehaviorSpeaker Dragengine.Scenery.ECBehaviorSpeaker.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
String | id | ||
) |
Create behavior element class.
void Dragengine.Scenery.ECBehaviorSpeaker.set | ( | String | sound, |
float | range, | ||
float | volume, | ||
Vector | position | ||
) |
void Dragengine.Scenery.ECBehaviorSpeaker.set | ( | String | sound, |
float | range, | ||
float | volume, | ||
Vector | position, | ||
Vector | orientation | ||
) |
void Dragengine.Scenery.ECBehaviorSpeaker.set | ( | String | sound, |
float | range, | ||
float | volume, | ||
Vector | position, | ||
Vector | orientation, | ||
String | bone | ||
) |
void Dragengine.Scenery.ECBehaviorSpeaker.setSyncTrigger | ( | ECBehaviorSpeaker | behavior | ) |
Set ECBehaviorSpeaker to synchronize triggers with or null to disable.
|
protected |
Set trigger table or null if not used.