mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2025-04-19 20:23:50 +01:00
Compare commits
4 Commits
aaee848962
...
77adc6a71b
Author | SHA1 | Date | |
---|---|---|---|
77adc6a71b | |||
a886e2ab2e | |||
3f8673ea17 | |||
57112fd90a |
@ -11,6 +11,12 @@ Before any major/minor/patch is released all unit tests will be run to verify th
|
||||
|
||||
- [ ]
|
||||
|
||||
## [1.1.0] - 2023-06-28
|
||||
|
||||
### Added
|
||||
|
||||
- Configurable kwarg `login_timeout`, defaults to 2s.
|
||||
|
||||
## [1.0.1] - 2023-09-14
|
||||
|
||||
### Added
|
||||
|
@ -10,9 +10,9 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
|
||||
|
||||
## Tested against
|
||||
|
||||
- Basic 1.0.8.8
|
||||
- Banana 2.0.6.8
|
||||
- Potato 3.0.2.8
|
||||
- Basic 1.1.1.1
|
||||
- Banana 2.1.1.1
|
||||
- Potato 3.1.1.1
|
||||
|
||||
## Requirements
|
||||
|
||||
|
@ -4,18 +4,21 @@ module Voicemeeter
|
||||
include Logging
|
||||
include Worker
|
||||
include Events::Director
|
||||
prepend Util::Timeout
|
||||
prepend Util::Cache
|
||||
|
||||
attr_reader :kind, :midi, :event, :delay, :cache
|
||||
|
||||
RATELIMIT = 0.033
|
||||
DELAY = 0.001
|
||||
LOGIN_TIMEOUT = 2
|
||||
|
||||
def initialize(kind, **kwargs)
|
||||
@kind = kind
|
||||
@sync = kwargs[:sync] || false
|
||||
@ratelimit = kwargs[:ratelimit] || RATELIMIT
|
||||
@delay = kwargs[:delay] || DELAY
|
||||
@login_timeout = kwargs[:login_timeout] || LOGIN_TIMEOUT
|
||||
@event =
|
||||
Events::Tracker.new(
|
||||
**(kwargs.select { |k, _| %i[pdirty mdirty ldirty midi].include? k })
|
||||
@ -30,8 +33,6 @@ module Voicemeeter
|
||||
|
||||
def login
|
||||
CBindings.call(:bind_login, ok: [0, 1]) == 1 and run_voicemeeter(kind.name)
|
||||
clear_dirty
|
||||
logger.info "Successfully logged into #{self} version #{version}"
|
||||
end
|
||||
|
||||
def logout
|
||||
@ -72,7 +73,6 @@ module Voicemeeter
|
||||
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
|
||||
|
||||
def type
|
||||
|
@ -18,6 +18,26 @@ module Voicemeeter
|
||||
end
|
||||
end
|
||||
|
||||
module Timeout
|
||||
def login
|
||||
super
|
||||
|
||||
err = nil
|
||||
start = Time.now
|
||||
begin
|
||||
sleep 0.1
|
||||
logger.info "Successfully logged into #{self} version #{version}"
|
||||
logger.debug "login time: #{(Time.now - start).round(2)}"
|
||||
err = nil
|
||||
rescue Errors::VMCAPIError => e
|
||||
err = e
|
||||
retry if Time.now < start + @login_timeout
|
||||
end
|
||||
raise Errors::VMError.new "Timeout logging into the api" if err
|
||||
clear_dirty
|
||||
end
|
||||
end
|
||||
|
||||
module Cache
|
||||
def get(name, is_string = false)
|
||||
return cache.delete(name) if cache.key? name
|
||||
|
@ -7,11 +7,11 @@ module Voicemeeter
|
||||
end
|
||||
|
||||
def minor
|
||||
0
|
||||
1
|
||||
end
|
||||
|
||||
def patch
|
||||
1
|
||||
0
|
||||
end
|
||||
|
||||
def to_a
|
||||
|
Loading…
x
Reference in New Issue
Block a user