Drag[en]gine Script Module DragonScript
1.23
|
Material sound. More...
Public Member Functions | |
void | addSound (Sound sound) |
Add sounds. More... | |
Speaker | createSpeaker (CollisionInfo collision) |
Create speaker to play sound using collision as parameter source. More... | |
Speaker | createSpeaker (DVector position, float power) |
Create speaker. More... | |
LayerMask | getLayerMask () |
Layer mask used by createSpeaker() only. More... | |
float | getMaxPower () |
Maximum power. More... | |
float | getMaxRange () |
Maximum sound range in meters. More... | |
float | getMaxVolume () |
Maximum volume. More... | |
float | getMinPower () |
Minimum power. More... | |
float | getMinRange () |
Minimum sound range in meters. More... | |
float | getMinVolume () |
Minimum volume. More... | |
Sound | getSoundAt (int index) |
Sound at index. More... | |
int | getSoundCount () |
Number of sounds. More... | |
Synthesizer | getSynthesizer () |
Synthesizer or null to use sound files. More... | |
MaterialSound | new () |
Create material sound. More... | |
MaterialSound | new (MaterialSound materialSound) |
Create copy of material sound. More... | |
void | playSound (GameWorld world, CollisionInfo collision) |
Play sound using collision as parameter source. More... | |
void | playSound (GameWorld world, DVector position, float power) |
Play sound. More... | |
Sound | randomSound () |
Random sound or null if no sounds are present. More... | |
void | removeAllSound () |
Remove all sounds. More... | |
void | setLayerMask (LayerMask layerMask) |
Set layer mask used by createSpeaker() only. More... | |
void | setMaxPower (float power) |
Set maximum power. More... | |
void | setMaxRange (float range) |
Set maximum sound range in meters. More... | |
void | setMaxVolume (float volume) |
Set maximum volume. More... | |
void | setMinPower (float power) |
Set minimum power. More... | |
void | setMinRange (float range) |
Set minimum sound range in meters. More... | |
void | setMinVolume (float volume) |
Set minimum volume. More... | |
void | setSynthesizer (Synthesizer synthesizer) |
Set synthesizer or null to use sound files. More... | |
Material sound.
Plays a random sound from a list of sounds or using a synthesizer. Volume and range is adjusted according to a power parameter. Usually power is calculated from impact force or similar physical parameters but can be also static for example depending on used weapon type.
If a synthesizer is used the following named controllers are set if present:
In both cases (either sound or synthesizer) the speaker volume and range is set to linear blend between minimum to maximum power and 0 to maximum volume/range. For synthesizer use this means that the synthesizer should in general not adjust the sound volume since this is done already by the speaker configuration.
void Dragengine.Audio.MaterialSounds.MaterialSound.addSound | ( | Sound | sound | ) |
Add sounds.
Speaker Dragengine.Audio.MaterialSounds.MaterialSound.createSpeaker | ( | CollisionInfo | collision | ) |
Create speaker to play sound using collision as parameter source.
Uses collision position using collision impulse as power. If no sound nor synthesizer is present or usable \en null is returned.
Speaker Dragengine.Audio.MaterialSounds.MaterialSound.createSpeaker | ( | DVector | position, |
float | power | ||
) |
Create speaker.
If no sound nor synthesizer is present or usable \en null is returned.
LayerMask Dragengine.Audio.MaterialSounds.MaterialSound.getLayerMask | ( | ) |
Layer mask used by createSpeaker() only.
float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxPower | ( | ) |
Maximum power.
float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxRange | ( | ) |
Maximum sound range in meters.
float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxVolume | ( | ) |
Maximum volume.
float Dragengine.Audio.MaterialSounds.MaterialSound.getMinPower | ( | ) |
Minimum power.
float Dragengine.Audio.MaterialSounds.MaterialSound.getMinRange | ( | ) |
Minimum sound range in meters.
float Dragengine.Audio.MaterialSounds.MaterialSound.getMinVolume | ( | ) |
Minimum volume.
Sound Dragengine.Audio.MaterialSounds.MaterialSound.getSoundAt | ( | int | index | ) |
Sound at index.
int Dragengine.Audio.MaterialSounds.MaterialSound.getSoundCount | ( | ) |
Number of sounds.
Synthesizer Dragengine.Audio.MaterialSounds.MaterialSound.getSynthesizer | ( | ) |
Synthesizer or null to use sound files.
MaterialSound Dragengine.Audio.MaterialSounds.MaterialSound.new | ( | ) |
Create material sound.
MaterialSound Dragengine.Audio.MaterialSounds.MaterialSound.new | ( | MaterialSound | materialSound | ) |
Create copy of material sound.
void Dragengine.Audio.MaterialSounds.MaterialSound.playSound | ( | GameWorld | world, |
CollisionInfo | collision | ||
) |
Play sound using collision as parameter source.
Plays sound at collision position using collision impulse as power. Uses GWBehaviorOneShotSpeaker.playSoundOnce() or GWBehaviorOneShotSpeaker.playSynthesizerOnce().
To control the speaker used to play the sound use createSpeaker() instead.
void Dragengine.Audio.MaterialSounds.MaterialSound.playSound | ( | GameWorld | world, |
DVector | position, | ||
float | power | ||
) |
Play sound.
Plays sound at collision position using collision impulse as power. Uses GameWorld.playSoundOnce() or GameWorld.playSynthesizerOnce().
To control the speaker used to play the sound use createSpeaker() instead.
Sound Dragengine.Audio.MaterialSounds.MaterialSound.randomSound | ( | ) |
Random sound or null if no sounds are present.
void Dragengine.Audio.MaterialSounds.MaterialSound.removeAllSound | ( | ) |
Remove all sounds.
void Dragengine.Audio.MaterialSounds.MaterialSound.setLayerMask | ( | LayerMask | layerMask | ) |
Set layer mask used by createSpeaker() only.
void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxPower | ( | float | power | ) |
Set maximum power.
void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxRange | ( | float | range | ) |
Set maximum sound range in meters.
void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxVolume | ( | float | volume | ) |
Set maximum volume.
void Dragengine.Audio.MaterialSounds.MaterialSound.setMinPower | ( | float | power | ) |
Set minimum power.
void Dragengine.Audio.MaterialSounds.MaterialSound.setMinRange | ( | float | range | ) |
Set minimum sound range in meters.
void Dragengine.Audio.MaterialSounds.MaterialSound.setMinVolume | ( | float | volume | ) |
Set minimum volume.
void Dragengine.Audio.MaterialSounds.MaterialSound.setSynthesizer | ( | Synthesizer | synthesizer | ) |
Set synthesizer or null to use sound files.