Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.8KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # --------------------------------------------------------------------------------------------------------
  4. from carla_backend import *
  5. from signal import signal, SIGINT, SIGTERM
  6. from time import sleep
  7. from sys import exit
  8. # --------------------------------------------------------------------------------------------------------
  9. class CarlaObject(object):
  10. __slots__ = [
  11. 'term'
  12. ]
  13. gCarla = CarlaObject()
  14. gCarla.term = False
  15. def signalHandler(sig, frame):
  16. if sig in (SIGINT, SIGTERM):
  17. gCarla.term = True
  18. # --------------------------------------------------------------------------------------------------------
  19. binaryDir = "/home/falktx/Personal/FOSS/GIT/falkTX/Carla/bin"
  20. host = CarlaHostDLL("/home/falktx/FOSS/GIT-mine/falkTX/Carla/bin/libcarla_standalone2.so", True)
  21. host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, binaryDir)
  22. if not host.engine_init("JACK", "Carla-Plugin-JACK"):
  23. print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error())
  24. exit(1)
  25. fname = "/usr/bin/pulseaudio"
  26. label = "--high-priority --realtime --exit-idle-time=-1 --file=/usr/share/cadence/pulse2jack/play.pa -n"
  27. if not host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, fname, "", label, 0, None, 0):
  28. print("Failed to load plugin, possible reasons:\n%s" % host.get_last_error())
  29. host.engine_close()
  30. exit(1)
  31. signal(SIGINT, signalHandler)
  32. signal(SIGTERM, signalHandler)
  33. while host.is_engine_running() and not gCarla.term:
  34. host.engine_idle()
  35. sleep(0.5)
  36. if not gCarla.term:
  37. print("Engine closed abruptely")
  38. if not host.engine_close():
  39. print("Engine failed to close, possible reasons:\n%s" % host.get_last_error())
  40. exit(1)
  41. # --------------------------------------------------------------------------------------------------------