Class Sound3D
- Namespace
- OmegaEngine.Audio
- Assembly
- OmegaEngine.dll
A memory-cached sound that is played on-demand simulating a position in 3D-space.
public class Sound3D : Sound, IDisposable, IAudio
- Inheritance
-
objectSound3D
- Implements
- Inherited Members
Constructors
Sound3D(XSound)
A memory-cached sound that is played on-demand simulating a position in 3D-space.
public Sound3D(XSound sound)
Parameters
soundXSound
Properties
AttachedTo
A PositionableRenderable this sound is attached to; null to use Position as an absolute world position.
[Browsable(false)]
public PositionableRenderable? AttachedTo { get; set; }
Property Value
- See Also
Attenuation
Factors describing how the sound's volume attenuates with distance from the listener.
public Attenuation Attenuation { get; set; }
Property Value
Offset
The offset from AttachedTo in its local coordinate system. Ignored while AttachedTo is null.
public Vector3 Offset { get; set; }
Property Value
- Vector3
Position
The sound's position in world space
public DoubleVector3 Position { get; set; }
Property Value
Remarks
While AttachedTo is set, this is recalculated from Offset once per frame and setting it has no lasting effect.
Methods
ApplyVolume()
Applies the current EffectiveVolume to the active playback (if any).
protected override void ApplyVolume()
CreatePlaybackChain(bool)
Builds the chain of sample providers feeding the mixer for a single playback.
protected override ISampleProvider CreatePlaybackChain(bool looping)
Parameters
loopingboolWhether the playback should loop.
Returns
- ISampleProvider
The top-level sample provider (stereo, IEEE-float).
OnDispose()
Hook that is called when the object needs to dispose its internal resources.
protected override void OnDispose()
OnEnded()
Called when the playback finishes on its own, i.e. not via StopPlayback(). Never called for looping playback.
protected override void OnEnded()
Remarks
Runs on the audio thread while the mixer is producing samples, so overrides must not block.
StartPlayback(bool)
Starts the sound playback
public override void StartPlayback(bool looping)
Parameters
loopingbool
StopPlayback()
Stops the sound playback
public override void StopPlayback()