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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user