From 26d9548604e668291636c49d2ebc6980e8769b73 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 15 Sep 2017 22:30:22 +0200 Subject: [PATCH] Update tests --- source/tests/carla-plugin-jack.py | 54 +++++++++++++++++++++++++++++++ source/tests/carla-uhe-test.py | 31 ++++++++++++------ 2 files changed, 76 insertions(+), 9 deletions(-) create mode 100755 source/tests/carla-plugin-jack.py diff --git a/source/tests/carla-plugin-jack.py b/source/tests/carla-plugin-jack.py new file mode 100755 index 000000000..3ffd558cb --- /dev/null +++ b/source/tests/carla-plugin-jack.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# -------------------------------------------------------------------------------------------------------- + +from carla_backend import * +from signal import signal, SIGINT, SIGTERM +from time import sleep +from sys import exit + +# -------------------------------------------------------------------------------------------------------- + +class CarlaObject(object): + __slots__ = [ + 'term' + ] + +gCarla = CarlaObject() +gCarla.term = False + +def signalHandler(sig, frame): + if sig in (SIGINT, SIGTERM): + gCarla.term = True + +# -------------------------------------------------------------------------------------------------------- + +binaryDir = "/home/falktx/Personal/FOSS/GIT/falkTX/Carla/bin" +host = CarlaHostDLL("/home/falktx/FOSS/GIT-mine/falkTX/Carla/bin/libcarla_standalone2.so", True) +host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, binaryDir) + +if not host.engine_init("JACK", "Carla-Plugin-JACK"): + print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error()) + exit(1) + +if not host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, "/usr/bin/lmms", "", "", 0, None, 0): + print("Failed to load plugin, possible reasons:\n%s" % host.get_last_error()) + host.engine_close() + exit(1) + +signal(SIGINT, signalHandler) +signal(SIGTERM, signalHandler) + +while host.is_engine_running() and not gCarla.term: + host.engine_idle() + sleep(0.5) + +if not gCarla.term: + print("Engine closed abruptely") + +if not host.engine_close(): + print("Engine failed to close, possible reasons:\n%s" % host.get_last_error()) + exit(1) + +# -------------------------------------------------------------------------------------------------------- diff --git a/source/tests/carla-uhe-test.py b/source/tests/carla-uhe-test.py index f22cf0d9d..9e998b177 100755 --- a/source/tests/carla-uhe-test.py +++ b/source/tests/carla-uhe-test.py @@ -6,36 +6,49 @@ from carla_backend import * from signal import signal, SIGINT, SIGTERM from time import sleep +from sys import exit # -------------------------------------------------------------------------------------------------------- -global term -term = False +class CarlaObject(object): + __slots__ = [ + 'term' + ] + +gCarla = CarlaObject() +gCarla.term = False + def signalHandler(sig, frame): if sig in (SIGINT, SIGTERM): - global term - term = True + gCarla.term = True # -------------------------------------------------------------------------------------------------------- -host = CarlaHostDLL("/home/falktx/FOSS/GIT-mine/falkTX/Carla/bin/libcarla_standalone2.so") +binaryDir = "/home/falktx/Personal/FOSS/GIT/falkTX/Carla/bin" +host = CarlaHostDLL("/home/falktx/FOSS/GIT-mine/falkTX/Carla/bin/libcarla_standalone2.so", False) +host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, binaryDir) if not host.engine_init("JACK", "Carla-uhe-test"): print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error()) - sys.exit(1) + exit(1) if not host.add_plugin(BINARY_NATIVE, PLUGIN_VST2, "/home/falktx/.vst/u-he/ACE.64.so", "", "", 0, None, 0): print("Failed to load plugin, possible reasons:\n%s" % host.get_last_error()) host.engine_close() - sys.exit(1) + exit(1) signal(SIGINT, signalHandler) signal(SIGTERM, signalHandler) -while host.is_engine_running() and not term: +while host.is_engine_running() and not gCarla.term: host.engine_idle() sleep(0.5) -host.engine_close() +if not gCarla.term: + print("Engine closed abruptely") + +if not host.engine_close(): + print("Engine failed to close, possible reasons:\n%s" % host.get_last_error()) + exit(1) # --------------------------------------------------------------------------------------------------------