From 2c5783b1a185835670d139cecb983cad6df618e7 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 31 Jul 2023 15:16:19 +0100 Subject: [PATCH] use 'and' control flow operator add debug log message if caller was login method --- lib/voicemeeter/base.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/voicemeeter/base.rb b/lib/voicemeeter/base.rb index d77167a..31fd64e 100644 --- a/lib/voicemeeter/base.rb +++ b/lib/voicemeeter/base.rb @@ -40,7 +40,7 @@ module Voicemeeter end def login - run_voicemeeter(kind.name) if CBindings.call(:bind_login, ok: [0, 1]) == 1 + CBindings.call(:bind_login, ok: [0, 1]) == 1 and run_voicemeeter(kind.name) clear_dirty logger.info "Successfully logged into #{self} version #{version}" end @@ -78,6 +78,9 @@ module Voicemeeter banana: Kinds::KindEnum::BANANA, potato: (Install::OS_BITS == 64) ? Kinds::KindEnum::POTATOX64 : Kinds::KindEnum::POTATO } + if caller(1..1).first[/`(.*)'/, 1] == "login" + logger.debug("Voicemeeter engine running but the GUI appears to be down... launching.") + end CBindings.call(:bind_run_voicemeeter, kinds[kind_id]) sleep(1) end