import os
import sys

sys.path.insert(0, "/app")

try:
    import fluidsynth
    print("fluidsynth import successful.")
    
    fl = fluidsynth.Synth()
    # Try to load a pre-existing system SF3
    sf3_path = "/opt/daw_engine/soundfonts/Equinox_Grand_Pianos.sf3"
    print(f"Checking if {sf3_path} exists: {os.path.exists(sf3_path)}")
    if os.path.exists(sf3_path):
        h = fl.sfload(sf3_path)
        print(f"Loaded {sf3_path}, handle: {h}")
    else:
        print("Equinox_Grand_Pianos.sf3 not found.")
except Exception as e:
    print(f"Failed: {e}")
