|
|
@@ -25,20 +25,28 @@ def turtle_string(value):
|
|
|
def plugin_state_files(processor, plugin_path):
|
|
|
instance = processor["instance"]
|
|
|
plugin_uri = processor["plugin_uri"]
|
|
|
- file_property = processor["file_property"]
|
|
|
state_dir = f"effect-{instance}"
|
|
|
- effect_ttl = (
|
|
|
- "@prefix atom: <http://lv2plug.in/ns/ext/atom#> .\n"
|
|
|
- "@prefix lv2: <http://lv2plug.in/ns/lv2core#> .\n"
|
|
|
- "@prefix pset: <http://lv2plug.in/ns/ext/presets#> .\n"
|
|
|
- "@prefix state: <http://lv2plug.in/ns/ext/state#> .\n\n"
|
|
|
- "<>\n"
|
|
|
- " a pset:Preset ;\n"
|
|
|
- f" lv2:appliesTo <{plugin_uri}> ;\n"
|
|
|
- " state:state [\n"
|
|
|
- f" <{file_property}> {turtle_string(plugin_path)}^^atom:Path\n"
|
|
|
- " ] .\n"
|
|
|
- )
|
|
|
+ if processor.get("file_property"):
|
|
|
+ effect_ttl = (
|
|
|
+ "@prefix atom: <http://lv2plug.in/ns/ext/atom#> .\n"
|
|
|
+ "@prefix lv2: <http://lv2plug.in/ns/lv2core#> .\n"
|
|
|
+ "@prefix pset: <http://lv2plug.in/ns/ext/presets#> .\n"
|
|
|
+ "@prefix state: <http://lv2plug.in/ns/ext/state#> .\n\n"
|
|
|
+ "<>\n"
|
|
|
+ " a pset:Preset ;\n"
|
|
|
+ f" lv2:appliesTo <{plugin_uri}> ;\n"
|
|
|
+ " state:state [\n"
|
|
|
+ f" <{processor['file_property']}> {turtle_string(plugin_path)}^^atom:Path\n"
|
|
|
+ " ] .\n"
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ effect_ttl = (
|
|
|
+ "@prefix lv2: <http://lv2plug.in/ns/lv2core#> .\n"
|
|
|
+ "@prefix pset: <http://lv2plug.in/ns/ext/presets#> .\n\n"
|
|
|
+ "<>\n"
|
|
|
+ " a pset:Preset ;\n"
|
|
|
+ f" lv2:appliesTo <{plugin_uri}> .\n"
|
|
|
+ )
|
|
|
manifest_ttl = (
|
|
|
"@prefix lv2: <http://lv2plug.in/ns/lv2core#> .\n"
|
|
|
"@prefix pset: <http://lv2plug.in/ns/ext/presets#> .\n"
|
|
|
@@ -72,12 +80,17 @@ def generate_bundle_files(state, repo_root=ROOT, asset_root=None, nam_model_path
|
|
|
asset_root = Path(asset_root or repo_root / "artifacts" / "mod-ui" / "arm64" / "current" / "app" / "default.pedalboard")
|
|
|
routing = state["routing"]["mod_host_chains"]["guitar"]
|
|
|
nam, ir = routing["processors"]
|
|
|
+ voice_chain = state["routing"]["mod_host_chains"]["voice"]
|
|
|
+ voice_processors = voice_chain["processors"]
|
|
|
nam_source_path = resolved_asset(repo_root, nam["asset_path"])
|
|
|
nam_path = Path(nam_model_path).resolve() if nam_model_path else nam_source_path
|
|
|
if not nam_path.is_file():
|
|
|
raise FileNotFoundError(f"NAM model file is missing: {nam_path}")
|
|
|
ir_path = resolved_asset(repo_root, ir["asset_path"])
|
|
|
output_level = nam["parameters"]["output_level"]
|
|
|
+ plugin_files = {}
|
|
|
+ for processor in voice_processors:
|
|
|
+ plugin_files.update(plugin_state_files(processor, ""))
|
|
|
|
|
|
nam_instance = nam["mod_ui_instance"].removeprefix("/graph/")
|
|
|
ir_instance = ir["mod_ui_instance"].removeprefix("/graph/")
|
|
|
@@ -93,7 +106,7 @@ def generate_bundle_files(state, repo_root=ROOT, asset_root=None, nam_model_path
|
|
|
passthrough_channels = [
|
|
|
(index, source_labels[source_id])
|
|
|
for index, source_id in enumerate(("guitar", "bass", "voice", "synth"), start=1)
|
|
|
- if source_id != "guitar" and source_id in source_ids
|
|
|
+ if source_id not in ("guitar", "voice") and source_id in source_ids
|
|
|
]
|
|
|
additional_ports_ttl = "\n\n".join(
|
|
|
f'''<capture_{index}>
|
|
|
@@ -111,19 +124,137 @@ def generate_bundle_files(state, repo_root=ROOT, asset_root=None, nam_model_path
|
|
|
a lv2:AudioPort, lv2:OutputPort .'''
|
|
|
for index, label in passthrough_channels
|
|
|
)
|
|
|
- additional_ports_list = ",\n ".join(
|
|
|
- f"<{symbol}_{index}>"
|
|
|
- for index, _label in passthrough_channels
|
|
|
- for symbol in ("capture", "playback")
|
|
|
- )
|
|
|
additional_arcs_list = ", ".join(
|
|
|
- f"_:b{index + 2}" for index, _label in passthrough_channels
|
|
|
+ [f"_:b{index + 2}" for index, _label in passthrough_channels]
|
|
|
+ + [f"_:voice{index}" for index in range(1, len(voice_processors))]
|
|
|
+ + ["_:voice0", "_:voice_out"]
|
|
|
)
|
|
|
additional_arcs_ttl = "\n\n".join(
|
|
|
f"_:b{index + 2} ingen:tail <capture_{index}> ;\n"
|
|
|
f" ingen:head <playback_{index}> ."
|
|
|
for index, _label in passthrough_channels
|
|
|
)
|
|
|
+ additional_ports_list = ",\n ".join(
|
|
|
+ f"<{symbol}_{index}>"
|
|
|
+ for index, _label in passthrough_channels
|
|
|
+ for symbol in ("capture", "playback")
|
|
|
+ )
|
|
|
+ voice_processors_ttl = []
|
|
|
+ voice_processor_blocks = []
|
|
|
+ voice_processor_arcs = []
|
|
|
+ for index, processor in enumerate(voice_processors):
|
|
|
+ instance = processor["mod_ui_instance"].removeprefix("/graph/")
|
|
|
+ plugin_uri = processor["plugin_uri"]
|
|
|
+ if processor["id"] == "voice-reverb":
|
|
|
+ plugin_uri = "urn:dragonfly:room"
|
|
|
+ input_symbol = "input_l" if processor["id"] == "voice-reverb" else "in"
|
|
|
+ output_symbol = "output_l" if processor["id"] == "voice-reverb" else "out"
|
|
|
+ label = {
|
|
|
+ "voice-high-pass": "Coupe-bas",
|
|
|
+ "voice-compressor": "Compresseur voix",
|
|
|
+ "voice-de-esser": "De-esser",
|
|
|
+ "voice-reverb": "Réverbération voix",
|
|
|
+ }[processor["id"]]
|
|
|
+ x_position = 160.0 + index * 260.0
|
|
|
+ port_symbols = {
|
|
|
+ "voice-high-pass": ("in", "out", {"mode": "mode", "filter_type": "ft", "filter_mode": "fm", "slope": "s", "frequency_hz": "f", "quality": "q"}),
|
|
|
+ "voice-compressor": ("in", "out", {"compression_mode": "cm", "ratio": "cr", "attack_time_ms": "at", "release_time_ms": "rt"}),
|
|
|
+ "voice-de-esser": ("in", "out", {}),
|
|
|
+ "voice-reverb": ("input_l", "output_l", {"dry_level": "dry_level", "early_level": "early_level", "late_level": "late_level", "size": "size", "predelay_ms": "predelay", "decay_seconds": "decay", "in_low_cut_hz": "in_low_cut", "in_high_cut_hz": "in_high_cut"}),
|
|
|
+ }
|
|
|
+ input_symbol, output_symbol, control_symbols = port_symbols[processor["id"]]
|
|
|
+ port_declarations = [
|
|
|
+ f"<{instance}/{input_symbol}>",
|
|
|
+ f"<{instance}/{output_symbol}>",
|
|
|
+ f"<{instance}/:bypass>",
|
|
|
+ ]
|
|
|
+ control_declarations = []
|
|
|
+ for parameter in processor.get("parameters", {}):
|
|
|
+ if processor["id"] == "voice-de-esser":
|
|
|
+ continue
|
|
|
+ symbol = control_symbols[parameter]
|
|
|
+ port_declarations.append(f"<{instance}/{symbol}>")
|
|
|
+ value = processor["parameters"][parameter]
|
|
|
+ if processor["id"] == "voice-high-pass":
|
|
|
+ value = {
|
|
|
+ "mode": 0,
|
|
|
+ "filter_type": 1,
|
|
|
+ "filter_mode": 2,
|
|
|
+ "slope": 1,
|
|
|
+ "frequency_hz": 90.0,
|
|
|
+ "quality": 0.707,
|
|
|
+ }[parameter]
|
|
|
+ elif processor["id"] == "voice-compressor":
|
|
|
+ value = {
|
|
|
+ "compression_mode": 0,
|
|
|
+ "ratio": 3.0,
|
|
|
+ "attack_time_ms": 10.0,
|
|
|
+ "release_time_ms": 120.0,
|
|
|
+ }[parameter]
|
|
|
+ rendered_value = json.dumps(value) if isinstance(value, str) else str(value)
|
|
|
+ control_declarations.append(
|
|
|
+ f"<{instance}/{symbol}>\n"
|
|
|
+ f" ingen:value {rendered_value} ;\n"
|
|
|
+ " a lv2:ControlPort, lv2:InputPort ."
|
|
|
+ )
|
|
|
+ if processor["id"] == "voice-de-esser":
|
|
|
+ values = {
|
|
|
+ "Ratio": 2.0,
|
|
|
+ "Threshold": 0.1,
|
|
|
+ "Attack": 5.0,
|
|
|
+ "Release": 80.0,
|
|
|
+ "Split": 6000.0,
|
|
|
+ }
|
|
|
+ for symbol, value in values.items():
|
|
|
+ port_declarations.append(f"<{instance}/{symbol}>")
|
|
|
+ control_declarations.append(
|
|
|
+ f"<{instance}/{symbol}>\n"
|
|
|
+ f" ingen:value {value} ;\n"
|
|
|
+ " a lv2:ControlPort, lv2:InputPort ."
|
|
|
+ )
|
|
|
+ voice_processors_ttl.append(
|
|
|
+ f"""<{instance}>
|
|
|
+ ingen:canvasX {x_position} ;
|
|
|
+ ingen:canvasY 650.0 ;
|
|
|
+ ingen:enabled true ;
|
|
|
+ ingen:polyphonic false ;
|
|
|
+ pedal:instanceLabel "{label}" ;
|
|
|
+ pedal:instanceNumber {processor["instance"]} ;
|
|
|
+ pedal:performanceVisible true ;
|
|
|
+ pedal:performanceIndex {index + 2} ;
|
|
|
+ lv2:prototype <{plugin_uri}> ;
|
|
|
+ lv2:port {", ".join(port_declarations)} ;
|
|
|
+ a ingen:Block .
|
|
|
+
|
|
|
+<{instance}/{input_symbol}>
|
|
|
+ a lv2:AudioPort, lv2:InputPort .
|
|
|
+
|
|
|
+<{instance}/{output_symbol}>
|
|
|
+ a lv2:AudioPort, lv2:OutputPort .
|
|
|
+
|
|
|
+<{instance}/:bypass>
|
|
|
+ ingen:value 0 ;
|
|
|
+ a lv2:ControlPort, lv2:InputPort ."""
|
|
|
+ )
|
|
|
+ voice_processors_ttl[-1] += "\n\n" + "\n\n".join(control_declarations)
|
|
|
+ if index > 0:
|
|
|
+ previous = voice_processors[index - 1]
|
|
|
+ previous_instance = previous["mod_ui_instance"].removeprefix("/graph/")
|
|
|
+ previous_output = (
|
|
|
+ "output_l" if previous["id"] == "voice-reverb" else "out"
|
|
|
+ )
|
|
|
+ voice_processor_arcs.append(
|
|
|
+ f"_:voice{index} ingen:tail <{previous_instance}/{previous_output}> ;\n"
|
|
|
+ f" ingen:head <{instance}/{input_symbol}> ."
|
|
|
+ )
|
|
|
+ voice_chain_ttl = "\n\n".join(voice_processors_ttl)
|
|
|
+ voice_chain_arcs_ttl = "\n\n".join(voice_processor_arcs)
|
|
|
+ first_voice = voice_processors[0]
|
|
|
+ last_voice = voice_processors[-1]
|
|
|
+ first_voice_instance = first_voice["mod_ui_instance"].removeprefix("/graph/")
|
|
|
+ last_voice_instance = last_voice["mod_ui_instance"].removeprefix("/graph/")
|
|
|
+ first_voice_input = "in"
|
|
|
+ last_voice_output = "output_l" if last_voice["id"] == "voice-reverb" else "out"
|
|
|
|
|
|
ttl = f"""\
|
|
|
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
|
|
|
@@ -154,6 +285,8 @@ def generate_bundle_files(state, repo_root=ROOT, asset_root=None, nam_model_path
|
|
|
|
|
|
{additional_ports_ttl}
|
|
|
|
|
|
+{voice_chain_ttl}
|
|
|
+
|
|
|
<:bpb>
|
|
|
ingen:value 4.0 ;
|
|
|
lv2:index 0 ;
|
|
|
@@ -319,7 +452,7 @@ def generate_bundle_files(state, repo_root=ROOT, asset_root=None, nam_model_path
|
|
|
pedal:version 1 ;
|
|
|
ingen:polyphony 1 ;
|
|
|
ingen:arc _:b1, _:b2, _:b3, {additional_arcs_list} ;
|
|
|
- ingen:block <{nam_instance}>, <{ir_instance}> ;
|
|
|
+ ingen:block <{nam_instance}>, <{ir_instance}>, {", ".join(f"<{processor['mod_ui_instance'].removeprefix('/graph/')}>" for processor in voice_processors)} ;
|
|
|
lv2:port <:bpb>, <:bpm>, <:rolling>,
|
|
|
<control_in>, <control_out>,
|
|
|
<capture_1>, <playback_1>,
|
|
|
@@ -337,6 +470,14 @@ _:b2 ingen:tail <{nam_instance}/output> ;
|
|
|
_:b3 ingen:tail <{ir_instance}/out> ;
|
|
|
ingen:head <playback_1> .
|
|
|
|
|
|
+_:voice0 ingen:tail <capture_3> ;
|
|
|
+ ingen:head <{first_voice_instance}/{first_voice_input}> .
|
|
|
+
|
|
|
+{voice_chain_arcs_ttl}
|
|
|
+
|
|
|
+_:voice_out ingen:tail <{last_voice_instance}/{last_voice_output}> ;
|
|
|
+ ingen:head <playback_3> .
|
|
|
+
|
|
|
{additional_arcs_ttl}
|
|
|
"""
|
|
|
|
|
|
@@ -357,6 +498,7 @@ _:b3 ingen:tail <{ir_instance}/out> ;
|
|
|
}
|
|
|
files.update(plugin_state_files(nam, nam_path))
|
|
|
files.update(plugin_state_files(ir, ir_path))
|
|
|
+ files.update(plugin_files)
|
|
|
for image_name in ("screenshot.png", "thumbnail.png"):
|
|
|
image = asset_root / image_name
|
|
|
if not image.is_file():
|