|
Drag[en]gine Script Module DragonScript 1.35
|
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. | |
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 | ) |
Speaker is equal to another object.
Implements Object.equals(Object).
References setLayerMask().
Referenced by hashCode().
| 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.
References getRange(), and setVolume().
Referenced by setPlayPosition().
| LayerMask Dragengine.Scenery.Speaker.getLayerMask | ( | ) |
Layer mask for visibility masking.
Referenced by pause().
| bool Dragengine.Scenery.Speaker.getLooping | ( | ) |
Sound is looping.
Referenced by setRange().
| bool Dragengine.Scenery.Speaker.getMuted | ( | ) |
Speaker is muted.
Referenced by getRange().
| Quaternion Dragengine.Scenery.Speaker.getOrientation | ( | ) |
Orientation.
Referenced by getParentWorld().
| Object Dragengine.Scenery.Speaker.getOwner | ( | ) |
Object owning the speaker for use with SoundLevelMeter or null if not used.
Referenced by hashCode().
| Microphone Dragengine.Scenery.Speaker.getParentMicrophone | ( | ) |
Parent microphone or null if not added to a microphone.
References getVelocity(), and setOrientation().
Referenced by getVolume().
| World Dragengine.Scenery.Speaker.getParentWorld | ( | ) |
Parent world or null if not added to a world.
References getOrientation().
Referenced by setLooping().
| bool Dragengine.Scenery.Speaker.getPaused | ( | ) |
Speaker is paused.
Referenced by hashCode().
| int Dragengine.Scenery.Speaker.getPlayFrom | ( | ) |
Start play position in samples.
Referenced by hashCode().
| bool Dragengine.Scenery.Speaker.getPlaying | ( | ) |
Speaker is playing.
Referenced by hashCode().
| float Dragengine.Scenery.Speaker.getPlaySpeed | ( | ) |
Play speed.
Referenced by getRollOff().
| int Dragengine.Scenery.Speaker.getPlayTo | ( | ) |
End play position in samples.
Referenced by hashCode().
| DVector Dragengine.Scenery.Speaker.getPosition | ( | ) |
| float Dragengine.Scenery.Speaker.getRange | ( | ) |
Range in meters beyond which the sound is inaudible.
References getMuted().
Referenced by getDistanceOffset().
| 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().
| ShapeList Dragengine.Scenery.Speaker.getShape | ( | ) |
| Sound Dragengine.Scenery.Speaker.getSound | ( | ) |
| bool Dragengine.Scenery.Speaker.getStopped | ( | ) |
| SynthesizerInstance Dragengine.Scenery.Speaker.getSynthesizer | ( | ) |
Synthesizer or null if not set.
Referenced by getVideoPlayer().
| SpeakerType Dragengine.Scenery.Speaker.getType | ( | ) |
| Vector Dragengine.Scenery.Speaker.getVelocity | ( | ) |
| VideoPlayer Dragengine.Scenery.Speaker.getVideoPlayer | ( | ) |
| float Dragengine.Scenery.Speaker.getVolume | ( | ) |
| 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().
| void Dragengine.Scenery.Speaker.pause | ( | ) |
| void Dragengine.Scenery.Speaker.play | ( | ) |
| 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.
Referenced by getStopped().
| void Dragengine.Scenery.Speaker.setLayerMask | ( | LayerMask | layerMask | ) |
| void Dragengine.Scenery.Speaker.setLooping | ( | bool | looping | ) |
| void Dragengine.Scenery.Speaker.setMuted | ( | bool | muted | ) |
| void Dragengine.Scenery.Speaker.setOrientation | ( | Quaternion | orientation | ) |
| 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().
| void Dragengine.Scenery.Speaker.setPlayPosition | ( | int | playFrom, |
| int | playTo ) |
| void Dragengine.Scenery.Speaker.setPlaySpeed | ( | float | playSpeed | ) |
Set play speed.
Referenced by setRollOff().
| void Dragengine.Scenery.Speaker.setPosition | ( | DVector | position | ) |
| void Dragengine.Scenery.Speaker.setRange | ( | float | range | ) |
Set range in meters beyond which the sound is inaudible.
References getLooping(), and setMuted().
Referenced by getShape().
| 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().
| void Dragengine.Scenery.Speaker.setShape | ( | ShapeList | shape | ) |
Set sound generation shape.
Referenced by pause().
| void Dragengine.Scenery.Speaker.setSound | ( | Sound | sound | ) |
| void Dragengine.Scenery.Speaker.setSynthesizer | ( | SynthesizerInstance | synthesizer | ) |
| void Dragengine.Scenery.Speaker.setType | ( | SpeakerType | type | ) |
Set type.
Referenced by getSound().
| void Dragengine.Scenery.Speaker.setVelocity | ( | Vector | velocity | ) |
| void Dragengine.Scenery.Speaker.setVideoPlayer | ( | VideoPlayer | videoPlayer | ) |
Set video player or null to not set.
Referenced by setOrientation().
| void Dragengine.Scenery.Speaker.setVolume | ( | float | volume | ) |
Set volume.
Referenced by getDistanceOffset().
| void Dragengine.Scenery.Speaker.stop | ( | ) |
Stop playing.
Referenced by hashCode().