Class TCastleSoundSource

Unit

Declaration

type TCastleSoundSource = class(TCastleBehavior)

Description

Behavior to play spatial sounds, that automatically follow the parent TCastleTransform transformation.

Hierarchy

Overview

Methods

Protected procedure ParentChanged; override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
Public procedure PlayOnce(const SoundType: TSoundType; const SoundHeight: Single; const TiedToParent: boolean = true);

Properties

Published property Sound: TCastleSound read FSound;

Description

Methods

Protected procedure ParentChanged; override;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
 
Public procedure PlayOnce(const SoundType: TSoundType; const SoundHeight: Single; const TiedToParent: boolean = true);

Play SoundType where the parent is.

The exact position is between Parent.Translation and Parent.Middle. SoundHeight = 0 means to use Parent.Translation, SoundHeight = 1 means Parent.Middle, other values imply a linear interpolation between the above two values.

If TiedToParent then the sound position will be updated as the parent will move, and when we will be destroyed, sound will stop. If not TiedToParent, then the sound will simply be done at parent's position, but then it will continue to be played independent of the parent existence or position.

Properties

Published property Sound: TCastleSound read FSound;

Optional default sound to play here, looping.

Note that this is not the only sound possible to play using this TCastleSoundSource. You can play any other TCastleSound instance, defined anywhere, by calling PlayOnce here.


Generated by PasDoc 0.16.0.