feat: AudioSettings 独立出配置文件,而不是零散在代码各处。
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// 音频系统扩展配置,集中管理所有路径和可调参数。
|
||||
/// 资产位置:Assets/Settings/AudioExtendSettings.asset
|
||||
/// 编辑入口:Project Settings > Audio Extend
|
||||
/// 运行时注入:AudioSystem.Awake() 将 Inspector 引用注入 _instance
|
||||
/// </summary>
|
||||
public class AudioExtendSettings : ScriptableObject
|
||||
{
|
||||
// ========== Resource Paths ==========
|
||||
[Header("Resource Paths")]
|
||||
[Tooltip("Resources 子目录:音频配置文件(.bytes)")]
|
||||
public string audioConfigPath = "AudioData";
|
||||
|
||||
[Tooltip("Resources 子目录:音频资源文件(.wav/.ogg)")]
|
||||
public string audioResourcePath = "Audios";
|
||||
|
||||
[Tooltip("Resources 路径:AudioMixer 资产")]
|
||||
public string audioMixerPath = "Audios/Master";
|
||||
|
||||
// ========== AudioMixer Group Paths ==========
|
||||
[Header("AudioMixer Groups")]
|
||||
public string sfxGroupPath = "Master/Regular/SFX";
|
||||
public string voiceGroupPath = "Master/Regular/Voice";
|
||||
public string accentSfxGroupPath = "Master/SFX_Accent";
|
||||
public string musicGroupPath = "Master/Regular/Music";
|
||||
public string ambienceGroupPath = "Master/Regular/SFX/Ambience";
|
||||
|
||||
// ========== AudioMixer Parameters ==========
|
||||
[Header("Lowpass Filter")]
|
||||
public string lowpassParamName = "LowpassFreq";
|
||||
public float lowpassEnabledCutoff = 440f;
|
||||
public float lowpassDisabledCutoff = 22000f;
|
||||
public float lowpassTweenDuration = 0.2f;
|
||||
|
||||
// ========== Audio Import ==========
|
||||
[Header("Audio Import Settings")]
|
||||
public AudioCompressionFormat compressionFormat = AudioCompressionFormat.Vorbis;
|
||||
public uint sfxSampleRate = 22050;
|
||||
public uint musicSampleRate = 44100;
|
||||
public float musicQuality = 0.13f;
|
||||
public float sfxQuality = 0.5f;
|
||||
|
||||
public float decompressThreshold = 5f; // ≤ 此值 → DecompressOnLoad
|
||||
public float streamingThreshold = 15f; // ≥ 此值 → Streaming
|
||||
|
||||
// ========== Fade ==========
|
||||
[Header("Fade")]
|
||||
public DG.Tweening.Ease defaultFadeOutEase = DG.Tweening.Ease.InSine;
|
||||
public DG.Tweening.Ease defaultFadeInEase = DG.Tweening.Ease.OutSine;
|
||||
|
||||
// ── Singleton ──
|
||||
|
||||
public static AudioExtendSettings Instance { get; internal set; }
|
||||
|
||||
// 便利属性:拼接完整路径
|
||||
public string FullAudioResourcePath
|
||||
{
|
||||
get { return Path.Combine(Application.dataPath, "Resources", this.audioResourcePath); }
|
||||
}
|
||||
|
||||
public string FullAudioConfigPath
|
||||
{
|
||||
get { return Path.Combine(Application.dataPath, "Resources", this.audioConfigPath); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user