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 ParentChanged; 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 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; |
Description
Methods
procedure ParentChanged; 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; |
|
Play given sound once (not looping). If the sound is spatial (TCastleSound.Spatial), it's 3D position will reflect the Parent (TCastleTransform) position. |
procedure Play(const PlayingSound: TCastlePlayingSoundSource); overload; |
|
Play given sound. If the sound is spatial (TCastleSound.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. 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 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. |
Generated by PasDoc 0.16.0.