diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-28 14:32:43 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-01-28 14:32:43 +0100 |
commit | 2087facd3727c52069ad65c5b791f24cba3101a2 (patch) | |
tree | 48f57f68480a08b179276c901d1743dd15aff9dd | |
parent | ad72510965afb6dd2d479890e26945e7d84f7680 (diff) |
Use DG_SYSLOG_HOST and DG_SYSLOG_PORT environment variables to control hugin output.
-rw-r--r-- | vst/drumgizmo_vst.cc | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/vst/drumgizmo_vst.cc b/vst/drumgizmo_vst.cc index c4bd3ab..8c40b2f 100644 --- a/vst/drumgizmo_vst.cc +++ b/vst/drumgizmo_vst.cc @@ -32,6 +32,8 @@ #include <drumgizmo.h> #include <hugin.hpp> +#include <stdlib.h> +#include <string> #define NUM_PROGRAMS 0 #define NUM_PARAMS 0 @@ -90,9 +92,31 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, NUM_PROGRAMS, NUM_PARAMS) { - hug_status_t status = hug_init( - HUG_FLAG_OUTPUT_TO_SYSLOG | HUG_FLAG_USE_MUTEX, HUG_OPTION_SYSLOG_HOST, - "192.168.0.10", HUG_OPTION_SYSLOG_PORT, 514, HUG_OPTION_END); + hug_status_t status = HUG_STATUS_OK; + + int hugin_flags = HUG_FLAG_USE_MUTEX; + + const char* syslog_host_env = getenv("DG_SYSLOG_HOST"); + + if(syslog_host_env) + { + std::string syslog_host = syslog_host_env; + int syslog_port = 514; + const char* syslog_port_env = getenv("DG_SYSLOG_PORT"); + if(syslog_port_env) + { + syslog_port = atoi(syslog_port_env); + } + + status = hug_init(hugin_flags | HUG_FLAG_OUTPUT_TO_SYSLOG, + HUG_OPTION_SYSLOG_HOST, syslog_host.c_str(), + HUG_OPTION_SYSLOG_PORT, syslog_port, + HUG_OPTION_END); + } + else + { + status = hug_init(hugin_flags); + } if(status != HUG_STATUS_OK) { |