This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_speaker [2025/03/13 14:58] – created dragonlord | dragengine:modules:dragonscript:behavior_speaker [2025/05/04 13:49] (current) – [speaker.check] dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 20: | Line 20: | ||
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. | 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. | ||
+ | |||
+ | See also: | ||
+ | * [[[gamedev: | ||
+ | * [[gamedev: | ||
====== Instance Counts ====== | ====== Instance Counts ====== | ||
Line 221: | Line 225: | ||
===== unmuted ===== | ===== unmuted ===== | ||
+ | |||
+ | Speaker has been unmuted. | ||
+ | |||
+ | ====== Behavior Tree Actions ====== | ||
+ | |||
+ | This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== speaker.set ===== | ||
+ | |||
+ | Set one or more speaker parameters. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |playing|'' | ||
+ | |muted|'' | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== speaker.check ===== | ||
+ | |||
+ | Check one or more speaker parameters. Action succeeds if all parameter value matches their respective speaker parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a speaker parameter matches (or not). | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |playing|'' | ||
+ | |muted|'' | ||
+ | |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | < | ||
+ | <action name=' | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <!-- actions here run only if speaker playing and not muted --> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Tree Conditions ====== | ||
+ | |||
+ | This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== speaker.check ===== | ||
+ | |||
+ | Check one or more speaker parameters. Conditions returns true if all parameter value match their respective speaker parameter. This condition is typically used to run an action or sequence of actions as long as speaker conditions are true. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |speaker.playing|'' | ||
+ | |speaker.muted|'' | ||
+ | |||
+ | This is an example of using this condition: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== State Machine Actions ====== | ||
+ | |||
+ | Same as [[# | ||
+ | |||
+ | ====== State Machine Conditions ====== | ||
+ | |||
+ | Same as [[# | ||
+ | |||
+ | ====== State Machine Events ====== | ||
+ | |||
+ | This behavior sends these state machine events. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== speaker.start ===== | ||
+ | |||
+ | Speaker started playing back. | ||
+ | |||
+ | ===== speaker.stop ===== | ||
+ | |||
+ | Speaker stopped playing. This can be either manual or trigger based stop of speaker or a non-looping speaker finished playing back the sound/ | ||
+ | |||
+ | ===== speaker.muted ===== | ||
+ | |||
+ | Speaker has been muted. | ||
+ | |||
+ | ===== speaker.unmuted ===== | ||
Speaker has been unmuted. | Speaker has been unmuted. | ||
Line 231: | Line 323: | ||
* [[behavior_collider|ECBehaviorCollider]]: | * [[behavior_collider|ECBehaviorCollider]]: | ||
+ | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: | ||
+ | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
====== Persistency ====== | ====== Persistency ====== | ||
Line 279: | Line 373: | ||
<!-- optional: use BaseGameApp trigger table. game can add more supported values --> | <!-- optional: use BaseGameApp trigger table. game can add more supported values --> | ||
<string name=' | <string name=' | ||
+ | | ||
+ | <!-- optional: identifier of ECBehaviorTriggered to synchronize with or empty | ||
+ | | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: identifier of ECBehaviorTriggered to synchronize with or empty | ||
+ | | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use behavior tree with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use state machine with id instead of empty string --> | ||
+ | <string name=' | ||
| | ||
<!-- set element properties. omit property prefix if used inside behavior tag --> | <!-- set element properties. omit property prefix if used inside behavior tag --> |