fix: pass config+config_path to WebServerDeps so audio profile persists to disk; add boot-time period/rate override loading from config.yaml
This commit is contained in:
@@ -22,7 +22,7 @@ from typing import Optional
|
||||
import yaml
|
||||
|
||||
# ── Subsystem imports ─────────────────────────────────────────────────────────
|
||||
from src.system.audio import AudioConfig, AudioSystem, JackAudioClient, _jack_is_running
|
||||
from src.system.audio import AudioConfig, AudioSystem, JackAudioClient, LATENCY_PROFILES, _jack_is_running
|
||||
from src.system.defaults import ensure_defaults_exist
|
||||
from src.dsp.pipeline import AudioPipeline
|
||||
from src.dsp.nam_engine_host import FastNAMHost
|
||||
@@ -69,6 +69,7 @@ class PedalApp:
|
||||
|
||||
def __init__(self, config_path: Path = DEFAULT_CONFIG_PATH) -> None:
|
||||
self._config = load_config(config_path)
|
||||
self._config_path = config_path
|
||||
|
||||
# ── Runtime state ──────────────────────────────────────────────
|
||||
self._running = False
|
||||
@@ -116,9 +117,26 @@ class PedalApp:
|
||||
# ── 1. Audio config + system ──────────────────────────
|
||||
acfg = self._config["audio"]
|
||||
audio_mode = acfg.get("mode", "mono")
|
||||
|
||||
# Support custom period/rate overrides saved by the API
|
||||
boot_profile = acfg.get("profile", "standard")
|
||||
custom_period = acfg.get("period")
|
||||
custom_rate = acfg.get("rate")
|
||||
if custom_period is not None or custom_rate is not None:
|
||||
if boot_profile in LATENCY_PROFILES:
|
||||
overridden = dict(LATENCY_PROFILES[boot_profile])
|
||||
else:
|
||||
overridden = dict(LATENCY_PROFILES.get("stable", LATENCY_PROFILES["standard"]))
|
||||
if custom_period is not None:
|
||||
overridden["period"] = custom_period
|
||||
if custom_rate is not None:
|
||||
overridden["rate"] = custom_rate
|
||||
LATENCY_PROFILES[f"{boot_profile}_boot"] = overridden
|
||||
boot_profile = f"{boot_profile}_boot"
|
||||
|
||||
self.audio_config = AudioConfig(
|
||||
hat_type=acfg.get("hat_type", "audioinjector"),
|
||||
profile=acfg.get("profile", "standard"),
|
||||
profile=boot_profile,
|
||||
mode=audio_mode,
|
||||
input_device=acfg.get("input_device", "hw:0,0"),
|
||||
output_device=acfg.get("output_device", "hw:0,0"),
|
||||
@@ -251,6 +269,8 @@ class PedalApp:
|
||||
ir_loader=self.ir_loader,
|
||||
audio_system=self.audio_system,
|
||||
jack_audio=self.jack_audio,
|
||||
config=self._config,
|
||||
config_path=self._config_path,
|
||||
),
|
||||
host="0.0.0.0",
|
||||
port=8080,
|
||||
|
||||
Reference in New Issue
Block a user