voicemeeter_api_ruby 4.4.0 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,80 +1,80 @@
1
- require_relative "iremote"
2
- require_relative "meta"
3
- require_relative "errors"
4
-
5
- module Voicemeeter
6
- class VbanStream < IRemote
7
- "
8
- A class representing a VBAN stream
9
- "
10
- include Vban_Meta_Functions
11
-
12
- def initialize(remote, i)
13
- super
14
- self.make_accessor_bool :on
15
- self.make_accessor_string :name, :ip
16
- self.make_accessor_int :quality, :route
17
- end
18
-
19
- def identifier
20
- "vban.#{self.direction}stream[#{@index}]"
21
- end
22
-
23
- def direction
24
- raise "Called abstract mehod: direction"
25
- end
26
- end
27
-
28
- class VbanInstream < VbanStream
29
- "
30
- A subclass representing a VBAN Instream
31
- "
32
- def initialize(remote, i)
33
- super
34
- self.make_reader_int :sr, :channel, :bit
35
- end
36
-
37
- def direction
38
- :in
39
- end
40
- end
41
-
42
- class VbanOutstream < VbanStream
43
- "
44
- A subclass representing a VBAN Outstream
45
- "
46
- def initialize(remote, i)
47
- super
48
- self.make_accessor_int :sr, :channel, :bit
49
- end
50
-
51
- def direction
52
- :out
53
- end
54
- end
55
-
56
- class Vban
57
- attr_accessor :instream, :outstream
58
-
59
- def initialize(remote, vban_streams)
60
- "
61
- Initializes a Vban class
62
-
63
- Creates an array for each in/out stream
64
- "
65
- vban_in, vban_out = vban_streams.values
66
- self.instream = (0...vban_in).map { |i| VbanInstream.new(remote, i) }
67
- self.outstream = (0...vban_out).map { |i| VbanOutstream.new(remote, i) }
68
-
69
- @remote = remote
70
- end
71
-
72
- def enable
73
- @remote.set_parameter("vban.enable", 1)
74
- end
75
-
76
- def disable
77
- @remote.set_parameter("vban.enable", 0)
78
- end
79
- end
80
- end
1
+ require_relative "iremote"
2
+ require_relative "meta"
3
+ require_relative "errors"
4
+
5
+ module Voicemeeter
6
+ class VbanStream < IRemote
7
+ "
8
+ A class representing a VBAN stream
9
+ "
10
+ include Vban_Meta_Functions
11
+
12
+ def initialize(remote, i)
13
+ super
14
+ self.make_accessor_bool :on
15
+ self.make_accessor_string :name, :ip
16
+ self.make_accessor_int :quality, :route
17
+ end
18
+
19
+ def identifier
20
+ "vban.#{self.direction}stream[#{@index}]"
21
+ end
22
+
23
+ def direction
24
+ raise "Called abstract mehod: direction"
25
+ end
26
+ end
27
+
28
+ class VbanInstream < VbanStream
29
+ "
30
+ A subclass representing a VBAN Instream
31
+ "
32
+ def initialize(remote, i)
33
+ super
34
+ self.make_reader_int :sr, :channel, :bit
35
+ end
36
+
37
+ def direction
38
+ :in
39
+ end
40
+ end
41
+
42
+ class VbanOutstream < VbanStream
43
+ "
44
+ A subclass representing a VBAN Outstream
45
+ "
46
+ def initialize(remote, i)
47
+ super
48
+ self.make_accessor_int :sr, :channel, :bit
49
+ end
50
+
51
+ def direction
52
+ :out
53
+ end
54
+ end
55
+
56
+ class Vban
57
+ attr_accessor :instream, :outstream
58
+
59
+ def initialize(remote, vban_streams)
60
+ "
61
+ Initializes a Vban class
62
+
63
+ Creates an array for each in/out stream
64
+ "
65
+ vban_in, vban_out = vban_streams.values
66
+ self.instream = (0...vban_in).map { |i| VbanInstream.new(remote, i) }
67
+ self.outstream = (0...vban_out).map { |i| VbanOutstream.new(remote, i) }
68
+
69
+ @remote = remote
70
+ end
71
+
72
+ def enable
73
+ @remote.set_parameter("vban.enable", 1)
74
+ end
75
+
76
+ def disable
77
+ @remote.set_parameter("vban.enable", 0)
78
+ end
79
+ end
80
+ end
@@ -1,25 +1,25 @@
1
- module Voicemeeter
2
- module Version
3
- module_function
4
-
5
- def major
6
- 4
7
- end
8
-
9
- def minor
10
- 4
11
- end
12
-
13
- def patch
14
- 0
15
- end
16
-
17
- def to_a
18
- [major, minor, patch]
19
- end
20
-
21
- def to_s
22
- to_a.join(".")
23
- end
24
- end
25
- end
1
+ module Voicemeeter
2
+ module Version
3
+ module_function
4
+
5
+ def major
6
+ 4
7
+ end
8
+
9
+ def minor
10
+ 4
11
+ end
12
+
13
+ def patch
14
+ 1
15
+ end
16
+
17
+ def to_a
18
+ [major, minor, patch]
19
+ end
20
+
21
+ def to_s
22
+ to_a.join(".")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ module Voicemeeter
2
+ module Worker
3
+ def init_worker
4
+ puts "Listening for #{@event.get.join(", ")} events"
5
+ @cache["strip_level"], @cache["bus_level"] = _get_levels
6
+ @running = true
7
+ Thread.new do
8
+ loop do
9
+ Thread.stop if !@running
10
+ if @event.pdirty && pdirty?
11
+ changed
12
+ notify_observers("pdirty")
13
+ end
14
+ if @event.mdirty && mdirty?
15
+ changed
16
+ notify_observers("mdirty")
17
+ end
18
+ if @event.midi && get_midi_message
19
+ changed
20
+ notify_observers("midi")
21
+ end
22
+ if @event.ldirty && ldirty?
23
+ changed
24
+ @_strip_comp =
25
+ @cache["strip_level"].map.with_index do |x, i|
26
+ !(x == @strip_buf[i])
27
+ end
28
+ @_bus_comp =
29
+ @cache["bus_level"].map.with_index { |x, i| !(x == @bus_buf[i]) }
30
+ @cache["strip_level"] = @strip_buf
31
+ @cache["bus_level"] = @bus_buf
32
+ notify_observers("ldirty")
33
+ end
34
+ sleep(@ratelimit)
35
+ end
36
+ end
37
+ end
38
+
39
+ def end_worker
40
+ @running = false
41
+ end
42
+ end
43
+ end
data/lib/voicemeeter.rb CHANGED
@@ -1,86 +1,9 @@
1
- require_relative "voicemeeter/base"
2
- require_relative "voicemeeter/strip"
3
- require_relative "voicemeeter/bus"
4
- require_relative "voicemeeter/button"
5
- require_relative "voicemeeter/vban"
6
- require_relative "voicemeeter/command"
7
- require_relative "voicemeeter/recorder"
8
- require_relative "voicemeeter/device"
9
-
10
- module Voicemeeter
11
- include RunVM
12
-
13
- private
14
-
15
- class Remote < Base
16
- include Kinds
17
- "
18
- Remote class, subclasses Base
19
-
20
- Console layout built according to a kind
21
-
22
- Offers a run method for resource closure.
23
- "
24
- def initialize(kind, **kwargs)
25
- super
26
- self.strip = Strip.make(self, kind.layout[:strip])
27
- self.bus = Bus.make(self, kind.layout[:bus])
28
- self.button = MacroButton.make(self, kind.layout[:mb])
29
- self.vban = Vban.new(self, kind.layout[:vban])
30
- self.command = Command.new(self)
31
- self.recorder = Recorder.new(self)
32
- self.device = Device.new(self)
33
- end
34
-
35
- def run
36
- "
37
- Handles login/logout
38
-
39
- Starts/stops the observable thread.
40
- "
41
- login
42
- init_thread
43
-
44
- yield if block_given?
45
- ensure
46
- end_thread
47
- logout
48
- end
49
- end
50
-
51
- public
52
-
53
- def self.remote(kind_id, **kwargs)
54
- "
55
- Factory method for remotes.
56
-
57
- Creates a hash of remote classes, one for each kind.
58
-
59
- Handles kind_id request errors.
60
-
61
- Returns a remote class of the kind requested.
62
- "
63
- _remotes =
64
- Kinds.kinds_all.to_h do |kind|
65
- [kind.name.to_s, Remote.new(kind, **kwargs)]
66
- end
67
-
68
- unless _remotes.key? kind_id
69
- raise VMRemoteErrors.new("Unknown Voicemeeter Kind.")
70
- end
71
- _remotes[kind_id]
72
- end
73
-
74
- def self.testing
75
- "
76
- Returns a random Remote class
77
- "
78
- unless ENV["RACK_ENV"] == "dev"
79
- raise VMRemoteErrors.new("Not in developer mode")
80
- end
81
-
82
- Remote.new(Kinds.kinds_all.sample)
83
- end
84
-
85
- module_function :start
86
- end
1
+ require_relative "voicemeeter/base"
2
+ require_relative "voicemeeter/strip"
3
+ require_relative "voicemeeter/bus"
4
+ require_relative "voicemeeter/button"
5
+ require_relative "voicemeeter/vban"
6
+ require_relative "voicemeeter/command"
7
+ require_relative "voicemeeter/recorder"
8
+ require_relative "voicemeeter/device"
9
+ require_relative "voicemeeter/remote"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voicemeeter_api_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - onyx_online
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-06 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -101,10 +101,12 @@ files:
101
101
  - lib/voicemeeter/midi.rb
102
102
  - lib/voicemeeter/mixin.rb
103
103
  - lib/voicemeeter/recorder.rb
104
+ - lib/voicemeeter/remote.rb
104
105
  - lib/voicemeeter/runvm.rb
105
106
  - lib/voicemeeter/strip.rb
106
107
  - lib/voicemeeter/vban.rb
107
108
  - lib/voicemeeter/version.rb
109
+ - lib/voicemeeter/worker.rb
108
110
  homepage: https://rubygems.org/gems/voicemeeter_api_ruby
109
111
  licenses:
110
112
  - MIT