mirror of
https://github.com/XmengMD/Minixer.git
synced 2026-12-05 08:00:37 +00:00
- 预设文件不再保存 <Slot bypassed>,加载任意预设时按 shortcuts default bypass 在每槽异步加载完成后应用,空槽与未分配快捷键的槽位均按规则处理,兼容旧预设 - 手动加载单个插件、粘贴、移动槽位保持原有 bypass 逻辑 - 全局旁通:全空时不生效;开启后禁用各槽 bypass 快捷键;点击非空槽 Bypass 按钮解除全局旁通并恢复 default;关闭时恢复 default;最后一个活动槽消失时自动解除 - shortcuts Apply:全局旁通开启时保持全局旁通,关闭时立即对所有已加载槽位应用新的 default bypass - preset version 提升至 3,软件版本号更新为 0.4.2
84 lines
2.5 KiB
C++
84 lines
2.5 KiB
C++
/*
|
|
==============================================================================
|
|
|
|
PluginSlotState.h
|
|
描述单个插件槽位的可持久化状态。
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
|
|
namespace minixer
|
|
{
|
|
|
|
//==============================================================================
|
|
/** 单个插件槽位的持久化状态。
|
|
|
|
用于预设保存/加载与剪贴板:保存插件唯一标识、显示名称以及
|
|
AudioProcessor::getStateInformation() 得到二进制状态。
|
|
bypassed 仅用于运行时状态与剪贴板标记,不写入预设文件。
|
|
*/
|
|
struct PluginSlotState
|
|
{
|
|
/** 插件唯一标识(PluginDescription::createIdentifierString())。 */
|
|
juce::String pluginIdentifier;
|
|
|
|
/** 插件显示名称。 */
|
|
juce::String pluginName;
|
|
|
|
/** 槽位是否被旁通(仅运行时/剪贴板使用,不写入预设 XML)。 */
|
|
bool bypassed = false;
|
|
|
|
/** 插件私有状态(Base64 编码后写入 XML)。 */
|
|
juce::MemoryBlock pluginState;
|
|
|
|
//==============================================================================
|
|
bool isValid() const noexcept { return pluginIdentifier.isNotEmpty(); }
|
|
|
|
void clear()
|
|
{
|
|
pluginIdentifier.clear();
|
|
pluginName.clear();
|
|
bypassed = false;
|
|
pluginState.reset();
|
|
}
|
|
|
|
//==============================================================================
|
|
/** 序列化为 <Slot> XML 元素。调用方负责设置 index 等附加属性。 */
|
|
std::unique_ptr<juce::XmlElement> toXml() const
|
|
{
|
|
auto xml = std::make_unique<juce::XmlElement> ("Slot");
|
|
xml->setAttribute ("identifier", pluginIdentifier);
|
|
xml->setAttribute ("name", pluginName);
|
|
|
|
if (pluginState.getSize() > 0)
|
|
xml->setAttribute ("state", pluginState.toBase64Encoding());
|
|
|
|
return xml;
|
|
}
|
|
|
|
//==============================================================================
|
|
/** 从 <Slot> XML 元素反序列化。 */
|
|
bool fromXml (const juce::XmlElement& xml)
|
|
{
|
|
clear();
|
|
|
|
if (! xml.hasAttribute ("identifier"))
|
|
return false;
|
|
|
|
pluginIdentifier = xml.getStringAttribute ("identifier");
|
|
pluginName = xml.getStringAttribute ("name");
|
|
|
|
auto stateString = xml.getStringAttribute ("state");
|
|
if (stateString.isNotEmpty())
|
|
pluginState.fromBase64Encoding (stateString);
|
|
|
|
return isValid();
|
|
}
|
|
};
|
|
|
|
} // namespace minixer
|