Class AudioPlayerClip
Represents an audio clip with various playback settings and properties.
Encapsulates all necessary information for managing and playing audio clips in the audio player system.
Implements
Inherited Members
Namespace: Serenity.AudioPlayer.Domain.Entities
Assembly: Serenity.AudioPlayer.Domain.dll
Syntax
public class AudioPlayerClip : IFoundationSettings
Constructors
AudioPlayerClip()
Initializes a new instance of the AudioPlayerClip class.
Declaration
public AudioPlayerClip()
AudioPlayerClip(IAudioPlayerClipDefinition, AudioPlayerType)
Declaration
public AudioPlayerClip(IAudioPlayerClipDefinition audioPlayerClipDefinition, AudioPlayerType clipType)
Parameters
| Type | Name | Description |
|---|---|---|
| IAudioPlayerClipDefinition | audioPlayerClipDefinition | |
| AudioPlayerType | clipType |
AudioPlayerClip(string, string, AudioPlayerType, bool, float, float, float, float, float, int, float, float, int, AudioPriorityPolicy, bool)
Initializes a new instance of the AudioPlayerClip class with specified parameters.
Declaration
public AudioPlayerClip(string id, string filePath, AudioPlayerType clipType = AudioPlayerType.SFX, bool loop = false, float volume = 1, float pitch = 1, float panStereo = 0, float spatialBlend = 0, float reverbZoneMix = 1, int rolloffMode = 0, float minDistance = 1, float maxDistance = 500, int priority = 50, AudioPriorityPolicy priorityPolicy = AudioPriorityPolicy.IgnoreIfNoSourceAvailable, bool canBeReplaced = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Unique identifier for the audio clip. |
| string | filePath | File path to the audio clip. |
| AudioPlayerType | clipType | Type of the audio clip (default is SFX). |
| bool | loop | Indicates whether the audio clip should loop (default is false). |
| float | volume | Volume level for the audio clip (default is 1.0). |
| float | pitch | Pitch level for the audio clip (default is 1.0). |
| float | panStereo | Pan stereo level for the audio clip (default is 0.0). |
| float | spatialBlend | Spatial blend level for the audio clip (default is 0.0). |
| float | reverbZoneMix | Reverb zone mix level for the audio clip (default is 1.0). |
| int | rolloffMode | Rolloff mode for the audio clip (default is 0). |
| float | minDistance | Minimum distance for the audio clip (default is 1.0). |
| float | maxDistance | Maximum distance for the audio clip (default is 500.0). |
| int | priority | Serenity priority of the audio clip; higher value = more important (default is 50). |
| AudioPriorityPolicy | priorityPolicy | Policy deciding whether the clip may take over a busy source when the pool is full (default is IgnoreIfNoSourceAvailable). |
| bool | canBeReplaced | Whether a sound started from this clip may be reassigned (default is true). |
Fields
DEFAULT_CAN_BE_REPLACED
Declaration
protected const bool DEFAULT_CAN_BE_REPLACED = true
Field Value
| Type | Description |
|---|---|
| bool | Default replaceability for audio clips. |
DEFAULT_CLIP_TYPE
Declaration
protected const AudioPlayerType DEFAULT_CLIP_TYPE = SFX
Field Value
| Type | Description |
|---|---|
| AudioPlayerType | Default clip type for audio clips. |
DEFAULT_LOOP
Declaration
protected const bool DEFAULT_LOOP = false
Field Value
| Type | Description |
|---|---|
| bool | Default loop setting for audio clips. |
DEFAULT_MAX_DISTANCE
Declaration
protected const float DEFAULT_MAX_DISTANCE = 500
Field Value
| Type | Description |
|---|---|
| float | Default maximum distance for audio clips. |
DEFAULT_MIN_DISTANCE
Declaration
protected const float DEFAULT_MIN_DISTANCE = 1
Field Value
| Type | Description |
|---|---|
| float | Default minimum distance for audio clips. |
DEFAULT_PAN_STEREO
Declaration
protected const float DEFAULT_PAN_STEREO = 0
Field Value
| Type | Description |
|---|---|
| float | Default pan stereo level for audio clips. |
DEFAULT_PITCH
Declaration
protected const float DEFAULT_PITCH = 1
Field Value
| Type | Description |
|---|---|
| float | Default pitch level for audio clips. |
DEFAULT_PRIORITY
Declaration
protected const int DEFAULT_PRIORITY = 50
Field Value
| Type | Description |
|---|---|
| int | Default Serenity priority for audio clips. Higher value = more important. |
DEFAULT_PRIORITY_POLICY
Declaration
protected const AudioPriorityPolicy DEFAULT_PRIORITY_POLICY = IgnoreIfNoSourceAvailable
Field Value
| Type | Description |
|---|---|
| AudioPriorityPolicy | Default priority policy for audio clips. Preserves the historical "drop the sound when the pool is full" behavior. |
DEFAULT_REVERB_ZONE_MIX
Declaration
protected const float DEFAULT_REVERB_ZONE_MIX = 1
Field Value
| Type | Description |
|---|---|
| float | Default reverb zone mix level for audio clips. |
DEFAULT_ROLLOFF_MODE
Declaration
protected const int DEFAULT_ROLLOFF_MODE = 0
Field Value
| Type | Description |
|---|---|
| int | Default rolloff mode for audio clips. |
DEFAULT_SPATIAL_BLEND
Declaration
protected const float DEFAULT_SPATIAL_BLEND = 0
Field Value
| Type | Description |
|---|---|
| float | Default spatial blend level for audio clips. |
DEFAULT_VOLUME
Declaration
protected const float DEFAULT_VOLUME = 1
Field Value
| Type | Description |
|---|---|
| float | Default volume level for audio clips. |
_canBeReplaced
Declaration
protected bool _canBeReplaced
Field Value
| Type | Description |
|---|---|
| bool | Whether a sound started from this clip may be reassigned to a higher-priority sound. |
_clipType
Declaration
protected AudioPlayerType _clipType
Field Value
| Type | Description |
|---|---|
| AudioPlayerType | Type of the audio clip (e.g., SFX, Music). |
_filePath
Declaration
protected string _filePath
Field Value
| Type | Description |
|---|---|
| string | File path to the audio clip. |
_guid
Declaration
protected string _guid
Field Value
| Type | Description |
|---|---|
| string | Global unique identifier for the audio clip. |
_id
Declaration
protected string _id
Field Value
| Type | Description |
|---|---|
| string | Unique identifier for the audio clip. |
_loop
Declaration
protected bool _loop
Field Value
| Type | Description |
|---|---|
| bool | Indicates whether the audio clip should loop. |
_maxDistance
Declaration
protected float _maxDistance
Field Value
| Type | Description |
|---|---|
| float | Maximum distance for the audio clip. |
_minDistance
Declaration
protected float _minDistance
Field Value
| Type | Description |
|---|---|
| float | Minimum distance for the audio clip. |
_panStereo
Declaration
protected float _panStereo
Field Value
| Type | Description |
|---|---|
| float | Pan stereo level for the audio clip. |
_pitch
Declaration
protected float _pitch
Field Value
| Type | Description |
|---|---|
| float | Pitch level for the audio clip. |
_priority
Declaration
protected int _priority
Field Value
| Type | Description |
|---|---|
| int | Serenity priority of the audio clip. Higher value = more important. |
_priorityPolicy
Declaration
protected AudioPriorityPolicy _priorityPolicy
Field Value
| Type | Description |
|---|---|
| AudioPriorityPolicy | Policy deciding whether this clip may take over a busy source when the pool is full. |
_reverbZoneMix
Declaration
protected float _reverbZoneMix
Field Value
| Type | Description |
|---|---|
| float | Reverb zone mix level for the audio clip. |
_rolloffMode
Declaration
protected int _rolloffMode
Field Value
| Type | Description |
|---|---|
| int | Rolloff mode for the audio clip. |
_spatialBlend
Declaration
protected float _spatialBlend
Field Value
| Type | Description |
|---|---|
| float | Spatial blend level for the audio clip. |
_volume
Declaration
protected float _volume
Field Value
| Type | Description |
|---|---|
| float | Volume level for the audio clip. |
Properties
Guid
Declaration
public string Guid { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Gets or sets the global unique identifier for the audio clip. |
Id
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string | Gets or sets the unique identifier for the audio clip. |
Methods
GetCanBeReplaced()
Gets whether a sound started from this clip may be reassigned to a higher-priority sound.
Declaration
public bool GetCanBeReplaced()
Returns
| Type | Description |
|---|---|
| bool | True if the playing sound may be replaced, false otherwise |
GetClipType()
Gets the type of the audio clip.
Declaration
public AudioPlayerType GetClipType()
Returns
| Type | Description |
|---|---|
| AudioPlayerType | AudioPlayerType enum value |
GetFilePath()
Gets the file path of the audio clip.
Declaration
public string GetFilePath()
Returns
| Type | Description |
|---|---|
| string | File path string |
GetId()
Gets the unique identifier of the audio clip.
Declaration
public string GetId()
Returns
| Type | Description |
|---|---|
| string | Unique identifier string |
GetLoop()
Gets whether the audio clip is set to loop.
Declaration
public bool GetLoop()
Returns
| Type | Description |
|---|---|
| bool | True if looping is enabled, false otherwise |
GetMaxDistance()
Gets the maximum distance of the audio clip.
Declaration
public float GetMaxDistance()
Returns
| Type | Description |
|---|---|
| float | Maximum distance as a float |
GetMinDistance()
Gets the minimum distance of the audio clip.
Declaration
public float GetMinDistance()
Returns
| Type | Description |
|---|---|
| float | Minimum distance as a float |
GetPanStereo()
Gets the pan stereo level of the audio clip.
Declaration
public float GetPanStereo()
Returns
| Type | Description |
|---|---|
| float | Pan stereo level as a float |
GetPitch()
Gets the pitch level of the audio clip.
Declaration
public float GetPitch()
Returns
| Type | Description |
|---|---|
| float | Pitch level as a float |
GetPriority()
Gets the Serenity priority of the audio clip. Higher value = more important.
Declaration
public int GetPriority()
Returns
| Type | Description |
|---|---|
| int | Priority as an integer |
GetPriorityPolicy()
Gets the priority policy of the audio clip.
Declaration
public AudioPriorityPolicy GetPriorityPolicy()
Returns
| Type | Description |
|---|---|
| AudioPriorityPolicy | The AudioPriorityPolicy for this clip |
GetReverbZoneMix()
Gets the reverb zone mix level of the audio clip.
Declaration
public float GetReverbZoneMix()
Returns
| Type | Description |
|---|---|
| float | Reverb zone mix level as a float |
GetRolloffMode()
Gets the rolloff mode of the audio clip.
Declaration
public int GetRolloffMode()
Returns
| Type | Description |
|---|---|
| int | Rolloff mode as an integer |
GetSpatialBlend()
Gets the spatial blend level of the audio clip.
Declaration
public float GetSpatialBlend()
Returns
| Type | Description |
|---|---|
| float | Spatial blend level as a float |
GetVolume()
Gets the volume level of the audio clip.
Declaration
public float GetVolume()
Returns
| Type | Description |
|---|---|
| float | Volume level as a float |
SetCanBeReplaced(bool)
Sets whether a sound started from this clip may be reassigned.
Declaration
public void SetCanBeReplaced(bool canBeReplaced)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | canBeReplaced | True to allow replacement, false to protect the sound. |
SetClipType(AudioPlayerType)
Sets the type of the audio clip.
Declaration
public void SetClipType(AudioPlayerType clipType)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioPlayerType | clipType | The audio clip type to set. |
SetFilePath(string)
Sets the file path of the audio clip.
Declaration
public void SetFilePath(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | The file path to set. |
SetLoop(bool)
Sets whether the audio clip should loop.
Declaration
public void SetLoop(bool loop)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | loop | True to enable looping, false to disable. |
SetMaxDistance(float)
Sets the maximum distance of the audio clip.
Declaration
public void SetMaxDistance(float maxDistance)
Parameters
| Type | Name | Description |
|---|---|---|
| float | maxDistance | The maximum distance to set. |
SetMinDistance(float)
Sets the minimum distance of the audio clip.
Declaration
public void SetMinDistance(float minDistance)
Parameters
| Type | Name | Description |
|---|---|---|
| float | minDistance | The minimum distance to set. |
SetPanStereo(float)
Sets the pan stereo level of the audio clip.
Declaration
public void SetPanStereo(float panStereo)
Parameters
| Type | Name | Description |
|---|---|---|
| float | panStereo | The pan stereo level to set. |
SetPitch(float)
Sets the pitch level of the audio clip.
Declaration
public void SetPitch(float pitch)
Parameters
| Type | Name | Description |
|---|---|---|
| float | pitch | The pitch level to set. |
SetPriority(int)
Sets the Serenity priority of the audio clip. Higher value = more important.
Declaration
public void SetPriority(int priority)
Parameters
| Type | Name | Description |
|---|---|---|
| int | priority | The priority to set. |
SetPriorityPolicy(AudioPriorityPolicy)
Sets the priority policy of the audio clip.
Declaration
public void SetPriorityPolicy(AudioPriorityPolicy priorityPolicy)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioPriorityPolicy | priorityPolicy | The priority policy to set. |
SetReverbZoneMix(float)
Sets the reverb zone mix level of the audio clip.
Declaration
public void SetReverbZoneMix(float reverbZoneMix)
Parameters
| Type | Name | Description |
|---|---|---|
| float | reverbZoneMix | The reverb zone mix level to set. |
SetRolloffMode(int)
Sets the rolloff mode of the audio clip.
Declaration
public void SetRolloffMode(int rolloffMode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rolloffMode | The rolloff mode to set. |
SetSpatialBlend(float)
Sets the spatial blend level of the audio clip.
Declaration
public void SetSpatialBlend(float spatialBlend)
Parameters
| Type | Name | Description |
|---|---|---|
| float | spatialBlend | The spatial blend level to set. |
SetVolume(float)
Sets the volume level of the audio clip.
Declaration
public void SetVolume(float volume)
Parameters
| Type | Name | Description |
|---|---|---|
| float | volume | The volume level to set. |
ToString()
Returns a string representation of the audio clip.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | String representation of the audio clip |