Shared SizzleDeviceAU base for effects and instruments; sizzle::Instrument voice pools; Android's factory presets generated into the specs header; the app hosts every device in-process (no dependence on the system plugin registry). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 lines
3.1 KiB
Python
Executable File
83 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Generate the FX extension's Info.plist and Components.gen.h from components.txt.
|
|
|
|
usage: gen_components.py <components.txt> <Info.plist out> <Components.gen.h out>
|
|
"""
|
|
import sys
|
|
from xml.sax.saxutils import escape
|
|
|
|
TAGS = {"aufx": "Effects", "aumu": "Synthesizer", "aumi": "MIDI", "aumf": "Effects"}
|
|
|
|
def main(src, plist_out, header_out):
|
|
rows = []
|
|
for line in open(src):
|
|
line = line.split("#", 1)[0].strip()
|
|
if not line:
|
|
continue
|
|
t, sub, toolbox, name = line.split(None, 3)
|
|
assert len(t) == 4 and len(sub) == 4, line
|
|
rows.append((t, sub, toolbox, name))
|
|
|
|
comps = []
|
|
for t, sub, _, name in rows:
|
|
comps.append(f""" <dict>
|
|
<key>description</key><string>Sizzle {escape(name)}</string>
|
|
<key>factoryFunction</key><string>SizzleFXViewController</string>
|
|
<key>manufacturer</key><string>Tsys</string>
|
|
<key>name</key><string>Tired Sysadmin: Sizzle {escape(name)}</string>
|
|
<key>sandboxSafe</key><true/>
|
|
<key>subtype</key><string>{sub}</string>
|
|
<key>tags</key><array><string>{TAGS[t]}</string></array>
|
|
<key>type</key><string>{t}</string>
|
|
<key>version</key><integer>65536</integer>
|
|
</dict>""")
|
|
plist = f"""<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- GENERATED from components.txt by tools/gen_components.py. Do not edit. -->
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>CFBundleDevelopmentRegion</key><string>en</string>
|
|
<key>CFBundleDisplayName</key><string>Sizzle FX</string>
|
|
<key>CFBundleExecutable</key><string>$(EXECUTABLE_NAME)</string>
|
|
<key>CFBundleIdentifier</key><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
|
|
<key>CFBundleName</key><string>$(PRODUCT_NAME)</string>
|
|
<key>CFBundlePackageType</key><string>XPC!</string>
|
|
<key>CFBundleShortVersionString</key><string>$(MARKETING_VERSION)</string>
|
|
<key>CFBundleVersion</key><string>$(CURRENT_PROJECT_VERSION)</string>
|
|
<key>NSExtension</key>
|
|
<dict>
|
|
<key>NSExtensionAttributes</key>
|
|
<dict>
|
|
<key>AudioComponents</key>
|
|
<array>
|
|
{chr(10).join(comps)}
|
|
</array>
|
|
</dict>
|
|
<key>NSExtensionPointIdentifier</key><string>com.apple.AudioUnit-UI</string>
|
|
<key>NSExtensionPrincipalClass</key><string>SizzleFXViewController</string>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
"""
|
|
open(plist_out, "w").write(plist)
|
|
|
|
entries = ",\n".join(f' {{\'{sub}\', \'{t}\', "{toolbox}", "{name}"}}' for t, sub, toolbox, name in rows)
|
|
header = f"""// GENERATED from components.txt by tools/gen_components.py. Do not edit.
|
|
#pragma once
|
|
#include <AudioToolbox/AudioToolbox.h>
|
|
|
|
typedef struct {{ OSType subtype; OSType type; const char *toolboxType; const char *name; }} SizzleComponent;
|
|
|
|
static const SizzleComponent kSizzleComponents[] = {{
|
|
{entries}
|
|
}};
|
|
static const int kSizzleComponentCount = {len(rows)};
|
|
"""
|
|
open(header_out, "w").write(header)
|
|
|
|
if __name__ == "__main__":
|
|
main(*sys.argv[1:4])
|