@@ -110,10 +110,6 @@ typedef unsigned int uint;
110110#endif
111111
112112#include "mod-host.h"
113- #ifdef __MOD_DEVICES__
114- #include "sys_host.h"
115- #include "dsp/gate_core.h"
116- #endif
117113
118114#ifndef HAVE_NEW_LILV
119115#define lilv_free (x ) free(x)
@@ -153,6 +149,7 @@ typedef struct {
153149#define JackPortIsControlVoltage 0x100
154150
155151#if defined(_MOD_DEVICE_DUOX ) || defined(_MOD_DEVICE_DWARF )
152+ #define MOD_HMI_CONTROL_ENABLED
156153#define MOD_IO_PROCESSING_ENABLED
157154#endif
158155
@@ -176,6 +173,14 @@ typedef struct {
176173#include "filter.h"
177174#include "mod-memset.h"
178175
176+ #ifdef MOD_HMI_CONTROL_ENABLED
177+ #include "sys_host.h"
178+ #endif
179+
180+ #ifdef __MOD_DEVICES__
181+ #include "dsp/gate_core.h"
182+ #endif
183+
179184/*
180185************************************************************************************************************************
181186* LOCAL DEFINES
@@ -306,7 +311,7 @@ enum UpdatePositionFlag {
306311************************************************************************************************************************
307312*/
308313
309- #ifdef __MOD_DEVICES__
314+ #ifdef MOD_HMI_CONTROL_ENABLED
310315typedef struct HMI_ADDRESSING_T hmi_addressing_t ;
311316#endif
312317typedef struct PORT_T port_t ;
@@ -346,7 +351,7 @@ typedef struct PORT_T {
346351 LilvScalePoints * scale_points ;
347352 cv_source_t * cv_source ;
348353 pthread_mutex_t cv_source_mutex ;
349- #ifdef __MOD_DEVICES__
354+ #ifdef MOD_HMI_CONTROL_ENABLED
350355 hmi_addressing_t * hmi_addressing ;
351356#endif
352357} port_t ;
@@ -589,11 +594,13 @@ typedef struct ASSIGNMENT_T {
589594 bool supports_set_value ;
590595} assignment_t ;
591596
597+ #ifdef MOD_HMI_CONTROL_ENABLED
592598typedef struct HMI_ADDRESSING_T {
593599 int actuator_id ;
594600 uint8_t page ;
595601 uint8_t subpage ;
596602} hmi_addressing_t ;
603+ #endif
597604
598605typedef struct POSTPONED_PARAMETER_EVENT_T {
599606 int effect_id ;
@@ -852,24 +859,26 @@ static hylia_t* g_hylia_instance;
852859static hylia_time_info_t g_hylia_timeinfo ;
853860#endif
854861
855- #ifdef __MOD_DEVICES__
862+ #ifdef MOD_HMI_CONTROL_ENABLED
856863/* HMI integration */
857864static int g_hmi_shmfd ;
858865static sys_serial_shm_data * g_hmi_data ;
859866static ZixThread g_hmi_client_thread ;
860867static pthread_mutex_t g_hmi_mutex ;
861868static hmi_addressing_t g_hmi_addressings [MAX_HMI_ADDRESSINGS ];
869+ #endif
862870
863871/* internal processing */
872+ #ifdef MOD_HMI_CONTROL_ENABLED
864873static int g_compressor_mode = 0 ;
865874static int g_compressor_release = 100 ;
875+ #endif
866876#ifdef MOD_IO_PROCESSING_ENABLED
867877static int g_noisegate_channel = 0 ;
868878static int g_noisegate_decay = 10 ;
869879static int g_noisegate_threshold = -60 ;
870880static gate_t g_noisegate ;
871881#endif
872- #endif
873882
874883static const char * const g_bypass_port_symbol = BYPASS_PORT_SYMBOL ;
875884static const char * const g_presets_port_symbol = PRESETS_PORT_SYMBOL ;
@@ -892,7 +901,7 @@ static void PortRegistration(jack_port_id_t port_id, int reg, void* data);
892901static int XRun (void * data );
893902static void RunPostPonedEvents (int ignored_effect_id );
894903static void * PostPonedEventsThread (void * arg );
895- #ifdef __MOD_DEVICES__
904+ #ifdef MOD_HMI_CONTROL_ENABLED
896905static void * HMIClientThread (void * arg );
897906#endif
898907static int ProcessPlugin (jack_nframes_t nframes , void * arg );
@@ -915,7 +924,7 @@ static void FreeFeatures(effect_t *effect);
915924static void FreePluginString (void * handle , char * str );
916925static void ConnectToAllHardwareMIDIPorts (void );
917926static void ConnectToMIDIThroughPorts (void );
918- #ifdef __MOD_DEVICES__
927+ #ifdef MOD_HMI_CONTROL_ENABLED
919928static void HMIWidgetsSetLedWithBlink (LV2_HMI_WidgetControl_Handle handle ,
920929 LV2_HMI_Addressing addressing ,
921930 LV2_HMI_LED_Colour led_color ,
@@ -1777,7 +1786,7 @@ static void* PostPonedEventsThread(void* arg)
17771786 UNUSED_PARAM (arg );
17781787}
17791788
1780- #ifdef __MOD_DEVICES__
1789+ #ifdef MOD_HMI_CONTROL_ENABLED
17811790static void * HMIClientThread (void * arg )
17821791{
17831792 sys_serial_shm_data_channel * const data = (sys_serial_shm_data_channel * )arg ;
@@ -3546,7 +3555,7 @@ static void ConnectToMIDIThroughPorts(void)
35463555 }
35473556}
35483557
3549- #ifdef __MOD_DEVICES__
3558+ #ifdef MOD_HMI_CONTROL_ENABLED
35503559static void HMIWidgetsSetLedWithBlink (LV2_HMI_WidgetControl_Handle handle ,
35513560 LV2_HMI_Addressing addressing_ptr ,
35523561 LV2_HMI_LED_Colour led_color ,
@@ -4250,7 +4259,7 @@ int effects_init(void* client)
42504259 pthread_mutex_init (& g_audio_monitor_mutex , & mutex_atts );
42514260 pthread_mutex_init (& g_midi_learning_mutex , & mutex_atts );
42524261 pthread_mutex_init (& g_multi_thread_mutex , & mutex_atts );
4253- #ifdef __MOD_DEVICES__
4262+ #ifdef MOD_HMI_CONTROL_ENABLED
42544263 pthread_mutex_init (& g_hmi_mutex , & mutex_atts );
42554264#endif
42564265
@@ -4602,7 +4611,7 @@ int effects_init(void* client)
46024611 g_options [8 ].type = 0 ;
46034612 g_options [8 ].value = NULL ;
46044613
4605- #ifdef __MOD_DEVICES__
4614+ #ifdef MOD_HMI_CONTROL_ENABLED
46064615 g_hmi_wc .size = sizeof (g_hmi_wc );
46074616 g_hmi_wc .set_led_with_blink = HMIWidgetsSetLedWithBlink ;
46084617 g_hmi_wc .set_led_with_brightness = HMIWidgetsSetLedWithBrightness ;
@@ -4630,10 +4639,10 @@ int effects_init(void* client)
46304639
46314640 for (int i = 0 ; i < MAX_HMI_ADDRESSINGS ; i ++ )
46324641 g_hmi_addressings [i ].actuator_id = -1 ;
4642+ #endif
46334643
46344644#ifdef MOD_IO_PROCESSING_ENABLED
46354645 gate_init (& g_noisegate );
4636- #endif
46374646#endif
46384647
46394648 g_license .handle = NULL ;
@@ -4756,7 +4765,7 @@ int effects_finish(int close_client)
47564765
47574766 effects_remove (REMOVE_ALL );
47584767
4759- #ifdef __MOD_DEVICES__
4768+ #ifdef MOD_HMI_CONTROL_ENABLED
47604769 if (g_hmi_data != NULL )
47614770 {
47624771 sys_serial_shm_data * hmi_data = g_hmi_data ;
@@ -4834,7 +4843,7 @@ int effects_finish(int close_client)
48344843 pthread_mutex_destroy (& g_audio_monitor_mutex );
48354844 pthread_mutex_destroy (& g_midi_learning_mutex );
48364845 pthread_mutex_destroy (& g_multi_thread_mutex );
4837- #ifdef __MOD_DEVICES__
4846+ #ifdef MOD_HMI_CONTROL_ENABLED
48384847 pthread_mutex_destroy (& g_hmi_mutex );
48394848#endif
48404849
@@ -6055,7 +6064,7 @@ static void effects_remove_inner_pre(int effect_id)
60556064 }
60566065#endif
60576066
6058- #ifdef __MOD_DEVICES__
6067+ #ifdef MOD_HMI_CONTROL_ENABLED
60596068 for (int i = 0 ; i < MAX_HMI_ADDRESSINGS ; i ++ )
60606069 g_hmi_addressings [i ].actuator_id = -1 ;
60616070
@@ -6065,10 +6074,10 @@ static void effects_remove_inner_pre(int effect_id)
60656074 sys_serial_write (& g_hmi_data -> server , sys_serial_event_type_special_req , 0 , 0 , "pages" );
60666075 pthread_mutex_unlock (& g_hmi_mutex );
60676076 }
6077+ #endif
60686078
60696079 // this resets volume back 0dB if needed
60706080 // monitor_client_setup_volume(0.0f);
6071- #endif
60726081
60736082 // reset all events
60746083 struct list_head queue , * it , * it2 ;
@@ -6205,7 +6214,7 @@ static void effects_remove_inner_loop(int effect_id)
62056214 {
62066215 if (effect -> ports [i ])
62076216 {
6208- #ifdef __MOD_DEVICES__
6217+ #ifdef MOD_HMI_CONTROL_ENABLED
62096218 if (effect -> ports [i ]-> hmi_addressing != NULL )
62106219 {
62116220 if (g_hmi_data != NULL )
@@ -8391,7 +8400,7 @@ int effects_cv_unmap(int effect_id, const char *control_symbol)
83918400int effects_hmi_map (int effect_id , const char * control_symbol , int hw_id , int page , int subpage ,
83928401 int caps , int flags , const char * label , float minimum , float maximum , int steps )
83938402{
8394- #ifdef __MOD_DEVICES__
8403+ #ifdef MOD_HMI_CONTROL_ENABLED
83958404 if (!InstanceExist (effect_id ))
83968405 return ERR_INSTANCE_NON_EXISTS ;
83978406 if (effect_id >= MAX_PLUGIN_INSTANCES )
@@ -8483,7 +8492,7 @@ int effects_hmi_map(int effect_id, const char *control_symbol, int hw_id, int pa
84838492
84848493int effects_hmi_unmap (int effect_id , const char * control_symbol )
84858494{
8486- #ifdef __MOD_DEVICES__
8495+ #ifdef MOD_HMI_CONTROL_ENABLED
84878496 if (!InstanceExist (effect_id ))
84888497 return ERR_INSTANCE_NON_EXISTS ;
84898498
0 commit comments