Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.Speaker Class Reference

Speaker. More...

Inheritance diagram for Dragengine.Scenery.Speaker:

Public Member Functions

Constructors
Speaker new ()
 Create speaker. More...
 
Management
SpeakerType getType ()
 Type. More...
 
void setType (SpeakerType type)
 Set type. More...
 
Sound getSound ()
 Sound or null if not set. More...
 
void setSound (Sound sound)
 Set sound or null to not set. More...
 
SynthesizerInstance getSynthesizer ()
 Synthesizer or null if not set. More...
 
void setSynthesizer (SynthesizerInstance synthesizer)
 Set synthesizer or null to not set. More...
 
VideoPlayer getVideoPlayer ()
 Video player or null if not set. More...
 
void setVideoPlayer (VideoPlayer videoPlayer)
 Set video player or null to not set. More...
 
DVector getPosition ()
 Position. More...
 
void setPosition (DVector position)
 Set position. More...
 
Quaternion getOrientation ()
 Orientation. More...
 
void setOrientation (Quaternion orientation)
 Set orientation. More...
 
Vector getVelocity ()
 Velocity in m/s. More...
 
void setVelocity (Vector velocity)
 Set velocity in m/s. More...
 
bool getMuted ()
 Speaker is muted. More...
 
void setMuted (bool muted)
 Set if speaker is muted. More...
 
bool getLooping ()
 Sound is looping. More...
 
void setLooping (bool looping)
 Set if sound is looping. More...
 
float getPlaySpeed ()
 Play speed. More...
 
void setPlaySpeed (float playSpeed)
 Set play speed. More...
 
float getVolume ()
 Volume. More...
 
void setVolume (float volume)
 Set volume. More...
 
float getRange ()
 Range in meters beyond which the sound is inaudible. More...
 
void setRange (float range)
 Set range in meters beyond which the sound is inaudible. More...
 
float getRollOff ()
 Roll off factor. More...
 
void setRollOff (float rollOff)
 Set roll off factor. More...
 
float getDistanceOffset ()
 Distance offset for attenuation calculation. More...
 
void setDistanceOffset (float distanceOffset)
 Set distance offset for attenuation calculation. More...
 
ShapeList getShape ()
 Sound generation shape. More...
 
void setShape (ShapeList shape)
 Set sound generation shape. More...
 
LayerMask getLayerMask ()
 Layer mask for visibility masking. More...
 
void setLayerMask (LayerMask layerMask)
 Set layer mask for visibility masking. More...
 
Object getOwner ()
 Object owning the speaker for use with SoundLevelMeter or null if not used. More...
 
void setOwner (Object owner)
 Set object owning the speaker for use with SoundLevelMeter or null if not used. More...
 
Playback
int getPlayFrom ()
 Start play position in samples. More...
 
int getPlayTo ()
 End play position in samples. More...
 
void setPlayPosition (int playFrom, int playTo)
 Set play position in samples. More...
 
bool getPlaying ()
 Speaker is playing. More...
 
bool getPaused ()
 Speaker is paused. More...
 
bool getStopped ()
 Speaker is stopped. More...
 
void play ()
 Start playing. More...
 
void stop ()
 Stop playing. More...
 
void pause ()
 Pause playing. More...
 
bool equals (Object other)
 Speaker is equal to another object. More...
 
int hashCode ()
 Hash code for use as dictionary keys. More...
 

Detailed Description

Speaker.

Defines a sound or music emmiting source in a world similar to a speaker. Every speaker can play a sound file once or in a loop multiple times as well as music. To avoid a lot of adding and removing of speakers they can be muted individually preventing them from emitting sound or music without removing them. Speakers usually act like a point source emitting sound in all directions. Optionally the speaker can be set to be directed like a spot light emitting sound only in one direction.

The range and roll-off factor is used to shape the attenuation of the speaker. The roll-off factor works similar to the Inverse Distance attenuation model. A value of 1 indicates physically realistic behavior. Values above 1 produce stronger attenuation while values less than 1 produce weaker attenuation. Beyond the range the sound becomes fully inaudible. The sound modules ensure the sound is attenuated in a way it reaches 0 at the range boundary. Typically this is done with a linear scaling across the entire range but can be chosen by the audio module to produce best results.

The best way to set these parameters is to start with the default values to get a physically realistic sound attenuation. Then adjust the range to be smaller to reduce the number of speakers affecting the listener at the same time. Doing so usually saves processing time. If the range becomes small it might be required to alter the roll-off to compensate. Usually though there is no need to change the roll-off value.

This is a native class.

Member Function Documentation

◆ equals()

bool Dragengine.Scenery.Speaker.equals ( Object  other)

Speaker is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Speaker and both point to the same engine speaker.

◆ getDistanceOffset()

float Dragengine.Scenery.Speaker.getDistanceOffset ( )

Distance offset for attenuation calculation.

Version
1.12

For use by distance sounds. Offsets the true distance to the sound source for attenuation calculation to make the sound appear coming from far away. Requires increasing the volume to compensate for the distance increased attenuation.

◆ getLayerMask()

LayerMask Dragengine.Scenery.Speaker.getLayerMask ( )

Layer mask for visibility masking.

◆ getLooping()

bool Dragengine.Scenery.Speaker.getLooping ( )

Sound is looping.

◆ getMuted()

bool Dragengine.Scenery.Speaker.getMuted ( )

Speaker is muted.

◆ getOrientation()

