/// /// 音频系统常量定义 /// public static class AudioConstant { #region Playback Limits /// /// 最大音乐播放数 /// public const int MaxMusicCount = 1; /// /// 最大音效播放数 /// public const int MaxSoundCount = 100; /// /// 最大语音播放数 /// public const int MaxSpeakCount = 1; /// /// 音乐播放池上限 /// public const int MusicPlayingLimit = 1; /// /// 音效播放池上限 /// public const int SoundPlayingLimit = 16; /// /// 语音播放池上限 /// public const int SpeakPlayingLimit = 8; #endregion #region Priority Values /// /// 最高优先级 /// public const int MaxPriority = 99; /// /// 最低优先级 /// public const int MinPriority = 0; /// /// 默认优先级 /// public const int DefaultPriority = 29; /// /// 低优先级 /// public const int LowPriority = 30; #endregion #region Fade Duration /// /// 默认淡入时长(秒) /// public const float DefaultFadeInDuration = 2f; /// /// 默认淡出时长(秒) /// public const float DefaultFadeOutDuration = 2f; #endregion #region Stopped Pool Limits /// /// 音乐停止池上限 /// public const int MusicStoppedLimit = 0; /// /// 音效停止池上限 /// public const int SoundStoppedLimit = 16; /// /// 语音停止池上限 /// public const int SpeakStoppedLimit = 1; #endregion #region Stopped Pool Timeout /// /// 音乐停止池超时时间(秒)- 长时间未使用则释放 /// public const float MusicStoppedTimeout = 60f; /// /// 音效停止池超时时间(秒)- 长时间未使用则释放 /// public const float SoundStoppedTimeout = 30f; /// /// 语音停止池超时时间(秒)- 长时间未使用则释放 /// public const float SpeakStoppedTimeout = 20f; /// /// 停止池超时检查间隔(秒)- 降低检查频率 /// public const float StoppedPoolCheckInterval = 1f; #endregion } /// /// 音频池容量配置 /// 用于配置播放池和停止池的容量上限 /// public struct AudioPoolConfig { /// /// 音乐播放池上限 /// public int MusicPlayingLimit; /// /// 音效播放池上限 /// public int SoundPlayingLimit; /// /// 语音播放池上限 /// public int SpeakPlayingLimit; /// /// 音乐停止池上限 /// public int MusicStoppedLimit; /// /// 音效停止池上限 /// public int SoundStoppedLimit; /// /// 语音停止池上限 /// public int SpeakStoppedLimit; /// /// 音乐停止池超时时间(秒)- 长时间未使用则释放 /// public float MusicStoppedTimeout; /// /// 音效停止池超时时间(秒)- 长时间未使用则释放 /// public float SoundStoppedTimeout; /// /// 语音停止池超时时间(秒)- 长时间未使用则释放 /// public float SpeakStoppedTimeout; /// /// 默认配置 /// public static AudioPoolConfig Default => new AudioPoolConfig { MusicPlayingLimit = AudioConstant.MusicPlayingLimit, SoundPlayingLimit = AudioConstant.SoundPlayingLimit, SpeakPlayingLimit = AudioConstant.SpeakPlayingLimit, MusicStoppedLimit = AudioConstant.MusicStoppedLimit, SoundStoppedLimit = AudioConstant.SoundStoppedLimit, SpeakStoppedLimit = AudioConstant.SpeakStoppedLimit, MusicStoppedTimeout = AudioConstant.MusicStoppedTimeout, SoundStoppedTimeout = AudioConstant.SoundStoppedTimeout, SpeakStoppedTimeout = AudioConstant.SpeakStoppedTimeout, }; }