|
Drag[en]gine Script Module DragonScript 1.35
|
Material sound. More...
Public Member Functions | |
| void | addSound (Sound sound) |
| Add sounds. | |
| Speaker | createSpeaker (CollisionInfo collision) |
| Create speaker to play sound using collision as parameter source. | |
| Speaker | createSpeaker (DVector position, float power) |
| Create speaker. | |
| LayerMask | getLayerMask () |
| Layer mask used by createSpeaker() only. | |
| float | getMaxPower () |
| Maximum power. | |
| float | getMaxRange () |
| Maximum sound range in meters. | |
| float | getMaxVolume () |
| Maximum volume. | |
| float | getMinPower () |
| Minimum power. | |
| float | getMinRange () |
| Minimum sound range in meters. | |
| float | getMinVolume () |
| Minimum volume. | |
| Sound | getSoundAt (int index) |
| Sound at index. | |
| int | getSoundCount () |
| Number of sounds. | |
| Synthesizer | getSynthesizer () |
| Synthesizer or null to use sound files. | |
| MaterialSound | new () |
| Create material sound. | |
| MaterialSound | new (MaterialSound materialSound) |
| Create copy of material sound. | |
| void | playSound (GameWorld world, CollisionInfo collision) |
| Play sound using collision as parameter source. | |
| void | playSound (GameWorld world, DVector position, float power) |
| Play sound. | |
| Sound | randomSound () |
| Random sound or null if no sounds are present. | |
| void | removeAllSound () |
| Remove all sounds. | |
| void | setLayerMask (LayerMask layerMask) |
| Set layer mask used by createSpeaker() only. | |
| void | setMaxPower (float power) |
| Set maximum power. | |
| void | setMaxRange (float range) |
| Set maximum sound range in meters. | |
| void | setMaxVolume (float volume) |
| Set maximum volume. | |
| void | setMinPower (float power) |
| Set minimum power. | |
| void | setMinRange (float range) |
| Set minimum sound range in meters. | |
| void | setMinVolume (float volume) |
| Set minimum volume. | |
| void | setSynthesizer (Synthesizer synthesizer) |
| Set synthesizer or null to use sound files. | |
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 | ) |
| 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.
References getSoundAt(), and randomSound().
Referenced by createSpeaker().
| 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.
References addSound(), createSpeaker(), getSynthesizer(), playSound(), removeAllSound(), and setSynthesizer().
| LayerMask Dragengine.Audio.MaterialSounds.MaterialSound.getLayerMask | ( | ) |
Layer mask used by createSpeaker() only.
Referenced by playSound().
| float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxPower | ( | ) |
Maximum power.
Referenced by setMinRange().
| float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxRange | ( | ) |
Maximum sound range in meters.
Referenced by setSynthesizer().
| float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxVolume | ( | ) |
| float Dragengine.Audio.MaterialSounds.MaterialSound.getMinPower | ( | ) |
Minimum power.
Referenced by getMaxVolume().
| float Dragengine.Audio.MaterialSounds.MaterialSound.getMinRange | ( | ) |
| float Dragengine.Audio.MaterialSounds.MaterialSound.getMinVolume | ( | ) |
Minimum volume.
Referenced by setLayerMask().
| Sound Dragengine.Audio.MaterialSounds.MaterialSound.getSoundAt | ( | int | index | ) |
| int Dragengine.Audio.MaterialSounds.MaterialSound.getSoundCount | ( | ) |
| Synthesizer Dragengine.Audio.MaterialSounds.MaterialSound.getSynthesizer | ( | ) |
Synthesizer or null to use sound files.
Referenced by createSpeaker().
| MaterialSound Dragengine.Audio.MaterialSounds.MaterialSound.new | ( | ) |
| 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.
References getLayerMask(), and setLayerMask().
Referenced by createSpeaker().
| 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.
References getSoundCount().
| Sound Dragengine.Audio.MaterialSounds.MaterialSound.randomSound | ( | ) |
Random sound or null if no sounds are present.
Referenced by createSpeaker().
| void Dragengine.Audio.MaterialSounds.MaterialSound.removeAllSound | ( | ) |
| void Dragengine.Audio.MaterialSounds.MaterialSound.setLayerMask | ( | LayerMask | layerMask | ) |
| void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxPower | ( | float | power | ) |
Set maximum power.
Referenced by setMaxRange().
| void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxRange | ( | float | range | ) |
| void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxVolume | ( | float | volume | ) |
Set maximum volume.
Referenced by addSound().
| void Dragengine.Audio.MaterialSounds.MaterialSound.setMinPower | ( | float | power | ) |
Set minimum power.
Referenced by getMinRange().
| void Dragengine.Audio.MaterialSounds.MaterialSound.setMinRange | ( | float | range | ) |
| void Dragengine.Audio.MaterialSounds.MaterialSound.setMinVolume | ( | float | volume | ) |
Set minimum volume.
Referenced by getSoundCount().
| void Dragengine.Audio.MaterialSounds.MaterialSound.setSynthesizer | ( | Synthesizer | synthesizer | ) |
Set synthesizer or null to use sound files.
References getMaxRange(), setMaxRange(), and setMinRange().
Referenced by createSpeaker().