Fix last commit
[carla.git] / source / tests.old / carla-uhe-test.py
blob9e998b1777047c070fda329c4fb06f95705eacd2
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
4 # --------------------------------------------------------------------------------------------------------
6 from carla_backend import *
7 from signal import signal, SIGINT, SIGTERM
8 from time import sleep
9 from sys import exit
11 # --------------------------------------------------------------------------------------------------------
13 class CarlaObject(object):
14 __slots__ = [
15 'term'
18 gCarla = CarlaObject()
19 gCarla.term = False
21 def signalHandler(sig, frame):
22 if sig in (SIGINT, SIGTERM):
23 gCarla.term = True
25 # --------------------------------------------------------------------------------------------------------
27 binaryDir = "/home/falktx/Personal/FOSS/GIT/falkTX/Carla/bin"
28 host = CarlaHostDLL("/home/falktx/FOSS/GIT-mine/falkTX/Carla/bin/libcarla_standalone2.so", False)
29 host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, binaryDir)
31 if not host.engine_init("JACK", "Carla-uhe-test"):
32 print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error())
33 exit(1)
35 if not host.add_plugin(BINARY_NATIVE, PLUGIN_VST2, "/home/falktx/.vst/u-he/ACE.64.so", "", "", 0, None, 0):
36 print("Failed to load plugin, possible reasons:\n%s" % host.get_last_error())
37 host.engine_close()
38 exit(1)
40 signal(SIGINT, signalHandler)
41 signal(SIGTERM, signalHandler)
43 while host.is_engine_running() and not gCarla.term:
44 host.engine_idle()
45 sleep(0.5)
47 if not gCarla.term:
48 print("Engine closed abruptely")
50 if not host.engine_close():
51 print("Engine failed to close, possible reasons:\n%s" % host.get_last_error())
52 exit(1)
54 # --------------------------------------------------------------------------------------------------------