From 1d1438b6211728227a26615013587a7716ac8438 Mon Sep 17 00:00:00 2001 From: tachengP <2638591622@qq.com> Date: Fri, 19 Jun 2026 18:37:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=85=8D=E5=90=88DiffSinger=20for=20TuneLa?= =?UTF-8?q?b=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RepositoryTuneLab checkout effect | 20 + TuneLab.SDK/ControllerConfigs/ButtonConfig.cs | 21 + TuneLab.SDK/Voice/IPartPropertyContext.cs | 3 + .../Controllers/PropertyObjectController.cs | 51 + .../PropertySideBarContentProvider.cs | 15 +- .../DiffSingerParamExtract.csproj | 60 + .../DiffSingerParamExtractSession.cs | 1647 +++++++++++++++++ .../DiffSingerParamVoiceEngine.cs | 295 +++ .../DiffSingerParamExtract/DiffSingerUtils.cs | 216 +++ .../DiffSingerParamExtract/DsConfig.cs | 104 ++ .../DiffSingerParamExtract/DsModelSession.cs | 986 ++++++++++ .../DiffSingerParamExtract/G2pDictionary.cs | 267 +++ .../DiffSingerParamExtract/VarianceMapping.cs | 100 + .../DiffSingerParamExtract/description.json | 10 + tests/tmpverify/verify.cs | 9 + tests/tmpverify/verify.csproj | 7 + 16 files changed, 3809 insertions(+), 2 deletions(-) create mode 100644 RepositoryTuneLab checkout effect create mode 100644 TuneLab.SDK/ControllerConfigs/ButtonConfig.cs create mode 100644 tests/plugins/DiffSingerParamExtract/DiffSingerParamExtract.csproj create mode 100644 tests/plugins/DiffSingerParamExtract/DiffSingerParamExtractSession.cs create mode 100644 tests/plugins/DiffSingerParamExtract/DiffSingerParamVoiceEngine.cs create mode 100644 tests/plugins/DiffSingerParamExtract/DiffSingerUtils.cs create mode 100644 tests/plugins/DiffSingerParamExtract/DsConfig.cs create mode 100644 tests/plugins/DiffSingerParamExtract/DsModelSession.cs create mode 100644 tests/plugins/DiffSingerParamExtract/G2pDictionary.cs create mode 100644 tests/plugins/DiffSingerParamExtract/VarianceMapping.cs create mode 100644 tests/plugins/DiffSingerParamExtract/description.json create mode 100644 tests/tmpverify/verify.cs create mode 100644 tests/tmpverify/verify.csproj diff --git a/RepositoryTuneLab checkout effect b/RepositoryTuneLab checkout effect new file mode 100644 index 00000000..444e6994 --- /dev/null +++ b/RepositoryTuneLab checkout effect @@ -0,0 +1,20 @@ +f2c6b51 (HEAD -> feature/agent, origin/release/2.0.0, origin/feature/agent, release/2.0.0) Merge branch 'feature/agent' into release/2.0.0 +23ce42a refactor: 收紧 agent 工具描述——pitch line 与 vibrato 加性叠加、勿断开音高线 +2bbf396 feat: agent 对话分步可见 + 流式实时 Markdown + 取消回复气泡 +f8e55db feat: agent 加 add_vibrato 工具(创建真正的 Vibrato 对象) +8a72108 Revert "refactor: effect 收口改订 effect.Modified,退掉 SynthesisBatch band-aid" +f7823b9 fix: OpenAI 兼容流式 tool_call 被后续空 id/name 帧覆盖而丢失 +c343b21 feat: agent 工具集三层扩充(只读 / 业务写 / 批量 DSL) +1b4b209 fix: Agent 报错/停止文案可复制——提示行改用 SelectableTextBlock +e64f983 feat: Agent 换模型保上下文 + 连接模型提示 + 标题加固 + 报错保留已输出 +0644c43 refactor: effect 收口改订 effect.Modified,退掉 SynthesisBatch band-aid +2d5b708 refactor: ITiming 死契约从 TuneLab.SDK 下沉到宿主 TuneLab.Data.Timing +08e3a84 docs: 订正 plugin-development 的 voice/effect 章节到当前 SDK 模型 +74cda39 feat: effect 收敛阶段三——回显富类型换形 + effect 回显端到端 +6962336 fix: Agent 短回复时 token 数与 Copy 挤在一起——token 文本加右边距 +3576611 refactor: Agent 设置页 provider 选择复用属性面板样式 + 改名 Model Provider +909ced3 feat: Agent 撞工具回合上限时强制收尾——再请求一次不带工具让模型总结 +65cbdad fix: DataObject merge 通知上行——中间态不漏成祖先 settled、收口沿父链补发 +9a7b359 feat: effect 收敛阶段二——厚 IEffectProcessor/每段一个 + 反应式 EffectGraph +e4e922d feat: Agent 会话菜单 UI 完善——✕ 对齐 + 全名 tooltip + 原生观感 +f4e9907 feat: 原子写文件工具 SaveFile(仿 QSaveFile)+ 应用到 agent 写入点 diff --git a/TuneLab.SDK/ControllerConfigs/ButtonConfig.cs b/TuneLab.SDK/ControllerConfigs/ButtonConfig.cs new file mode 100644 index 00000000..57e2ab57 --- /dev/null +++ b/TuneLab.SDK/ControllerConfigs/ButtonConfig.cs @@ -0,0 +1,21 @@ +using System; + +namespace TuneLab.SDK; + +// 按钮控件配置:在属性面板中渲染一个可点击的按钮。 +// 与值控件不同,ButtonConfig 不绑定数据,而是通过 Action 回调触发行为。 +// 由宿主侧 PropertyObjectController 的 ButtonCreator 渲染为 GUI Components.Button。 +public sealed class ButtonConfig : IControllerConfig +{ + /// 按钮显示文本(经 L.Tr 翻译)。 + public required string DisplayText { get; init; } + + /// 点击时的回调(在 UI 线程触发)。 + public required Action? Action { get; init; } + + /// 按钮激活状态(true=可点击;false=灰显禁用)。 + public bool IsEnabled { get; init; } = true; + + /// 按钮提示文字(鼠标悬停时显示)。 + public string? Tooltip { get; init; } +} diff --git a/TuneLab.SDK/Voice/IPartPropertyContext.cs b/TuneLab.SDK/Voice/IPartPropertyContext.cs index fe083b33..cf7174d5 100644 --- a/TuneLab.SDK/Voice/IPartPropertyContext.cs +++ b/TuneLab.SDK/Voice/IPartPropertyContext.cs @@ -24,4 +24,7 @@ public interface IPartPropertyContext public interface INotePropertyContext : IPartPropertyContext { PropertyObject NoteProperties { get; } + // 当前选中音符的时间范围(用于区段式操作,NaN 表示无选中) + double SelectionStartTime { get; } + double SelectionEndTime { get; } } diff --git a/TuneLab/GUI/Controllers/PropertyObjectController.cs b/TuneLab/GUI/Controllers/PropertyObjectController.cs index e1a49927..814484fb 100644 --- a/TuneLab/GUI/Controllers/PropertyObjectController.cs +++ b/TuneLab/GUI/Controllers/PropertyObjectController.cs @@ -370,6 +370,56 @@ public override void Dispose() readonly Components.CheckBox mController; } + // 按钮控件:渲染为可点击的按钮,触发 ButtonConfig.Action(在 UI 线程)。不绑定数据。 + class ButtonCreator : Creator + { + public ButtonCreator(PropertyObjectController parent, string key, ButtonConfig config) : base(parent) + { + var text = config.DisplayText ?? key; + + mButton = ObjectPoolManager.Get(); + mButton.Height = 32; + mButton.Margin = new(24, 8, 24, 8); + mButton.AddContent(new() + { + Item = new BorderItem() { CornerRadius = 4 }, + ColorSet = new() { Color = Style.BUTTON_NORMAL, HoveredColor = Style.BUTTON_NORMAL_HOVER, PressedColor = Style.INTERFACE }, + }); + mButton.AddContent(new() + { + Item = new TextItem() { Text = text, FontSize = 13 }, + ColorSet = new() { Color = Style.WHITE }, + }); + + mAction = config.Action; + mButton.Clicked += OnClicked; + } + + void OnClicked() + { + mAction?.Invoke(); + } + + public override Type ConfigType => typeof(ButtonConfig); + public override IEnumerable Views => [mButton]; + + public override void Update(IControllerConfig config) + { + var btn = (ButtonConfig)config; + mAction = btn.Action; + } + + public override void Dispose() + { + base.Dispose(); + mButton.Clicked -= OnClicked; + ObjectPoolManager.Return(mButton); + } + + readonly Components.Button mButton; + Action? mAction; + } + static Label CreateTitle(string title, double height) { var label = ObjectPoolManager.Get