feat: implement volume step feature

- Add volume step functionality with VolumeStepResolver class
- Add VolumeStepThreshold, Volume, and VolumeStep properties to AudioObject
- Integrate volume step resolution in SfxSystem for dynamic audio volume control
This commit is contained in:
2026-04-13 16:56:34 +08:00
parent 0f204aa794
commit 31d117851e
15 changed files with 192 additions and 11 deletions
@@ -130,6 +130,23 @@ public partial class AudioObject : IBinarySerializable
/// </summary>
public bool RandomType { get; set; }
/// <summary>
/// Volume Step阈值 ms
/// </summary>
public uint VolumeStepThreshold { get; set; }
/// <summary>
/// 起始音量
/// dB
/// </summary>
public int Volume { get; set; }
/// <summary>
/// 音量变化幅度
/// dB
/// </summary>
public int VolumeStep { get; set; }
public void DeSerialize(BinaryReader reader)
{
@@ -166,6 +183,9 @@ public partial class AudioObject : IBinarySerializable
BlendCrossFadeType = (BlendCrossFadeType)reader.ReadByte();
LimitRepetition = reader.ReadByte();
RandomType = reader.ReadBoolean();
VolumeStepThreshold = reader.ReadUInt32();
Volume = reader.ReadInt32();
VolumeStep = reader.ReadInt32();
}
public void Serialize(BinaryWriter writer)
@@ -202,6 +222,9 @@ public partial class AudioObject : IBinarySerializable
writer.Write((byte)BlendCrossFadeType);
writer.Write(LimitRepetition);
writer.Write(RandomType);
writer.Write(VolumeStepThreshold);
writer.Write(Volume);
writer.Write(VolumeStep);
}
}
@@ -66,6 +66,13 @@ public static class AudioObjectDefinitions
{ "Chinese Number 08", 49 },
{ "Chinese Number 09", 49 },
{ "Chinese Number 10", 49 },
{ "Bar", 52 },
{ "Beat", 53 },
{ "Grid", 54 },
{ "NVDice", 55 },
{ "NVHeartbeats", 56 },
{ "au_sfx_notice_level_countDown_edge", 57 },
{ "au_sfx_notice_level_countDown_time", 58 },
{ "sfx_amb_desert", 2000 },
{ "sfx_amb_forest", 2001 },
{ "sfx_anim_common_item_fly", 3000 },