mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2025-04-20 12:43:48 +01:00
Compare commits
No commits in common. "77adc6a71b38eb57eedaa6fea22c49af234c4625" and "aaee848962d43f0435402f4ea4c839cfbc7d8931" have entirely different histories.
77adc6a71b
...
aaee848962
@ -11,12 +11,6 @@ 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
|
## [1.0.1] - 2023-09-14
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -10,9 +10,9 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
|
|||||||
|
|
||||||
## Tested against
|
## Tested against
|
||||||
|
|
||||||
- Basic 1.1.1.1
|
- Basic 1.0.8.8
|
||||||
- Banana 2.1.1.1
|
- Banana 2.0.6.8
|
||||||
- Potato 3.1.1.1
|
- Potato 3.0.2.8
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
@ -4,21 +4,18 @@ module Voicemeeter
|
|||||||
include Logging
|
include Logging
|
||||||
include Worker
|
include Worker
|
||||||
include Events::Director
|
include Events::Director
|
||||||
prepend Util::Timeout
|
|
||||||
prepend Util::Cache
|
prepend Util::Cache
|
||||||
|
|
||||||
attr_reader :kind, :midi, :event, :delay, :cache
|
attr_reader :kind, :midi, :event, :delay, :cache
|
||||||
|
|
||||||
RATELIMIT = 0.033
|
RATELIMIT = 0.033
|
||||||
DELAY = 0.001
|
DELAY = 0.001
|
||||||
LOGIN_TIMEOUT = 2
|
|
||||||
|
|
||||||
def initialize(kind, **kwargs)
|
def initialize(kind, **kwargs)
|
||||||
@kind = kind
|
@kind = kind
|
||||||
@sync = kwargs[:sync] || false
|
@sync = kwargs[:sync] || false
|
||||||
@ratelimit = kwargs[:ratelimit] || RATELIMIT
|
@ratelimit = kwargs[:ratelimit] || RATELIMIT
|
||||||
@delay = kwargs[:delay] || DELAY
|
@delay = kwargs[:delay] || DELAY
|
||||||
@login_timeout = kwargs[:login_timeout] || LOGIN_TIMEOUT
|
|
||||||
@event =
|
@event =
|
||||||
Events::Tracker.new(
|
Events::Tracker.new(
|
||||||
**(kwargs.select { |k, _| %i[pdirty mdirty ldirty midi].include? k })
|
**(kwargs.select { |k, _| %i[pdirty mdirty ldirty midi].include? k })
|
||||||
@ -33,6 +30,8 @@ module Voicemeeter
|
|||||||
|
|
||||||
def login
|
def login
|
||||||
CBindings.call(:bind_login, ok: [0, 1]) == 1 and run_voicemeeter(kind.name)
|
CBindings.call(:bind_login, ok: [0, 1]) == 1 and run_voicemeeter(kind.name)
|
||||||
|
clear_dirty
|
||||||
|
logger.info "Successfully logged into #{self} version #{version}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def logout
|
def logout
|
||||||
@ -73,6 +72,7 @@ module Voicemeeter
|
|||||||
logger.debug "Voicemeeter engine running but the GUI appears to be down... launching."
|
logger.debug "Voicemeeter engine running but the GUI appears to be down... launching."
|
||||||
end
|
end
|
||||||
CBindings.call(:bind_run_voicemeeter, kinds[kind_id])
|
CBindings.call(:bind_run_voicemeeter, kinds[kind_id])
|
||||||
|
sleep(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def type
|
def type
|
||||||
|
@ -18,26 +18,6 @@ module Voicemeeter
|
|||||||
end
|
end
|
||||||
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
|
module Cache
|
||||||
def get(name, is_string = false)
|
def get(name, is_string = false)
|
||||||
return cache.delete(name) if cache.key? name
|
return cache.delete(name) if cache.key? name
|
||||||
|
@ -7,11 +7,11 @@ module Voicemeeter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def minor
|
def minor
|
||||||
1
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
def patch
|
def patch
|
||||||
0
|
1
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_a
|
def to_a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user