Drag[en]gine Script Module DragonScript
1.23
|
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... | |
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.
bool Dragengine.Scenery.Speaker.equals | ( | Object | other | ) |
float Dragengine.Scenery.Speaker.getDistanceOffset | ( | ) |
Distance offset for attenuation calculation.
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.
LayerMask Dragengine.Scenery.Speaker.getLayerMask | ( | ) |
Layer mask for visibility masking.
bool Dragengine.Scenery.Speaker.getLooping | ( | ) |
Sound is looping.
bool Dragengine.Scenery.Speaker.getMuted | ( | ) |
Speaker is muted.
Quaternion Dragengine.Scenery.Speaker.getOrientation | ( | ) |
Orientation.
Object Dragengine.Scenery.Speaker.getOwner | ( | ) |
Object owning the speaker for use with SoundLevelMeter or null if not used.
bool Dragengine.Scenery.Speaker.getPaused | ( | ) |
Speaker is paused.
int Dragengine.Scenery.Speaker.getPlayFrom | ( | ) |
Start play position in samples.
bool Dragengine.Scenery.Speaker.getPlaying | ( | ) |
Speaker is playing.
float Dragengine.Scenery.Speaker.getPlaySpeed | ( | ) |
Play speed.
int Dragengine.Scenery.Speaker.getPlayTo | ( | ) |
End play position in samples.
DVector Dragengine.Scenery.Speaker.getPosition | ( | ) |
Position.
float Dragengine.Scenery.Speaker.getRange | ( | ) |
Range in meters beyond which the sound is inaudible.
float Dragengine.Scenery.Speaker.getRollOff | ( | ) |
Roll off factor.
1 is physically realistic. Larger than 1 applies stronger attenuation. Smaller values apply weaker attenuation.
bool Dragengine.Scenery.Speaker.getStopped | ( | ) |
Speaker is stopped.
SynthesizerInstance Dragengine.Scenery.Speaker.getSynthesizer | ( | ) |
Synthesizer or null if not set.
SpeakerType Dragengine.Scenery.Speaker.getType | ( | ) |
Type.
Vector Dragengine.Scenery.Speaker.getVelocity | ( | ) |
Velocity in m/s.
VideoPlayer Dragengine.Scenery.Speaker.getVideoPlayer | ( | ) |
Video player or null if not set.
float Dragengine.Scenery.Speaker.getVolume | ( | ) |
Volume.
int Dragengine.Scenery.Speaker.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
Speaker Dragengine.Scenery.Speaker.new | ( | ) |
Create speaker.
void Dragengine.Scenery.Speaker.pause | ( | ) |
Pause playing.
void Dragengine.Scenery.Speaker.play | ( | ) |
Start playing.
void Dragengine.Scenery.Speaker.setDistanceOffset | ( | float | distanceOffset | ) |
Set distance offset for attenuation calculation.
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.
void Dragengine.Scenery.Speaker.setLayerMask | ( | LayerMask | layerMask | ) |
Set layer mask for visibility masking.
void Dragengine.Scenery.Speaker.setLooping | ( | bool | looping | ) |
Set if sound is looping.
void Dragengine.Scenery.Speaker.setMuted | ( | bool | muted | ) |
Set if speaker is muted.
void Dragengine.Scenery.Speaker.setOrientation | ( | Quaternion | orientation | ) |
Set orientation.
void Dragengine.Scenery.Speaker.setOwner | ( | Object | owner | ) |
Set object owning the speaker for use with SoundLevelMeter or null if not used.
void Dragengine.Scenery.Speaker.setPlayPosition | ( | int | playFrom, |
int | playTo | ||
) |
Set play position in samples.
void Dragengine.Scenery.Speaker.setPlaySpeed | ( | float | playSpeed | ) |
Set play speed.
void Dragengine.Scenery.Speaker.setPosition | ( | DVector | position | ) |
Set position.
void Dragengine.Scenery.Speaker.setRange | ( | float | range | ) |
Set range in meters beyond which the sound is inaudible.
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.
void Dragengine.Scenery.Speaker.setShape | ( | ShapeList | shape | ) |
Set sound generation shape.
void Dragengine.Scenery.Speaker.setSound | ( | Sound | sound | ) |
Set sound or null to not set.
void Dragengine.Scenery.Speaker.setSynthesizer | ( | SynthesizerInstance | synthesizer | ) |
Set synthesizer or null to not set.
void Dragengine.Scenery.Speaker.setType | ( | SpeakerType | type | ) |
Set type.
void Dragengine.Scenery.Speaker.setVelocity | ( | Vector | velocity | ) |
Set velocity in m/s.
void Dragengine.Scenery.Speaker.setVideoPlayer | ( | VideoPlayer | videoPlayer | ) |
Set video player or null to not set.
void Dragengine.Scenery.Speaker.setVolume | ( | float | volume | ) |
Set volume.
void Dragengine.Scenery.Speaker.stop | ( | ) |
Stop playing.