diff --git a/data/locale/en-GB.ini b/data/locale/en-GB.ini index a50ea70..af40e99 100644 --- a/data/locale/en-GB.ini +++ b/data/locale/en-GB.ini @@ -13,10 +13,4 @@ Window.Priority.Exe="Match title, otherwise find window of same executable" Hotkey.Start="Capture foreground window" Hotkey.Stop="Deactivate capture" -ExcludeProcessTree="Capture all audio EXCEPT the selected window" - -RecaptureRate="Recapture Rate" -RecaptureRate.Slow="Slow" -RecaptureRate.Normal="Normal (recommended)" -RecaptureRate.Fast="Fast" -RecaptureRate.Fastest="Fastest" \ No newline at end of file +ExcludeProcessTree="Capture all audio EXCEPT the selected window" \ No newline at end of file diff --git a/src/audio-capture.cpp b/src/audio-capture.cpp index 9741887..c293bb0 100644 --- a/src/audio-capture.cpp +++ b/src/audio-capture.cpp @@ -27,24 +27,18 @@ VOID CALLBACK set_update(PVOID lpParam, BOOLEAN TimerOrWaitFired) SetEvent(ctx->events[EVENT_UPDATE]); } -void set_update_timer(audio_capture_context_t *ctx, float interval) +void set_update_timer(audio_capture_context_t *ctx) { EnterCriticalSection(&ctx->timer_section); - EnterCriticalSection(&ctx->config_section); - DWORD time_millis = - (DWORD)(ctx->config.retry_interval * interval * 1000.0); - LeaveCriticalSection(&ctx->config_section); - if (ctx->timer != NULL) { DeleteTimerQueueTimer(ctx->timer_queue, ctx->timer, INVALID_HANDLE_VALUE); ctx->timer = NULL; } - // debug("setting timer for %ld millis", time_millis); CreateTimerQueueTimer(&ctx->timer, ctx->timer_queue, set_update, ctx, - time_millis, 0, WT_EXECUTEINTIMERTHREAD); + 2000, 0, WT_EXECUTEINTIMERTHREAD); LeaveCriticalSection(&ctx->timer_section); } @@ -106,7 +100,7 @@ static void audio_capture_worker_recapture(audio_capture_context_t *ctx) if (ctx->process_id != 0) start_capture(ctx); else if (ctx->window_selected) - set_update_timer(ctx, RECAPTURE_INTERVAL_DEFAULT); + set_update_timer(ctx); } static void audio_capture_worker_update(audio_capture_context_t *ctx) @@ -254,9 +248,6 @@ static void audio_capture_update(void *data, obs_data_t *settings) settings, SETTING_WINDOW_PRIORITY), .exclude_process_tree = obs_data_get_bool( settings, SETTING_EXCLUDE_PROCESS_TREE), - .retry_interval = recapture_rate_to_float( - (recapture_rate)obs_data_get_int( - settings, SETTING_RECAPTURE_RATE)), }; const char *window = obs_data_get_string(settings, SETTING_WINDOW); @@ -294,11 +285,6 @@ static void audio_capture_update(void *data, obs_data_t *settings) need_update = true; } - if (ctx->config.retry_interval != new_config.retry_interval) { - ctx->config.retry_interval = new_config.retry_interval; - need_update = true; - } - LeaveCriticalSection(&ctx->config_section); if (need_update) @@ -552,20 +538,6 @@ static obs_properties_t *audio_capture_properties(void *data) p = obs_properties_add_bool(ps, SETTING_EXCLUDE_PROCESS_TREE, TEXT_EXCLUDE_PROCESS_TREE); - // Recapture rate setting - p = obs_properties_add_list(ps, SETTING_RECAPTURE_RATE, - TEXT_RECAPTURE_RATE, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); - - obs_property_list_add_int(p, TEXT_RECAPTURE_RATE_SLOW, - RECAPTURE_RATE_SLOW); - obs_property_list_add_int(p, TEXT_RECAPTURE_RATE_NORMAL, - RECAPTURE_RATE_NORMAL); - obs_property_list_add_int(p, TEXT_RECAPTURE_RATE_FAST, - RECAPTURE_RATE_FAST); - obs_property_list_add_int(p, TEXT_RECAPTURE_RATE_FASTEST, - RECAPTURE_RATE_FASTEST); - return ps; } @@ -577,8 +549,6 @@ static void audio_capture_defaults(obs_data_t *settings) WINDOW_PRIORITY_EXE); obs_data_set_default_bool(settings, SETTING_EXCLUDE_PROCESS_TREE, false); - obs_data_set_default_int(settings, SETTING_RECAPTURE_RATE, - RECAPTURE_RATE_NORMAL); } static const char *audio_capture_get_name(void *type_data) diff --git a/src/audio-capture.h b/src/audio-capture.h index ab89c60..0c2b013 100644 --- a/src/audio-capture.h +++ b/src/audio-capture.h @@ -21,8 +21,6 @@ #define SETTING_EXCLUDE_PROCESS_TREE "exclude_process_tree" -#define SETTING_RECAPTURE_RATE "recapture_rate" - #define TEXT_NAME obs_module_text("Name") #define TEXT_MODE obs_module_text("Mode") @@ -40,45 +38,13 @@ #define TEXT_EXCLUDE_PROCESS_TREE obs_module_text("ExcludeProcessTree") -#define TEXT_RECAPTURE_RATE obs_module_text("RecaptureRate") -#define TEXT_RECAPTURE_RATE_SLOW obs_module_text("RecaptureRate.Slow") -#define TEXT_RECAPTURE_RATE_NORMAL obs_module_text("RecaptureRate.Normal") -#define TEXT_RECAPTURE_RATE_FAST obs_module_text("RecaptureRate.Fast") -#define TEXT_RECAPTURE_RATE_FASTEST obs_module_text("RecaptureRate.Fastest") - #define HOTKEY_START "hotkey_start" #define HOTKEY_STOP "hotkey_stop" -#define RECAPTURE_INTERVAL_DEFAULT 2.0f -#define RECAPTURE_INTERVAL_ERROR 4.0f - /* clang-format on */ enum mode { MODE_WINDOW, MODE_HOTKEY }; -enum recapture_rate { - RECAPTURE_RATE_SLOW, - RECAPTURE_RATE_NORMAL, - RECAPTURE_RATE_FAST, - RECAPTURE_RATE_FASTEST -}; - -static inline float recapture_rate_to_float(enum recapture_rate rate) -{ - switch (rate) { - case RECAPTURE_RATE_SLOW: - return 2.0f; - case RECAPTURE_RATE_FAST: - return 0.5f; - case RECAPTURE_RATE_FASTEST: - return 0.1f; - case RECAPTURE_RATE_NORMAL: - /* FALLTHROUGH */ - default: - return 1.0f; - } -} - struct audio_capture_config_t { enum mode mode; HWND hotkey_window; @@ -87,7 +53,6 @@ struct audio_capture_config_t { enum window_priority priority; bool exclude_process_tree; - float retry_interval; }; struct audio_capture_context_t {