Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Scenery.Speaker Class Reference

Speaker. More...

Inheritance diagram for Dragengine.Scenery.Speaker:

Public Member Functions

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

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.

References setLayerMask().

Referenced by hashCode().

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

References getRange(), and setVolume().

Referenced by setPlayPosition().

◆ getLayerMask()

LayerMask Dragengine.Scenery.Speaker.getLayerMask ( )

Layer mask for visibility masking.

Referenced by pause().

◆ getLooping()

bool Dragengine.Scenery.Speaker.getLooping ( )

Sound is looping.

Referenced by setRange().

◆ getMuted()

bool Dragengine.Scenery.Speaker.getMuted ( )

Speaker is muted.

Referenced by getRange().

◆ getOrientation()

Quaternion Dragengine.Scenery.Speaker.getOrientation ( )

Orientation.

Referenced by getParentWorld().

◆ getOwner()

Object Dragengine.Scenery.Speaker.getOwner ( )

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

Referenced by hashCode().

◆ getParentMicrophone()

Microphone Dragengine.Scenery.Speaker.getParentMicrophone ( )

Parent microphone or null if not added to a microphone.

Version
1.29

References getVelocity(), and setOrientation().

Referenced by getVolume().

◆ getParentWorld()

World Dragengine.Scenery.Speaker.getParentWorld ( )

Parent world or null if not added to a world.

Version
1.29

References getOrientation().

Referenced by setLooping().

◆ getPaused()

bool Dragengine.Scenery.Speaker.getPaused ( )

Speaker is paused.

Referenced by hashCode().

◆ getPlayFrom()

int Dragengine.Scenery.Speaker.getPlayFrom ( )

Start play position in samples.

Referenced by hashCode().

◆ getPlaying()

bool Dragengine.Scenery.Speaker.getPlaying ( )

Speaker is playing.

Referenced by hashCode().

◆ getPlaySpeed()

float Dragengine.Scenery.Speaker.getPlaySpeed ( )

Play speed.

Referenced by getRollOff().

◆ getPlayTo()

int Dragengine.Scenery.Speaker.getPlayTo ( )

End play position in samples.

Referenced by hashCode().

◆ getPosition()

DVector Dragengine.Scenery.Speaker.getPosition ( )

Position.

References setSynthesizer().

Referenced by getVelocity().

◆ getRange()

float Dragengine.Scenery.Speaker.getRange ( )

Range in meters beyond which the sound is inaudible.

References getMuted().

Referenced by getDistanceOffset().

◆ getRollOff()

float Dragengine.Scenery.Speaker.getRollOff ( )

Roll off factor.

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

References getPlaySpeed(), and setLooping().

Referenced by setLayerMask().

◆ getShape()

ShapeList Dragengine.Scenery.Speaker.getShape ( )

Sound generation shape.

References setRange().

Referenced by play().

◆ getSound()

Sound Dragengine.Scenery.Speaker.getSound ( )

Sound or null if not set.

References setType().

Referenced by setSound().

◆ getStopped()

bool Dragengine.Scenery.Speaker.getStopped ( )

Speaker is stopped.

References setDistanceOffset().

Referenced by hashCode().

◆ getSynthesizer()

SynthesizerInstance Dragengine.Scenery.Speaker.getSynthesizer ( )

Synthesizer or null if not set.

Referenced by getVideoPlayer().

◆ getType()

SpeakerType Dragengine.Scenery.Speaker.getType ( )

Type.

References getType().

Referenced by getType().

◆ getVelocity()

Vector Dragengine.Scenery.Speaker.getVelocity ( )

Velocity in m/s.

References getPosition().

Referenced by getParentMicrophone().

◆ getVideoPlayer()

VideoPlayer Dragengine.Scenery.Speaker.getVideoPlayer ( )

Video player or null if not set.

References getSynthesizer().

Referenced by setPosition().

◆ getVolume()

float Dragengine.Scenery.Speaker.getVolume ( )

Volume.

References getParentMicrophone().

Referenced by setRollOff().

◆ hashCode()

int Dragengine.Scenery.Speaker.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

References equals(), getOwner(), getPaused(), getPlayFrom(), getPlaying(), getPlayTo(), getStopped(), hashCode(), pause(), play(), setOwner(), setPlayPosition(), and stop().

Referenced by hashCode().

◆ new()

Speaker Dragengine.Scenery.Speaker.new ( )

Create speaker.

References new().

Referenced by new().

◆ pause()

void Dragengine.Scenery.Speaker.pause ( )

Pause playing.

References getLayerMask(), and setShape().

Referenced by hashCode().

◆ play()

void Dragengine.Scenery.Speaker.play ( )

Start playing.

References getShape().

Referenced by hashCode().

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

Referenced by getStopped().

◆ setLayerMask()

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

Set layer mask for visibility masking.

References getRollOff().

Referenced by equals().

◆ setLooping()

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

Set if sound is looping.

References getParentWorld().

Referenced by getRollOff().

◆ setMuted()

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

Set if speaker is muted.

References setVelocity().

Referenced by setRange().

◆ setOrientation()

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

Set orientation.

References setVideoPlayer().

Referenced by getParentMicrophone().

◆ setOwner()

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

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

References setRollOff().

Referenced by hashCode().

◆ setPlayPosition()

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

Set play position in samples.

References getDistanceOffset().

Referenced by hashCode().

◆ setPlaySpeed()

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

Set play speed.

Referenced by setRollOff().

◆ setPosition()

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

Set position.

References getVideoPlayer().

Referenced by setVelocity().

◆ setRange()

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

Set range in meters beyond which the sound is inaudible.

References getLooping(), and setMuted().

Referenced by getShape().

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

References getVolume(), and setPlaySpeed().

Referenced by setOwner().

◆ setShape()

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

Set sound generation shape.

Referenced by pause().

◆ setSound()

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

Set sound or null to not set.

References getSound().

Referenced by setSynthesizer().

◆ setSynthesizer()

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

Set synthesizer or null to not set.

References setSound().

Referenced by getPosition().

◆ setType()

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

Set type.

Referenced by getSound().

◆ setVelocity()

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

Set velocity in m/s.

References setPosition().

Referenced by setMuted().

◆ setVideoPlayer()

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

Set video player or null to not set.

Referenced by setOrientation().

◆ setVolume()

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

Set volume.

Referenced by getDistanceOffset().

◆ stop()

void Dragengine.Scenery.Speaker.stop ( )

Stop playing.

Referenced by hashCode().


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