//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 loyalsoft. All rights reserved.
// Homepage: http://www.game7000.com/
// Feedback: http://www.game7000.com/
//------------------------------------------------------------
namespace GameFramework.Sound
{
///
/// 播放声音参数。
///
public sealed class PlaySoundParams : IReference
{
private bool m_Referenced;
private float m_Time;
private bool m_MuteInSoundGroup;
private bool m_Loop;
private int m_Priority;
private float m_VolumeInSoundGroup;
private float m_FadeInSeconds;
private float m_Pitch;
private float m_PanStereo;
private float m_SpatialBlend;
private float m_MaxDistance;
private float m_DopplerLevel;
///
/// 初始化播放声音参数的新实例。
///
public PlaySoundParams()
{
m_Referenced = false;
m_Time = Constant.DefaultTime;
m_MuteInSoundGroup = Constant.DefaultMute;
m_Loop = Constant.DefaultLoop;
m_Priority = Constant.DefaultPriority;
m_VolumeInSoundGroup = Constant.DefaultVolume;
m_FadeInSeconds = Constant.DefaultFadeInSeconds;
m_Pitch = Constant.DefaultPitch;
m_PanStereo = Constant.DefaultPanStereo;
m_SpatialBlend = Constant.DefaultSpatialBlend;
m_MaxDistance = Constant.DefaultMaxDistance;
m_DopplerLevel = Constant.DefaultDopplerLevel;
}
///
/// 获取或设置播放位置。
///
public float Time
{
get
{
return m_Time;
}
set
{
m_Time = value;
}
}
///
/// 获取或设置在声音组内是否静音。
///
public bool MuteInSoundGroup
{
get
{
return m_MuteInSoundGroup;
}
set
{
m_MuteInSoundGroup = value;
}
}
///
/// 获取或设置是否循环播放。
///
public bool Loop
{
get
{
return m_Loop;
}
set
{
m_Loop = value;
}
}
///
/// 获取或设置声音优先级。
///
public int Priority
{
get
{
return m_Priority;
}
set
{
m_Priority = value;
}
}
///
/// 获取或设置在声音组内音量大小。
///
public float VolumeInSoundGroup
{
get
{
return m_VolumeInSoundGroup;
}
set
{
m_VolumeInSoundGroup = value;
}
}
///
/// 获取或设置声音淡入时间,以秒为单位。
///
public float FadeInSeconds
{
get
{
return m_FadeInSeconds;
}
set
{
m_FadeInSeconds = value;
}
}
///
/// 获取或设置声音音调。
///
public float Pitch
{
get
{
return m_Pitch;
}
set
{
m_Pitch = value;
}
}
///
/// 获取或设置声音立体声声相。
///
public float PanStereo
{
get
{
return m_PanStereo;
}
set
{
m_PanStereo = value;
}
}
///
/// 获取或设置声音空间混合量。
///
public float SpatialBlend
{
get
{
return m_SpatialBlend;
}
set
{
m_SpatialBlend = value;
}
}
///
/// 获取或设置声音最大距离。
///
public float MaxDistance
{
get
{
return m_MaxDistance;
}
set
{
m_MaxDistance = value;
}
}
///
/// 获取或设置声音多普勒等级。
///
public float DopplerLevel
{
get
{
return m_DopplerLevel;
}
set
{
m_DopplerLevel = value;
}
}
internal bool Referenced
{
get
{
return m_Referenced;
}
}
///
/// 创建播放声音参数。
///
/// 创建的播放声音参数。
public static PlaySoundParams Create()
{
PlaySoundParams playSoundParams = ReferencePool.Acquire();
playSoundParams.m_Referenced = true;
return playSoundParams;
}
///
/// 清理播放声音参数。
///
public void Clear()
{
m_Time = Constant.DefaultTime;
m_MuteInSoundGroup = Constant.DefaultMute;
m_Loop = Constant.DefaultLoop;
m_Priority = Constant.DefaultPriority;
m_VolumeInSoundGroup = Constant.DefaultVolume;
m_FadeInSeconds = Constant.DefaultFadeInSeconds;
m_Pitch = Constant.DefaultPitch;
m_PanStereo = Constant.DefaultPanStereo;
m_SpatialBlend = Constant.DefaultSpatialBlend;
m_MaxDistance = Constant.DefaultMaxDistance;
m_DopplerLevel = Constant.DefaultDopplerLevel;
}
}
}