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.

66 lines
2.0KB

  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/GIT-mine/falkTX/Carla/bin"
  20. host = CarlaHostDLL("/home/falktx/Personal/GIT-mine/falkTX/Carla/bin/libcarla_standalone2.so", True)
  21. host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, binaryDir)
  22. host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, 2, "")
  23. host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, 0, "")
  24. if not host.engine_init("PulseAudio", "Carla-Plugin-JACK"):
  25. print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error())
  26. exit(1)
  27. fname = "pulseaudio --high-priority --realtime --exit-idle-time=-1 --file=/usr/share/cadence/pulse2jack/play.pa -n"
  28. label = ""
  29. fname = "/usr/bin/patchage"
  30. label = ""
  31. fname = "/usr/bin/carla"
  32. label = ""
  33. if not host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, fname, "", label, 0, None, 0):
  34. print("Failed to load plugin, possible reasons:\n%s" % host.get_last_error())
  35. host.engine_close()
  36. exit(1)
  37. signal(SIGINT, signalHandler)
  38. signal(SIGTERM, signalHandler)
  39. while host.is_engine_running() and not gCarla.term:
  40. host.engine_idle()
  41. sleep(0.5)
  42. if not gCarla.term:
  43. print("Engine closed abruptely")
  44. if not host.engine_close():
  45. print("Engine failed to close, possible reasons:\n%s" % host.get_last_error())
  46. exit(1)
  47. # --------------------------------------------------------------------------------------------------------