Quaternion Dragengine.Scenery.Speaker.getOrientation ( )

Orientation.

◆ getOwner()

Object Dragengine.Scenery.Speaker.getOwner ( )

Object owning the speaker for use with SoundLevelMeter or null if not used.

◆ getPaused()

bool Dragengine.Scenery.Speaker.getPaused ( )

Speaker is paused.

◆ getPlayFrom()

int Dragengine.Scenery.Speaker.getPlayFrom ( )

Start play position in samples.

◆ getPlaying()

bool Dragengine.Scenery.Speaker.getPlaying ( )

Speaker is playing.

◆ getPlaySpeed()

float Dragengine.Scenery.Speaker.getPlaySpeed ( )

Play speed.

◆ getPlayTo()

int Dragengine.Scenery.Speaker.getPlayTo ( )

End play position in samples.

◆ getPosition()

DVector Dragengine.Scenery.Speaker.getPosition ( )

Position.

◆ getRange()

float Dragengine.Scenery.Speaker.getRange ( )

Range in meters beyond which the sound is inaudible.

◆ getRollOff()

float Dragengine.Scenery.Speaker.getRollOff ( )

Roll off factor.

1 is physically realistic. Larger than 1 applies stronger attenuation. Smaller values apply weaker attenuation.

◆ getShape()

ShapeList Dragengine.Scenery.Speaker.getShape ( )

Sound generation shape.

◆ getSound()

Sound Dragengine.Scenery.Speaker.getSound ( )

Sound or null if not set.

◆ getStopped()

bool Dragengine.Scenery.Speaker.getStopped ( )

Speaker is stopped.

◆ getSynthesizer()

SynthesizerInstance Dragengine.Scenery.Speaker.getSynthesizer ( )

Synthesizer or null if not set.

◆ getType()

SpeakerType Dragengine.Scenery.Speaker.getType ( )

Type.

◆ getVelocity()

Vector Dragengine.Scenery.Speaker.getVelocity ( )

Velocity in m/s.

◆ getVideoPlayer()

VideoPlayer Dragengine.Scenery.Speaker.getVideoPlayer ( )

Video player or null if not set.

◆ getVolume()

float Dragengine.Scenery.Speaker.getVolume ( )

Volume.

◆ hashCode()

int Dragengine.Scenery.Speaker.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ new()

Speaker Dragengine.Scenery.Speaker.new ( )

Create speaker.

◆ pause()

void Dragengine.Scenery.Speaker.pause ( )

Pause playing.

◆ play()

void Dragengine.Scenery.Speaker.play ( )

Start playing.

◆ setDistanceOffset()

void Dragengine.Scenery.Speaker.setDistanceOffset ( float  distanceOffset)

Set distance offset for attenuation calculation.

Version
1.12

For use by distance sounds. Offsets the true distance to the sound source for attenuation calculation to make the sound appear coming from far away. Requires increasing the volume to compensate for the distance increased attenuation.

◆ setLayerMask()

void Dragengine.Scenery.Speaker.setLayerMask ( LayerMask  layerMask)

Set layer mask for visibility masking.

◆ setLooping()

void Dragengine.Scenery.Speaker.setLooping ( bool  looping)

Set if sound is looping.

◆ setMuted()

void Dragengine.Scenery.Speaker.setMuted ( bool  muted)

Set if speaker is muted.

◆ setOrientation()

void Dragengine.Scenery.Speaker.setOrientation ( Quaternion  orientation)

Set orientation.

◆ setOwner()

void Dragengine.Scenery.Speaker.setOwner ( Object  owner)

Set object owning the speaker for use with SoundLevelMeter or null if not used.

◆ setPlayPosition()

void Dragengine.Scenery.Speaker.setPlayPosition ( int  playFrom,
int  playTo 
)

Set play position in samples.

◆ setPlaySpeed()

void Dragengine.Scenery.Speaker.setPlaySpeed ( float  playSpeed)

Set play speed.

◆ setPosition()

void Dragengine.Scenery.Speaker.setPosition ( DVector  position)

Set position.

◆ setRange()

void Dragengine.Scenery.Speaker.setRange ( float  range)

Set range in meters beyond which the sound is inaudible.

◆ setRollOff()

void Dragengine.Scenery.Speaker.setRollOff ( float  rollOff)

Set roll off factor.

1 is physically realistic. Larger than 1 applies stronger attenuation. Smaller values apply weaker attenuation.

◆ setShape()

void Dragengine.Scenery.Speaker.setShape ( ShapeList  shape)

Set sound generation shape.

◆ setSound()

void Dragengine.Scenery.Speaker.setSound ( Sound  sound)

Set sound or null to not set.

◆ setSynthesizer()

void Dragengine.Scenery.Speaker.setSynthesizer ( SynthesizerInstance  synthesizer)

Set synthesizer or null to not set.

◆ setType()

void Dragengine.Scenery.Speaker.setType ( SpeakerType  type)

Set type.

◆ setVelocity()

void Dragengine.Scenery.Speaker.setVelocity ( Vector  velocity)

Set velocity in m/s.

◆ setVideoPlayer()

void Dragengine.Scenery.Speaker.setVideoPlayer ( VideoPlayer  videoPlayer)

Set video player or null to not set.

◆ setVolume()

void Dragengine.Scenery.Speaker.setVolume ( float  volume)

Set volume.

◆ stop()

void Dragengine.Scenery.Speaker.stop ( )

Stop playing.


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