Class TCastlePlayingSoundSource
Unit
Declaration
type TCastlePlayingSoundSource = class(TCastlePlayingSound)
Description
Controls a sound playback initiated by TCastleSoundSource.Play. See the ancestor TCastlePlayingSound for most important documentation. This class simply extends the ancestor with some properties useful only together with the TCastleSoundSource.
Source: transform/castlebehaviors_soundsource.inc (line 26).
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastlePlayingSound
- TCastlePlayingSoundSource
Overview
Methods
| Public | destructor Destroy; override; |
| Public | function Playing: Boolean; |
| Public | procedure Stop; |
| Protected | procedure DoStop; override; |
| Public | constructor Create(AOwner: TComponent); override; |
| Public | function InternalFinalVolume: Single; override; |
| Public | function InternalFinalPitch: Single; override; |
| Public | function InternalFinalPriority: Single; override; |
Properties
| Public | property Sound: TCastleSound read FSound write SetSound; |
| Public | property OnStop: TNotifyEvent read FOnStop write SetOnStop; |
| Public | property FreeOnStop: Boolean read FFreeOnStop write SetFreeOnStop default false; |
| Public | property Loop: Boolean read FLoop write SetLoop default false; |
| Public | property Volume: Single read FVolume write SetVolume default 1.0; |
| Public | property Pitch: Single read FPitch write SetPitch default 1.0; |
| Public | property Priority: Single read FPriority write SetPriority default 1.0; |
| Public | property Offset: Single read GetOffset write SetOffset; |
| Public | property InitialOffset: Single read FInitialOffset write FInitialOffset; |
| Public | property Follow: Boolean read FFollow write FFollow default true; |
| Public | property SoundHeight: Single read FSoundHeight write FSoundHeight
default 0.0; |
Description
Methods
| Public | destructor Destroy; override; |
|
This item is declared in ancestor TCastlePlayingSound. This item has no description. | |
| Public | function Playing: Boolean; |
|
This item is declared in ancestor TCastlePlayingSound.
Is the sound playing now. Using TSoundEngine.Play or TCastleSoundSource.Play makes it Source: audio/castlesoundengine_playingsound.inc (line 134). | |
| Public | procedure Stop; |
|
This item is declared in ancestor TCastlePlayingSound. Stop playing now. Note that you can also free the TCastlePlayingSound instance, it will always automatically stop the playback. Calling this on a sound that is not playing is allowed, and ignored. Source: audio/castlesoundengine_playingsound.inc (line 200). | |
| Protected | procedure DoStop; override; |
|
This item has no description. Showing description inherited from TCastlePlayingSound.DoStop. Do the necessary job after source stopped, due to any reason. In this class it handles OnStop and FreeOnStop. If you override this: Since FreeOnStop may free the instance, you should add your code before calling inherited. Source: transform/castlebehaviors_soundsource.inc (line 36). | |
| Public | constructor Create(AOwner: TComponent); override; |
|
This item has no description. Source: transform/castlebehaviors_soundsource.inc (line 38). | |
| Public | function InternalFinalVolume: Single; override; |
|
This item has no description. Source: transform/castlebehaviors_soundsource.inc (line 39). | |
| Public | function InternalFinalPitch: Single; override; |
|
This item has no description. Source: transform/castlebehaviors_soundsource.inc (line 40). | |
| Public | function InternalFinalPriority: Single; override; |
|
This item has no description. Source: transform/castlebehaviors_soundsource.inc (line 41). | |
Properties
| Public | property Sound: TCastleSound read FSound write SetSound; |
|
This item is declared in ancestor TCastlePlayingSound. Associated sound used for playing. You have to set it before playing. Cannot be changed while playing. | |
| Public | property OnStop: TNotifyEvent read FOnStop write SetOnStop; |
|
This item is declared in ancestor TCastlePlayingSound. If provided, we will call this event when sound stops playing. Note that in some cases the sound cannot be played at all. For example when TCastleSound is not loaded (no TCastleSound.URL provided, or invalid TCastleSound.URL provided) or when there are no free sound sources (these are limited in sound backends; the new sound may "steal" some sound source but only if the TCastleSound.Priority is high enough). Then TSoundEngine.Play or TCastleSoundSource.Play call the If the object owning the notification method may be destroyed before TCastlePlayingSound is destroyed, be sure to set this callback to You can only set this when sound is not playing (as otherwise it would be an easy source of bugs – sometimes TSoundEngine.Play wants to immediately stop sound playback). Source: audio/castlesoundengine_playingsound.inc (line 117). | |
| Public | property FreeOnStop: Boolean read FFreeOnStop write SetFreeOnStop default false; |
|
This item is declared in ancestor TCastlePlayingSound. Automatically free when the playback finishes. If the playback is not yet started, it will wait for it to start, and then finish. You can only set this when sound is not playing (as otherwise it would be an easy source of bugs – sometimes TSoundEngine.Play wants to immediately stop sound playback). Source: audio/castlesoundengine_playingsound.inc (line 125). | |
| Public | property Loop: Boolean read FLoop write SetLoop default false; |
|
This item is declared in ancestor TCastlePlayingSound. Is the playback looping. You can change this on a playing or stopped sound. Source: audio/castlesoundengine_playingsound.inc (line 129). | |
| Public | property Volume: Single read FVolume write SetVolume default 1.0; |
|
This item is declared in ancestor TCastlePlayingSound. Volume (how loud the playing sound is). The effective sound volume is a multiplication of TCastleSound.Volume, TCastlePlayingSound.Volume and TCastleSoundSource.Volume (if the sound is played through TCastleSoundSource). It is also affected by spatial calculations (if the sound is played through TCastleSoundSource with TCastleSoundSource.Spatial = Any value > 0 is allowed. Source: audio/castlesoundengine_playingsound.inc (line 146). | |
| Public | property Pitch: Single read FPitch write SetPitch default 1.0; |
|
This item is declared in ancestor TCastlePlayingSound. Sound playing speed. The effective sound pitch is a multiplication of TCastleSound.Pitch, TCastlePlayingSound.Pitch and TCastleSoundSource.Pitch (if the sound is played through TCastleSoundSource). Any value > 0 is allowed. Source: audio/castlesoundengine_playingsound.inc (line 155). | |
| Public | property Priority: Single read FPriority write SetPriority default 1.0; |
|
This item is declared in ancestor TCastlePlayingSound. 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 (if the sound is played through TCastleSoundSource). Source: audio/castlesoundengine_playingsound.inc (line 162). | |
| Public | property Offset: Single read GetOffset write SetOffset; |
|
This item is declared in ancestor TCastlePlayingSound. Playback time of this sound, expressed in seconds. This value will loop back to zero for looping sound sources. Setting this to something larger than the sound duration (which you can read from TCastleSound.Duration) is ignored. This offset refers to the sound like it had a Pitch equal 1.0 (when the sound is not slowed down or sped up). So this offset will vary from 0 to the TCastleSound.Duration, regardless of the initial/current TCastleSound.Pitch value. The actual seconds passed since the sound started playing may be different, if you change the TCastleSound.Pitch to something else than 1.0. Using this on a sound that is not playing is allowed. Getting this value always returns zero in this case, and setting it is ignored. Note: you can adjust InitialOffset to determine the offset for starting new sound. It is deliberately a separate property from current Offset, otherwise it would be too easy to accidentally start playing in the middle when you wanted to play from the start. Source: audio/castlesoundengine_playingsound.inc (line 185). | |
| Public | property InitialOffset: Single read FInitialOffset write FInitialOffset; |
|
This item is declared in ancestor TCastlePlayingSound. Initial position, in seconds, within the sound when we start playing it. You can get/set this property regardless of whether sound is playing. Source: audio/castlesoundengine_playingsound.inc (line 189). | |
| Public | property Follow: Boolean read FFollow write FFollow default true; |
|
If Follow then the sound position will be updated as the parent TCastleTransform moves. Moreover, when TCastleSoundSource will be destroyed, the sound will stop. An example would be a walking sound of a creature – the sound moves together with the creature. If not Follow, then the sound will start at the parent's position, and then it will continue to be played independent of the parent existence or position changes. An example would be an explosion sound – the sound stays at the position it happened, regardless if the object moved. This matters only for spatial sounds (TCastleSoundSource.Spatial). Source: transform/castlebehaviors_soundsource.inc (line 57). | |
| Public | property SoundHeight: Single read FSoundHeight write FSoundHeight
default 0.0; |
|
The exact sound position reflects the transformation of the TCastleSoundSource, either Parent.Translation or Parent.Middle. Use this property to control which one, it makes a linear interpolation between them.
You can conigure Parent.Middle using Parent.MiddleHeight. Source: transform/castlebehaviors_soundsource.inc (line 73). | |
Generated by PasDoc 0.17.0.snapshot.