@@ -63,6 +63,31 @@ public enum channel_format_t : byte
6363 cf_undefined = 0 // Can not be transmitted.
6464 } ;
6565
66+ /**
67+ * Post-processing options for stream inlets.
68+ */
69+ public enum processing_options_t : byte
70+ {
71+ proc_none = 0 , // No automatic post-processing; return the ground-truth time stamps for manual
72+ // post-processing. This is the default behavior of the inlet.
73+
74+ proc_clocksync = 1 , // Perform automatic clock synchronization; equivalent to manually adding
75+ // the time_correction() value to the received time stamps.
76+
77+ proc_dejitter = 2 , // Remove jitter from time stamps.
78+ // This will apply a smoothing algorithm to the received time stamps;
79+ // the smoothing needs to see a minimum number of samples (30-120 seconds worst-case)
80+ // until the remaining jitter is consistently below 1ms.
81+
82+ proc_monotonize = 4 , // Force the time-stamps to be monotonically ascending.
83+ // Only makes sense if timestamps are dejittered.
84+
85+ proc_threadsafe = 8 , // Post-processing is thread-safe (same inlet can be read from by multiple threads);
86+ // uses somewhat more CPU.
87+
88+ proc_ALL = 1 | 2 | 4 | 8 // The combination of all possible post-processing options.
89+ } ;
90+
6691 /**
6792 * Protocol version.
6893 * The major version is protocol_version() / 100;
@@ -475,7 +500,10 @@ If left unspecified (=0), the sender determines the chunk granularity.
475500 * In all other cases (recover is false or the stream is not recoverable) functions may throw a
476501 * LostException if the stream's source is lost (e.g., due to an app or computer crash).
477502 */
478- public StreamInlet ( StreamInfo info , int max_buflen = 360 , int max_chunklen = 0 , bool recover = true ) { obj = dll . lsl_create_inlet ( info . handle ( ) , max_buflen , max_chunklen , recover ? 1 : 0 ) ; }
503+ public StreamInlet ( StreamInfo info , int max_buflen = 360 , int max_chunklen = 0 , bool recover = true , processing_options_t postproc_flags = processing_options_t . proc_none ) {
504+ obj = dll . lsl_create_inlet ( info . handle ( ) , max_buflen , max_chunklen , recover ? 1 : 0 ) ;
505+ dll . lsl_set_postprocessing ( obj , postproc_flags ) ;
506+ }
479507
480508 /**
481509 * Destructor.
@@ -1026,6 +1054,9 @@ class dll
10261054 [ DllImport ( libname , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Ansi , ExactSpelling = true ) ]
10271055 public static extern double lsl_time_correction ( IntPtr obj , double timeout , ref int ec ) ;
10281056
1057+ [ DllImport ( libname , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Ansi , ExactSpelling = true ) ]
1058+ public static extern int lsl_set_postprocessing ( IntPtr obj , processing_options_t flags ) ;
1059+
10291060 [ DllImport ( libname , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Ansi , ExactSpelling = true ) ]
10301061 public static extern double lsl_pull_sample_f ( IntPtr obj , float [ ] buffer , int buffer_elements , double timeout , ref int ec ) ;
10311062
0 commit comments