namespace OCES.Audio
{
    public partial class MusicContainerConfig
    {
        /// <summary>
        /// 解析拍号字符串（如 "4/4", "3/4"），返回每小节拍数。
        /// </summary>
        public static int GetBeatsPerBar(string timeSig)
        {
            if (string.IsNullOrEmpty(timeSig)) return 4;
            string[] parts = timeSig.Split('/');
            if (parts.Length >= 1 && int.TryParse(parts[0], out int beats))
                return beats;
            return 4;
        }
    }
}
