@@ -6838,7 +6838,7 @@ int effects_monitor_parameter(int effect_id, const char *control_symbol, const c
68386838 return SUCCESS ;
68396839}
68406840
6841- int effects_monitor_output_parameter (int effect_id , const char * control_symbol_or_uri )
6841+ int effects_monitor_output_parameter (int effect_id , const char * control_symbol_or_uri , int enable )
68426842{
68436843 port_t * port ;
68446844
@@ -6850,6 +6850,42 @@ int effects_monitor_output_parameter(int effect_id, const char *control_symbol_o
68506850
68516851 if (port != NULL )
68526852 {
6853+ if (enable == 0 )
6854+ {
6855+ // check if not monitored
6856+ if ((port -> hints & HINT_MONITORED ) == 0 )
6857+ return SUCCESS ;
6858+
6859+ // remove monitored flag
6860+ port -> hints &= ~HINT_MONITORED ;
6861+
6862+ // stop postpone events thread
6863+ if (g_postevents_running == 1 )
6864+ {
6865+ g_postevents_running = 0 ;
6866+ sem_post (& g_postevents_semaphore );
6867+ pthread_join (g_postevents_thread , NULL );
6868+ }
6869+
6870+ // flush events for all effects except this one
6871+ RunPostPonedEvents (effect_id );
6872+
6873+ // start thread again
6874+ if (g_postevents_running == 0 )
6875+ {
6876+ if (g_verbose_debug )
6877+ {
6878+ puts ("DEBUG: effects_monitor_output_parameter restarted RunPostPonedEvents thread" );
6879+ fflush (stdout );
6880+ }
6881+
6882+ g_postevents_running = 1 ;
6883+ pthread_create (& g_postevents_thread , NULL , PostPonedEventsThread , NULL );
6884+ }
6885+
6886+ return SUCCESS ;
6887+ }
6888+
68536889 // check if already monitored
68546890 if (port -> hints & HINT_MONITORED )
68556891 return SUCCESS ;
@@ -6882,7 +6918,7 @@ int effects_monitor_output_parameter(int effect_id, const char *control_symbol_o
68826918 if (property == NULL )
68836919 return ERR_LV2_INVALID_PARAM_SYMBOL ;
68846920
6885- property -> monitored = true ;
6921+ property -> monitored = enable != 0 ;
68866922 }
68876923
68886924 // activate output monitor
0 commit comments