Drag[en]gine Game Engine
1.21
|
Speaker resource. More...
#include <deSpeaker.h>
Public Types | |
enum | ePlayStates { epsStopped , epsPlaying , epsPaused } |
Play states. More... | |
enum | eSpeakerType { estPoint , estDirected } |
Speaker type. More... | |
typedef deTObjectReference< deSpeaker > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deResource | |
typedef deTObjectReference< deResource > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deObject | |
typedef deTObjectReference< deObject > | Ref |
Type holding strong reference. More... | |
Public Member Functions | |
Management | |
eSpeakerType | GetType () const |
Type. More... | |
void | SetType (eSpeakerType type) |
Set type. More... | |
deSound * | GetSound () const |
Sound or NULL if not set. More... | |
void | SetSound (deSound *sound) |
Set sound or NULL if not set. More... | |
deSynthesizerInstance * | GetSynthesizer () const |
Synthesizer or NULL if not set. More... | |
void | SetSynthesizer (deSynthesizerInstance *synthesizer) |
Set synthesizer or NULL if not set. More... | |
deVideoPlayer * | GetVideoPlayer () const |
Video player or NULL if not set. More... | |
void | SetVideoPlayer (deVideoPlayer *videoPlayer) |
Set video player or NULL if not set. More... | |
const decDVector & | GetPosition () const |
Position. More... | |
void | SetPosition (const decDVector &position) |
Set position. More... | |
const decQuaternion & | GetOrientation () const |
Orientation. More... | |
void | SetOrientation (const decQuaternion &orientation) |
Set orientation. More... | |
const decVector & | GetVelocity () const |
Velocity in m/s. More... | |
void | SetVelocity (const decVector &velocity) |
Set velocity in m/s. More... | |
bool | GetMuted () const |
Speaker is muted. More... | |
void | SetMuted (bool muted) |
Set if speaker is muted. More... | |
bool | GetLooping () const |
Speaker is playing once or is looping. More... | |
void | SetLooping (bool looping) |
Set if speaker is playing once or is looping. More... | |
int | GetPlayFrom () const |
Start play position in samples. More... | |
int | GetPlayTo () const |
End play position in samples. More... | |
void | SetPlayPosition (int playFrom, int playTo) |
Set play position in samples. More... | |
float | GetPlaySpeed () const |
Play speed. More... | |
void | SetPlaySpeed (float playSpeed) |
Set play speed. More... | |
float | GetVolume () const |
Volume. More... | |
void | SetVolume (float volume) |
Set volume. More... | |
float | GetRange () const |
Range beyond which the sound is inaudible. More... | |
void | SetRange (float range) |
Set range beyond which the sound is inaudible. More... | |
float | GetRollOff () const |
Roll off factor. More... | |
void | SetRollOff (float rollOff) |
Set roll off factor. More... | |
float | GetDistanceOffset () const |
Distance offset for attenuation calculation. More... | |
void | SetDistanceOffset (float distanceOffset) |
Set distance offset for attenuation calculation. More... | |
const decShapeList & | GetShape () const |
Sound shape. More... | |
void | SetShape (const decShapeList &shape) |
Set sound shape. More... | |
const decLayerMask & | GetLayerMask () const |
Layer mask. More... | |
void | SetLayerMask (const decLayerMask &layerMask) |
Set layer mask. More... | |
ePlayStates | GetPlayState () const |
Play state. More... | |
bool | GetPlaying () const |
Speaker is playing. More... | |
bool | GetPaused () const |
Speaker is paused. More... | |
bool | GetStopped () const |
Speaker is stopped. More... | |
void | SetPlayState (ePlayStates playState) |
Set play state. More... | |
void | Play () |
Start playing. More... | |
void | Stop () |
Stop playing. More... | |
void | Pause () |
Pause playing. More... | |
System Peers | |
deBaseAudioSpeaker * | GetPeerAudio () const |
Audio system peer or NULL if not set. More... | |
void | SetPeerAudio (deBaseAudioSpeaker *peer) |
Set audio system peer or NULL if not set. More... | |
deBaseScriptingSpeaker * | GetPeerScripting () const |
Scripting system peer. More... | |
void | SetPeerScripting (deBaseScriptingSpeaker *peer) |
Set scripting system peer. More... | |
Linked list world | |
deWorld * | GetParentWorld () const |
Parent world or NULL. More... | |
void | SetParentWorld (deWorld *world) |
Set parent world or NULL. More... | |
deSpeaker * | GetLLWorldPrev () const |
Previous speaker in the parent world linked list. More... | |
void | SetLLWorldPrev (deSpeaker *speaker) |
Set next speaker in the parent world linked list. More... | |
deSpeaker * | GetLLWorldNext () const |
Next speaker in the parent world linked list. More... | |
void | SetLLWorldNext (deSpeaker *speaker) |
Set next speaker in the parent world linked list. More... | |
Public Member Functions inherited from deResource | |
deResourceManager * | GetResourceManager () const |
Resource manager or NULL if resource is leaking. More... | |
deEngine * | GetEngine () const |
Game engine object from resource manager. More... | |
deResource * | GetLLManagerPrev () const |
Previous resource in the resource manager linked list. More... | |
void | SetLLManagerPrev (deResource *resource) |
Set next resource in the resource manager linked list. More... | |
deResource * | GetLLManagerNext () const |
Next resource in the resource manager linked list. More... | |
void | SetLLManagerNext (deResource *resource) |
Set next resource in the resource manager linked list. More... | |
void | MarkLeaking () |
Marks the resource leaking. More... | |
deResource (deResourceManager *resourceManager) | |
Create resource. More... | |
Public Member Functions inherited from deObject | |
int | GetRefCount () const |
Reference count. More... | |
void | AddReference () |
Add reference increasing reference count by 1. More... | |
void | FreeReference () |
Decrease reference count by one and delete object if count reaches 0. More... | |
deObject () | |
Create object with reference count of 1. More... | |
Constructors and Destructors | |
deSpeaker (deSpeakerManager *manager) | |
Create speaker. More... | |
virtual | ~deSpeaker () |
Clean up speaker object. More... | |
Linked list microphone | |
deMicrophone * | GetParentMicrophone () const |
Parent microphone or NULL. More... | |
void | SetParentMicrophone (deMicrophone *microphone) |
Set parent microphone or NULL. More... | |
deSpeaker * | GetLLMicrophonePrev () const |
Previous speaker in the parent microphone linked list. More... | |
void | SetLLMicrophonePrev (deSpeaker *speaker) |
Set next speaker in the parent microphone linked list. More... | |
deSpeaker * | GetLLMicrophoneNext () const |
Next speaker in the parent microphone linked list. More... | |
void | SetLLMicrophoneNext (deSpeaker *speaker) |
Set next speaker in the parent microphone linked list. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from deResource | |
virtual | ~deResource () |
Clean up resource. More... | |
Protected Member Functions inherited from deObject | |
virtual | ~deObject () |
Clean up object. More... | |
Speaker resource.
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.
typedef deTObjectReference<deSpeaker> deSpeaker::Ref |
Type holding strong reference.
deSpeaker::deSpeaker | ( | deSpeakerManager * | manager | ) |
Create speaker.
|
protectedvirtual |
Clean up speaker object.
|
inline |
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.
|
inline |
Layer mask.
|
inline |
Next speaker in the parent microphone linked list.
|
inline |
Previous speaker in the parent microphone linked list.
|
inline |
Next speaker in the parent world linked list.
|
inline |
Previous speaker in the parent world linked list.
|
inline |
Speaker is playing once or is looping.
|
inline |
Speaker is muted.
|
inline |
Orientation.
|
inline |
Parent microphone or NULL.
|
inline |
Parent world or NULL.
|
inline |
Speaker is paused.
|
inline |
Audio system peer or NULL if not set.
|
inline |
Scripting system peer.
|
inline |
Start play position in samples.
|
inline |
Speaker is playing.
|
inline |
Play speed.
|
inline |
Play state.
|
inline |
End play position in samples.
|
inline |
Position.
|
inline |
Range beyond which the sound is inaudible.
|
inline |
Roll off factor.
1 is physically realistic. Larger than 1 applies stronger attenuation. Smaller values apply weaker attenuation.
|
inline |
Sound shape.
|
inline |
Sound or NULL if not set.
|
inline |
Speaker is stopped.
|
inline |
Synthesizer or NULL if not set.
|
inline |
Type.
|
inline |
Velocity in m/s.
|
inline |
Video player or NULL if not set.
|
inline |
Volume.
void deSpeaker::Pause | ( | ) |
Pause playing.
void deSpeaker::Play | ( | ) |
Start playing.
void deSpeaker::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 deSpeaker::SetLayerMask | ( | const decLayerMask & | layerMask | ) |
Set layer mask.
void deSpeaker::SetLLMicrophoneNext | ( | deSpeaker * | speaker | ) |
Set next speaker in the parent microphone linked list.
void deSpeaker::SetLLMicrophonePrev | ( | deSpeaker * | speaker | ) |
Set next speaker in the parent microphone linked list.
void deSpeaker::SetLLWorldNext | ( | deSpeaker * | speaker | ) |
Set next speaker in the parent world linked list.
void deSpeaker::SetLLWorldPrev | ( | deSpeaker * | speaker | ) |
Set next speaker in the parent world linked list.
void deSpeaker::SetLooping | ( | bool | looping | ) |
Set if speaker is playing once or is looping.
void deSpeaker::SetMuted | ( | bool | muted | ) |
Set if speaker is muted.
void deSpeaker::SetOrientation | ( | const decQuaternion & | orientation | ) |
Set orientation.
void deSpeaker::SetParentMicrophone | ( | deMicrophone * | microphone | ) |
Set parent microphone or NULL.
void deSpeaker::SetParentWorld | ( | deWorld * | world | ) |
Set parent world or NULL.
void deSpeaker::SetPeerAudio | ( | deBaseAudioSpeaker * | peer | ) |
Set audio system peer or NULL if not set.
void deSpeaker::SetPeerScripting | ( | deBaseScriptingSpeaker * | peer | ) |
Set scripting system peer.
void deSpeaker::SetPlayPosition | ( | int | playFrom, |
int | playTo | ||
) |
Set play position in samples.
void deSpeaker::SetPlaySpeed | ( | float | playSpeed | ) |
Set play speed.
void deSpeaker::SetPlayState | ( | ePlayStates | playState | ) |
Set play state.
void deSpeaker::SetPosition | ( | const decDVector & | position | ) |
Set position.
void deSpeaker::SetRange | ( | float | range | ) |
Set range beyond which the sound is inaudible.
void deSpeaker::SetRollOff | ( | float | rollOff | ) |
Set roll off factor.
1 is physically realistic. Larger than 1 applies stronger attenuation. Smaller values apply weaker attenuation.
void deSpeaker::SetShape | ( | const decShapeList & | shape | ) |
Set sound shape.
void deSpeaker::SetSound | ( | deSound * | sound | ) |
Set sound or NULL if not set.
void deSpeaker::SetSynthesizer | ( | deSynthesizerInstance * | synthesizer | ) |
Set synthesizer or NULL if not set.
void deSpeaker::SetType | ( | eSpeakerType | type | ) |
Set type.
void deSpeaker::SetVelocity | ( | const decVector & | velocity | ) |
Set velocity in m/s.
void deSpeaker::SetVideoPlayer | ( | deVideoPlayer * | videoPlayer | ) |
Set video player or NULL if not set.
void deSpeaker::SetVolume | ( | float | volume | ) |
Set volume.
void deSpeaker::Stop | ( | ) |
Stop playing.