Class TCastleSoundSource
Unit
Declaration
type TCastleSoundSource = class(TCastleBehavior)
Description
Behavior to play spatial sounds, that automatically follow the parent TCastleTransform transformation. Multiple such behaviors may be attached to a single TCastleTransform (if you need to play multiple looping sounds, or want to have multiple playback settings like different Volume control).
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleBehavior
- TCastleSoundSource
Overview
Methods
procedure ParentAfterAttach; override; |
|
procedure ParentBeforeDetach; override; |
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure Play(const ASound: TCastleSound); overload; |
|
procedure Play(const PlayingSound: TCastlePlayingSoundSource); overload; |
Properties
property Sound: TCastleSound read FSound write SetSound; |
|
property SoundPlaying: Boolean read FSoundPlaying write SetSoundPlaying default true; |
|
property Spatial: Boolean read FSpatial write SetSpatial default true; |
|
property Volume: Single read FVolume write SetVolume
default 1.0; |
|
property Pitch: Single read FPitch write SetPitch
default 1.0; |
|
property Priority: Single read FPriority write SetPriority
default 1.0; |
Description
Methods
procedure ParentAfterAttach; override; |
|
This item has no description. Showing description inherited from TCastleBehavior.ParentAfterAttach. Called after Parent changed, e.g. at the end of TCastleTransform.AddBehavior. |
procedure ParentBeforeDetach; override; |
|
This item has no description. Showing description inherited from TCastleBehavior.ParentBeforeDetach. Called before Parent changed, e.g. at the beginning of TCastleTransform.RemoveBehavior. This is also called at the destruction of behavior (more precisely from BeforeDestruction now). Even in this case, we guarantee that Parent is still valid during this call, and not in half-destroyed state. Before the actual destructor of TCastleBehavior we do BeforeParentDetach and BeforeWorldDetach and set Parent to |
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
|
This item has no description. |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override; |
|
This item has no description. Showing description inherited from TCastleBehavior.Update. Continuously occuring event, for various tasks. |
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
This item has no description. Showing description inherited from TCastleComponent.PropertySections. Section where to show property in the editor. |
procedure Play(const ASound: TCastleSound); overload; |
|
Play given sound once (not looping). If the sound source is spatial (TCastleSoundSource.Spatial), it's 3D position will reflect the Parent (TCastleTransform) position. |
procedure Play(const PlayingSound: TCastlePlayingSoundSource); overload; |
|
Play given sound. If the sound source is spatial (TCastleSoundSource.Spatial), it's 3D position will reflect the Parent (TCastleTransform) position. Set TCastlePlayingSound.Sound before passing it to this method. Otherwise, if TCastlePlayingSound.Sound is left Use the TCastlePlayingSound properties to provide additional information about the sound playback. E.g. assign TCastlePlayingSound.Loop TCastlePlayingSound.OnStop or control sound afterwards by TCastlePlayingSound.Stop, TCastlePlayingSound.Offset. Consider using TCastlePlayingSound.FreeOnStop if you don't want to manage the lifetime of the TCastlePlayingSound instance. |
Properties
property Sound: TCastleSound read FSound write SetSound; |
|
Sound to play, always looping. Control playback of it using SoundPlaying. Note that this is not the only sound possible to play using this TCastleSoundSource. You can play any other TCastleSound or TCastlePlayingSoundSource instance (looping or not looping) by calling Play method. |
property SoundPlaying: Boolean read FSoundPlaying write SetSoundPlaying default true; |
|
Is the Sound currently playing. Setting it to |
property Spatial: Boolean read FSpatial write SetSpatial default true; |
|
Is the sound playback spatialized. Affects sounds played by assigning Sound or calling Play here. Spatial sounds are louder/more silent depending on their 3D distance to listener (this means a distance from TCastleTransform origin to the camera within the TCastleViewport). And their relative position to the listener in 3D is reflected by making them louder/more silent in the proper (e.g. left or right) speaker. Note that some sound backends (like OpenAL) can only spatialize mono sounds, and play stereo sounds always as non-spatialized. |
property Volume: Single read FVolume write SetVolume
default 1.0; |
|
Volume (how loud the playing sound is). The effective sound volume is a multiplication of TCastleSound.Volume, TCastlePlayingSound.Volume and TCastleSoundSource.Volume. It is also affected by spatial calculations (if the sound is played with TCastleSoundSource.Spatial = Any value > 0 is allowed. |
property Pitch: Single read FPitch write SetPitch
default 1.0; |
|
Sound playing speed. The effective sound pitch is a multiplication of TCastleSound.Pitch, TCastlePlayingSound.Pitch and TCastleSoundSource.Pitch. Any value > 0 is allowed. |
property Priority: Single read FPriority write SetPriority
default 1.0; |
|
How important is the sound, between 0.0 (least important) to 1.0 (most important). The effective priority is a multiplication of TCastleSound.Priority, TCastlePlayingSound.Priority and TCastleSoundSource.Priority. Any value > 0 is allowed. |
Generated by PasDoc 0.16.0-snapshot.