feat: SyncPoint.SameAsCurrentSegment music transition

- Add SameAsCurrentSegment mode to align new container's timeSamples with the old container's playback position, accounting for FadeInOffset
- Fix BeatClock callback burst when Restart is called with a past dspTime
- Add GetFirstLeafSource() for resolving playback position across nested containers
- Manual BeatClock.Restart replaces OnContainerEntered subscription for accurate timing with SyncPoint
This commit is contained in:
2026-04-16 20:50:34 +08:00
parent e2c9c53aa3
commit 2b34d0bf94
13 changed files with 182 additions and 44 deletions
@@ -411,5 +411,20 @@ namespace OCES.Audio
foreach (ContainerPlayHandle child in this.ChildHandles)
child.CollectActiveSources(result);
}
/// <summary>
/// 获取第一个正在播放的 Leaf Segment 的 AudioSource。
/// 递归遍历子句柄,优先取当前层级的 ActiveSources,找不到再深入子层级。
/// </summary>
internal AudioSource GetFirstLeafSource()
{
if (this.ActiveSources.Count > 0) return this.ActiveSources[0];
foreach (ContainerPlayHandle child in this.ChildHandles)
{
AudioSource src = child.GetFirstLeafSource();
if (src) return src;
}
return null;
}
}
}