From decb8f198c656b41326f8d706dd82d01de477f21 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sat, 29 Jun 2024 10:31:27 +0100 Subject: [PATCH] add bits kwarg, for overriding type of voicemeeter GUI launched patch bump --- lib/voicemeeter/base.rb | 14 +++++++++++--- lib/voicemeeter/version.rb | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/voicemeeter/base.rb b/lib/voicemeeter/base.rb index 4e50db8..8dcc8a8 100644 --- a/lib/voicemeeter/base.rb +++ b/lib/voicemeeter/base.rb @@ -19,6 +19,11 @@ module Voicemeeter @ratelimit = kwargs[:ratelimit] || RATELIMIT @delay = kwargs[:delay] || DELAY @login_timeout = kwargs[:login_timeout] || LOGIN_TIMEOUT + @bits = kwargs[:bits] || 64 + if ![32, 64].include? @bits + logger.warn "kwarg bits got #{@bits}, expected either 32 or 64, defaulting to 64" + @bits = 64 + end @event = Events::Tracker.new( **(kwargs.select { |k, _| %i[pdirty mdirty ldirty midi].include? k }) @@ -65,9 +70,12 @@ module Voicemeeter def run_voicemeeter(kind_id) kinds = { - basic: (Install::OS_BITS == 64) ? Kinds::KindEnum::BASICX64 : Kinds::KindEnum::BASIC, - banana: (Install::OS_BITS == 64) ? Kinds::KindEnum::BANANAX64 : Kinds::KindEnum::BANANA, - potato: (Install::OS_BITS == 64) ? Kinds::KindEnum::POTATOX64 : Kinds::KindEnum::POTATO + basic: ([Install::OS_BITS, @bits].all? { |v| v == 64 }) ? + Kinds::KindEnum::BASICX64 : Kinds::KindEnum::BASIC, + banana: ([Install::OS_BITS, @bits].all? { |v| v == 64 }) ? + Kinds::KindEnum::BANANAX64 : Kinds::KindEnum::BANANA, + potato: ([Install::OS_BITS, @bits].all? { |v| v == 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." diff --git a/lib/voicemeeter/version.rb b/lib/voicemeeter/version.rb index 512e779..9596b8e 100644 --- a/lib/voicemeeter/version.rb +++ b/lib/voicemeeter/version.rb @@ -11,7 +11,7 @@ module Voicemeeter end def patch - 1 + 2 end def to_a