Drag[en]gine Script Module DragonScript  1.23
Dragengine.Audio.MaterialSounds.MaterialSound Class Reference

Material sound. More...

Inheritance diagram for Dragengine.Audio.MaterialSounds.MaterialSound:

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...
 

Detailed Description

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:

  • "power": Constant curve with the power used to play the material sound.
  • "random": Constant curve with random value between 0 and 1.

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.

Member Function Documentation

◆ addSound()

void Dragengine.Audio.MaterialSounds.MaterialSound.addSound ( Sound  sound)

Add sounds.

◆ createSpeaker() [1/2]

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.

◆ createSpeaker() [2/2]

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.

◆ getLayerMask()

LayerMask Dragengine.Audio.MaterialSounds.MaterialSound.getLayerMask ( )

Layer mask used by createSpeaker() only.

◆ getMaxPower()

float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxPower ( )

Maximum power.

◆ getMaxRange()

float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxRange ( )

Maximum sound range in meters.

◆ getMaxVolume()

float Dragengine.Audio.MaterialSounds.MaterialSound.getMaxVolume ( )

Maximum volume.

◆ getMinPower()

float Dragengine.Audio.MaterialSounds.MaterialSound.getMinPower ( )

Minimum power.

◆ getMinRange()

float Dragengine.Audio.MaterialSounds.MaterialSound.getMinRange ( )

Minimum sound range in meters.

◆ getMinVolume()

float Dragengine.Audio.MaterialSounds.MaterialSound.getMinVolume ( )

Minimum volume.

◆ getSoundAt()

Sound Dragengine.Audio.MaterialSounds.MaterialSound.getSoundAt ( int  index)

Sound at index.

◆ getSoundCount()

int Dragengine.Audio.MaterialSounds.MaterialSound.getSoundCount ( )

Number of sounds.

◆ getSynthesizer()

Synthesizer Dragengine.Audio.MaterialSounds.MaterialSound.getSynthesizer ( )

Synthesizer or null to use sound files.

◆ new() [1/2]

MaterialSound Dragengine.Audio.MaterialSounds.MaterialSound.new ( )

Create material sound.

◆ new() [2/2]

MaterialSound Dragengine.Audio.MaterialSounds.MaterialSound.new ( MaterialSound  materialSound)

Create copy of material sound.

◆ playSound() [1/2]

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.

◆ playSound() [2/2]

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.

◆ randomSound()

Sound Dragengine.Audio.MaterialSounds.MaterialSound.randomSound ( )

Random sound or null if no sounds are present.

◆ removeAllSound()

void Dragengine.Audio.MaterialSounds.MaterialSound.removeAllSound ( )

Remove all sounds.

◆ setLayerMask()

void Dragengine.Audio.MaterialSounds.MaterialSound.setLayerMask ( LayerMask  layerMask)

Set layer mask used by createSpeaker() only.

◆ setMaxPower()

void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxPower ( float  power)

Set maximum power.

◆ setMaxRange()

void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxRange ( float  range)

Set maximum sound range in meters.

◆ setMaxVolume()

void Dragengine.Audio.MaterialSounds.MaterialSound.setMaxVolume ( float  volume)

Set maximum volume.

◆ setMinPower()

void Dragengine.Audio.MaterialSounds.MaterialSound.setMinPower ( float  power)

Set minimum power.

◆ setMinRange()

void Dragengine.Audio.MaterialSounds.MaterialSound.setMinRange ( float  range)

Set minimum sound range in meters.

◆ setMinVolume()

void Dragengine.Audio.MaterialSounds.MaterialSound.setMinVolume ( float  volume)

Set minimum volume.

◆ setSynthesizer()

void Dragengine.Audio.MaterialSounds.MaterialSound.setSynthesizer ( Synthesizer  synthesizer)

Set synthesizer or null to use sound files.


The documentation for this class was generated from the following file: