diff --git a/include/util.h b/include/util.h index 5840ae0..20f919f 100644 --- a/include/util.h +++ b/include/util.h @@ -19,5 +19,6 @@ char *kind_as_string(char *s, int kind, int n); char *version_as_string(char *s, long v, int n); bool is_comment(char *s); struct quickcommand *command_in_quickcommands(const char *command, const struct quickcommand *quickcommands, int n); +void clear(PT_VMR vmr, bool (*f)(PT_VMR)); #endif /* __UTIL_H__ */ \ No newline at end of file diff --git a/include/wrapper.h b/include/wrapper.h index c764095..6bf63db 100644 --- a/include/wrapper.h +++ b/include/wrapper.h @@ -41,6 +41,4 @@ bool is_mdirty(PT_VMR vmr); long macrobutton_getstatus(PT_VMR vmr, long n, float *val, long mode); long macrobutton_setstatus(PT_VMR vmr, long n, float val, long mode); -void clear(PT_VMR vmr, bool (*f)(PT_VMR)); - #endif /* __WRAPPER_H__ */ \ No newline at end of file diff --git a/src/util.c b/src/util.c index e95ce98..92d0a46 100644 --- a/src/util.c +++ b/src/util.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "wrapper.h" #include "util.h" @@ -104,3 +105,16 @@ struct quickcommand *command_in_quickcommands(const char *command_key, const str } return NULL; } + +/** + * @brief Continuously polls an is_{}dirty function until it clears. + * + * @param vmr Pointer to the iVMR interface + * @param f Pointer to a polling function + */ +void clear(PT_VMR vmr, bool (*f)(PT_VMR)) +{ + Sleep(30); + while (f(vmr)) + Sleep(1); +} \ No newline at end of file diff --git a/src/wrapper.c b/src/wrapper.c index 08fb0b9..a5b70d3 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -156,10 +156,3 @@ long macrobutton_setstatus(PT_VMR vmr, long n, float val, long mode) log_trace("VBVMR_MacroButton_SetStatus(%ld, %d, %ld)", n, (int)val, mode); return vmr->VBVMR_MacroButton_SetStatus(n, val, mode); } - -void clear(PT_VMR vmr, bool (*f)(PT_VMR)) -{ - Sleep(30); - while (f(vmr)) - Sleep(1); -} \ No newline at end of file