voicemeeter 0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 638c89f56d0d2dbffe4ce78ca575cc9c23101509c721ccbd4009ee191575881e
4
- data.tar.gz: 9da9196098ac5a6f248d5febadee8e49fa8d43b9b23f663923c35ba200b58ed7
3
+ metadata.gz: 07bc7810c8539267babd1a0ac6c1dc929e37b237f8b65b96d60ee2d6a823a0b5
4
+ data.tar.gz: 79c662a5e0b36a3787f4eb27d90892624a0990d3347165d7a6e036ee031ae9cc
5
5
  SHA512:
6
- metadata.gz: f81571b7ed2f35373e68d8c398d84ff6f375c819e1ec648b338df4296f7fe352d711b6ae3d419fec21eb9e2928e88b9070246da69d628149b3ea2defbe984ec6
7
- data.tar.gz: 4aac33247a3dcc5cf1debaa29dc243569034aa4c2c345bd2714b3097265f6ef22f1dccb91537963902fc9ebe19e9decd7229848318443c0bfcaef55b86fcffcf
6
+ metadata.gz: 5819aac96ad967b7da5195b8ada670825be2720a57ff70a540718c53cde98814f51154aec79ffa903269f39a12e12f27a87bd682f83545946119320203b65c58
7
+ data.tar.gz: 3c248695fcd6ab4f47582dc77c1bb2ad7d66dd08ef152261cdcacd268d7a65ed15c92749f3dafdf21256f044772b2a1dd90e767d9bf152edfee30c909afaf8ff
data/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ Before any major/minor/patch is released all unit tests will be run to verify they pass.
9
+
10
+ ## [Unreleased] - These changes have not been added to RubyGems yet
11
+
12
+ - [ ]
13
+
14
+ ## [1.0.1] - 2023-09-14
15
+
16
+ ### Added
17
+
18
+ - BusDevice added to Bus class.
19
+
20
+ ## [1.0.0] - 2023-09-01
21
+
22
+ ### Added
23
+
24
+ - Bindings and abstraction classes are implemented
25
+ - An event system:
26
+ - `pdirty`: parameter updates on the main Voicemeeter GUI
27
+ - `mdirty`: macrobutton updates
28
+ - `midi`: incoming data from a connected midi device
29
+ - `ldirty`: channel level updates
30
+ - An entry point for fetching a Remote class for each kind of Voicemeeter (basic, banana, potato)
31
+ - Logging system for reading messages sent by getters and setters.
32
+ - String class refinement in util.rb. It's scope should be limited to the CBindings module.
33
+ - rbs type signatures but some of them need updating.
34
+ - example user profile configs included with repo.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
+ [![Gem Version][gem version]](https://badge.fury.io/rb/voicemeeter)
1
2
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][license]
2
- [![Ruby Code Style](https://img.shields.io/badge/code_style-standard-violet.svg)](https://github.com/standardrb/standard)
3
+ [![Ruby Code Style][code style]](https://github.com/standardrb/standard)
3
4
 
4
5
  # Ruby Wrapper Around the Voicemeeter Remote API
5
6
 
@@ -197,7 +198,7 @@ The following attributes are available.
197
198
  example:
198
199
 
199
200
  ```ruby
200
- vm.strip[0].eq.ab = True
201
+ vm.strip[0].eq.ab = true
201
202
  ```
202
203
 
203
204
  Strip EQ parameters are defined for PhysicalStrips, potato version only.
@@ -457,7 +458,7 @@ vm.command.showvbanchat = true
457
458
  example:
458
459
 
459
460
  ```ruby
460
- vm.run { (0...vm.device.ins).each { puts vm.device.input(_1) } }
461
+ vm.run { |vm| (0...vm.device.ins).each { puts vm.device.input(_1) } }
461
462
  ```
462
463
 
463
464
  ### FX
@@ -491,7 +492,7 @@ vm.patch.postfxinsert = false
491
492
 
492
493
  ##### asio[i]
493
494
 
494
- - `get()`: int
495
+ - `get`: int
495
496
  - `set(patch_in)`: int, valid range determined by connected device.
496
497
 
497
498
  example:
@@ -504,7 +505,7 @@ i, from 0 to 10
504
505
 
505
506
  ##### A2[i] - A5[i]
506
507
 
507
- - `get()`: int
508
+ - `get`: int
508
509
  - `set(patch_out)`: int, valid range determined by connected device.
509
510
 
510
511
  example:
@@ -517,7 +518,7 @@ i, from 0 to 8.
517
518
 
518
519
  ##### composite[i]
519
520
 
520
- - `get()`: int
521
+ - `get`: int
521
522
  - `set(channel)`: int, from 0 up to number of channels depending on version.
522
523
 
523
524
  example:
@@ -572,7 +573,7 @@ vm.option.buffer.wdm = 512
572
573
 
573
574
  ##### delay[i]
574
575
 
575
- - `get()`: int
576
+ - `get`: int
576
577
  - `set(delay)`: int, from 0 to 500
577
578
 
578
579
  example:
@@ -702,9 +703,9 @@ The following methods are available:
702
703
  example:
703
704
 
704
705
  ```ruby
705
- vm.event.add(%w[pdirty mdirty midi ldirty])
706
+ vm.event.add(%i[pdirty mdirty midi ldirty])
706
707
 
707
- vm.event.remove(%w[pdirty mdirty midi ldirty])
708
+ vm.event.remove(%i[pdirty mdirty midi ldirty])
708
709
 
709
710
  # get a list of currently subscribed
710
711
  p vm.event.get
@@ -712,8 +713,6 @@ p vm.event.get
712
713
 
713
714
  ## `Voicemeeter Module`
714
715
 
715
- ### Remote class
716
-
717
716
  #### Voicemeeter::Remote
718
717
 
719
718
  You may pass the following optional keyword arguments:
@@ -745,9 +744,13 @@ vm.set("Strip[0].Gain", -3.6)
745
744
 
746
745
  ### Errors
747
746
 
748
- - `Errors::VMError`: Error raised when general errors occur.
749
- - `Errors::VMCAPIError`: Error raised when the C-API returns error values.
750
- - Error codes are stored in {Error Class}.code. For a full list of error codes [check the VoicemeeterRemote header file][voicemeeter remote header].
747
+ - `Errors::VMError`: Base Voicemeeter error class.
748
+ - `Errors::VMInstallError`: Raised when errors occur during installation.
749
+ - `Errors::VMCAPIError`: Raised when the C-API returns error codes.
750
+ - The following attributes are available:
751
+ - `fn_name`: name of the C-API function that failed.
752
+ - `code`: error code.
753
+ - For a full list of error codes [check the VoicemeeterRemote header file][voicemeeter remote header].
751
754
 
752
755
  ### Logging
753
756
 
@@ -773,3 +776,5 @@ Bundle exec rake
773
776
 
774
777
  [license]: https://github.com/onyx-and-iris/voicemeeter-rb/blob/dev/LICENSE
775
778
  [voicemeeter remote header]: https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/update-docs/VoicemeeterRemote.h
779
+ [code style]: https://img.shields.io/badge/code_style-standard-violet.svg
780
+ [gem version]: https://badge.fury.io/rb/voicemeeter.svg
@@ -207,9 +207,9 @@ module Voicemeeter
207
207
  data.each do |key, hash|
208
208
  case key.to_s.split("-")
209
209
  in [/strip|bus|button/ => kls, /^[0-9]+$/ => index]
210
- target = send(kls)
210
+ target = public_send(kls)
211
211
  in ["vban", /in|instream|out|oustream/ => dir, /^[0-9]+$/ => index]
212
- target = vban.send("#{dir.chomp("stream")}stream")
212
+ target = vban.public_send("#{dir.chomp("stream")}stream")
213
213
  else
214
214
  raise KeyError, "invalid config key '#{key}'"
215
215
  end
@@ -5,8 +5,12 @@ module Voicemeeter
5
5
  include IRemote
6
6
  include Mixins::Fades
7
7
  include Mixins::Return
8
+ extend MetaFunctions
8
9
 
9
- attr_reader :eq, :mode, :levels
10
+ attr_reader :eq, :mode, :levels, :device
11
+ attr_accessor_bool :mute, :mono, :sel, :monitor
12
+ attr_accessor_float :gain
13
+ attr_accessor_string :label
10
14
 
11
15
  def self.make(remote, i)
12
16
  (i < remote.kind.phys_out) ? PhysicalBus.new(remote, i) : VirtualBus.new(remote, i)
@@ -14,13 +18,10 @@ module Voicemeeter
14
18
 
15
19
  def initialize(remote, i)
16
20
  super
17
- make_accessor_bool :mute, :mono, :sel, :monitor
18
- make_accessor_float :gain
19
- make_accessor_string :label
20
-
21
21
  @eq = BusEq.new(remote, i)
22
22
  @mode = BusModes.new(remote, i)
23
23
  @levels = BusLevels.new(remote, i)
24
+ @device = BusDevice.new(remote, i)
24
25
  end
25
26
 
26
27
  def identifier
@@ -36,11 +37,9 @@ module Voicemeeter
36
37
 
37
38
  class BusEq
38
39
  include IRemote
40
+ extend MetaFunctions
39
41
 
40
- def initialize(remote, i)
41
- super
42
- make_accessor_bool :on, :ab
43
- end
42
+ attr_accessor_bool :on, :ab
44
43
 
45
44
  def identifier
46
45
  "bus[#{@index}].eq"
@@ -49,22 +48,20 @@ module Voicemeeter
49
48
 
50
49
  class BusModes
51
50
  include IRemote
52
-
53
- def initialize(remote, i)
54
- super
55
- make_accessor_bool :normal,
56
- :amix,
57
- :bmix,
58
- :repeat,
59
- :composite,
60
- :tvmix,
61
- :upmix21,
62
- :upmix41,
63
- :upmix61,
64
- :centeronly,
65
- :lfeonly,
66
- :rearonly
67
- end
51
+ extend MetaFunctions
52
+
53
+ attr_accessor_bool :normal,
54
+ :amix,
55
+ :bmix,
56
+ :repeat,
57
+ :composite,
58
+ :tvmix,
59
+ :upmix21,
60
+ :upmix41,
61
+ :upmix61,
62
+ :centeronly,
63
+ :lfeonly,
64
+ :rearonly
68
65
 
69
66
  def identifier
70
67
  "bus[#{@index}].mode"
@@ -115,12 +112,11 @@ module Voicemeeter
115
112
 
116
113
  class BusDevice
117
114
  include IRemote
115
+ extend MetaFunctions
118
116
 
119
- def initialize(remote, i)
120
- super
121
- make_reader_only :name, :sr
122
- make_writer_only :wdm, :ks, :mme, :asio
123
- end
117
+ attr_reader_int :sr
118
+ attr_reader_string :name
119
+ attr_writer_string :wdm, :ks, :mme, :asio
124
120
 
125
121
  def identifier
126
122
  "bus[#{@index}].device"
@@ -1,12 +1,10 @@
1
1
  module Voicemeeter
2
2
  class Command
3
3
  include IRemote
4
+ extend MetaFunctions
4
5
 
5
- def initialize(remote)
6
- super
7
- make_action_method :show, :restart, :shutdown
8
- make_writer_bool :showvbanchat, :lock
9
- end
6
+ attr_action_method :show, :restart, :shutdown
7
+ attr_writer_bool :showvbanchat, :lock
10
8
 
11
9
  def identifier
12
10
  :command
@@ -27,11 +27,22 @@ module Voicemeeter
27
27
  class Tracker
28
28
  include Logging
29
29
 
30
- attr_reader :pdirty, :mdirty, :midi, :ldirty
30
+ class << self
31
+ private def attr_accessor_events(*params)
32
+ params.each do |param|
33
+ attr_reader param
31
34
 
32
- def initialize(**kwargs)
33
- make_writer_methods :pdirty, :mdirty, :midi, :ldirty
35
+ define_method("#{param}=") do |value|
36
+ instance_variable_set("@#{param}", value)
37
+ info("#{param} #{value ? "added to" : "removed from"}")
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ attr_accessor_events :pdirty, :mdirty, :midi, :ldirty
34
44
 
45
+ def initialize(**kwargs)
35
46
  kwargs.each do |key, value|
36
47
  instance_variable_set("@#{key}", value || false)
37
48
  end
@@ -51,15 +62,6 @@ module Voicemeeter
51
62
  logger.info info_msg.join(" ")
52
63
  end
53
64
 
54
- private def make_writer_methods(*params)
55
- params.each do |param|
56
- define_singleton_method("#{param}=") do |value|
57
- instance_variable_set("@#{param}", value)
58
- info("#{param} #{value ? "added to" : "removed from"}")
59
- end
60
- end
61
- end
62
-
63
65
  def get
64
66
  %i[pdirty mdirty midi ldirty].reject { |ev| !send(ev) }
65
67
  end
@@ -1,6 +1,8 @@
1
1
  module Voicemeeter
2
2
  class Fx
3
3
  include IRemote
4
+ extend MetaFunctions
5
+
4
6
  attr_reader :reverb, :delay
5
7
 
6
8
  def initialize(remote)
@@ -16,11 +18,9 @@ module Voicemeeter
16
18
 
17
19
  class FxReverb
18
20
  include IRemote
21
+ extend MetaFunctions
19
22
 
20
- def initialize(remote)
21
- super
22
- make_accessor_bool :on, :ab
23
- end
23
+ attr_accessor_bool :on, :ab
24
24
 
25
25
  def identifier
26
26
  "fx.reverb"
@@ -29,11 +29,9 @@ module Voicemeeter
29
29
 
30
30
  class FxDelay
31
31
  include IRemote
32
+ extend MetaFunctions
32
33
 
33
- def initialize(remote)
34
- super
35
- make_accessor_bool :on, :ab
36
- end
34
+ attr_accessor_bool :on, :ab
37
35
 
38
36
  def identifier
39
37
  "fx.delay"
@@ -2,7 +2,6 @@ module Voicemeeter
2
2
  # Common interface with the base Remote class.
3
3
  module IRemote
4
4
  include Logging
5
- include MetaFunctions
6
5
 
7
6
  def initialize(remote, i = nil)
8
7
  @remote = remote
@@ -38,12 +37,12 @@ module Voicemeeter
38
37
  def apply(params)
39
38
  params.each do |key, val|
40
39
  if val.is_a? Hash
41
- target = send(key)
40
+ target = public_send(key)
42
41
  target.apply(val)
43
42
  elsif key == :mode
44
- mode.send("#{val}=", true)
43
+ mode.public_send("#{val}=", true)
45
44
  else
46
- send("#{key}=", val)
45
+ public_send("#{key}=", val)
47
46
  end
48
47
  end
49
48
  end
@@ -3,72 +3,72 @@ module Voicemeeter
3
3
  private
4
4
 
5
5
  # Accessor methods
6
- def make_accessor_bool(*params)
6
+ def attr_accessor_bool(*params)
7
7
  params.each do |param|
8
- define_singleton_method(param) { getter(param).to_i == 1 }
8
+ define_method(param) { getter(param).to_i == 1 }
9
9
 
10
- define_singleton_method("#{param}=") do |value|
10
+ define_method("#{param}=") do |value|
11
11
  setter(param, value && 1 || 0)
12
12
  end
13
13
  end
14
14
  end
15
15
 
16
- def make_accessor_string(*params)
16
+ def attr_accessor_string(*params)
17
17
  params.each do |param|
18
- define_singleton_method(param) { getter(param, true) }
18
+ define_method(param) { getter(param, true) }
19
19
 
20
- define_singleton_method("#{param}=") { |value| setter(param, value) }
20
+ define_method("#{param}=") { |value| setter(param, value) }
21
21
  end
22
22
  end
23
23
 
24
- def make_accessor_int(*params)
24
+ def attr_accessor_int(*params)
25
25
  params.each do |param|
26
- define_singleton_method(param) { getter(param).to_i }
26
+ define_method(param) { getter(param).to_i }
27
27
 
28
- define_singleton_method("#{param}=") { |value| setter(param, value) }
28
+ define_method("#{param}=") { |value| setter(param, value) }
29
29
  end
30
30
  end
31
31
 
32
- def make_accessor_float(*params)
32
+ def attr_accessor_float(*params)
33
33
  params.each do |param|
34
- define_singleton_method(param) { getter(param) }
34
+ define_method(param) { getter(param) }
35
35
 
36
- define_singleton_method("#{param}=") { |value| setter(param, value) }
36
+ define_method("#{param}=") { |value| setter(param, value) }
37
37
  end
38
38
  end
39
39
 
40
40
  # reader methods
41
- def make_reader_string(*params)
41
+ def attr_reader_string(*params)
42
42
  params.each do |param|
43
- define_singleton_method(param) { getter(param, true) }
43
+ define_method(param) { getter(param, true) }
44
44
  end
45
45
  end
46
46
 
47
- def make_reader_int(*params)
47
+ def attr_reader_int(*params)
48
48
  params.each do |param|
49
- define_singleton_method(param) { getter(param).to_i }
49
+ define_method(param) { getter(param).to_i }
50
50
  end
51
51
  end
52
52
 
53
53
  # writer methods
54
- def make_writer_bool(*params)
54
+ def attr_writer_bool(*params)
55
55
  params.each do |param|
56
- define_singleton_method("#{param}=") do |value|
56
+ define_method("#{param}=") do |value|
57
57
  setter(param, value && 1 || 0)
58
58
  end
59
59
  end
60
60
  end
61
61
 
62
- def make_writer_string(*params)
62
+ def attr_writer_string(*params)
63
63
  params.each do |param|
64
- define_singleton_method("#{param}=") { |value| setter(param, value) }
64
+ define_method("#{param}=") { |value| setter(param, value) }
65
65
  end
66
66
  end
67
67
 
68
68
  # methods for performing certain actions as opposed to setting values
69
- def make_action_method(*params)
69
+ def attr_action_method(*params)
70
70
  params.each do |param|
71
- define_singleton_method(param) { setter(param, 1) }
71
+ define_method(param) { setter(param, 1) }
72
72
  end
73
73
  end
74
74
  end
@@ -13,10 +13,8 @@ module Voicemeeter
13
13
  end
14
14
 
15
15
  module Return
16
- def initialize(remote, i)
17
- super
18
- make_accessor_float :returnreverb, :returndelay, :returnfx1, :returnfx2
19
- end
16
+ extend MetaFunctions
17
+ attr_accessor_float :returnreverb, :returndelay, :returnfx1, :returnfx2
20
18
  end
21
19
 
22
20
  module Apps
@@ -30,47 +28,40 @@ module Voicemeeter
30
28
  end
31
29
 
32
30
  module Outputs
33
- def initialize(*args)
34
- super
35
- remote, *_ = args
36
- num_a, num_b = remote.kind.outs
37
- channels =
38
- (1..(num_a + num_b)).map do |i|
39
- (i <= num_a) ? "A#{i}" : "B#{i - num_a}"
31
+ def make_attr_outputs(num_a, num_b)
32
+ (1..(num_a + num_b)).each do |i|
33
+ param = (i <= num_a) ? :"A#{i}" : :"B#{i - num_a}"
34
+ define_singleton_method(param) do
35
+ getter(param).to_i == 1
36
+ end
37
+ define_singleton_method("#{param}=") do |value|
38
+ setter(param, value && 1 || 0)
40
39
  end
41
- make_accessor_bool(*channels)
40
+ end
42
41
  end
43
42
  end
44
43
 
45
44
  module Xy
46
45
  module Pan
47
- def initialize(remote, i)
48
- super
49
- make_accessor_float :pan_x, :pan_y
50
- end
46
+ extend MetaFunctions
47
+ attr_accessor_float :pan_x, :pan_y
51
48
  end
52
49
 
53
50
  module Color
54
- def initialize(remote, i)
55
- super
56
- make_accessor_float :color_x, :color_y
57
- end
51
+ extend MetaFunctions
52
+ attr_accessor_float :color_x, :color_y
58
53
  end
59
54
 
60
55
  module Fx
61
- def initialize(remote, i)
62
- super
63
- make_accessor_float :fx_x, :fx_y
64
- end
56
+ extend MetaFunctions
57
+ attr_accessor_float :fx_x, :fx_y
65
58
  end
66
59
  end
67
60
 
68
61
  module Fx
69
- def initialize(remote, i)
70
- super
71
- make_accessor_float :reverb, :delay, :fx1, :fx2
72
- make_accessor_bool :postreverb, :postdelay, :postfx1, :postfx2
73
- end
62
+ extend MetaFunctions
63
+ attr_accessor_float :reverb, :delay, :fx1, :fx2
64
+ attr_accessor_bool :postreverb, :postdelay, :postfx1, :postfx2
74
65
  end
75
66
 
76
67
  module LevelEnum
@@ -2,13 +2,14 @@ module Voicemeeter
2
2
  module Option
3
3
  class Base
4
4
  include IRemote
5
+ extend MetaFunctions
6
+
5
7
  attr_reader :delay, :buffer, :mode
8
+ attr_accessor_int :sr
9
+ attr_accessor_bool :asiosr, :monitoronsel, :slidermode
6
10
 
7
11
  def initialize(remote)
8
12
  super
9
- make_accessor_int :sr
10
- make_accessor_bool :asiosr, :monitoronsel, :slidermode
11
-
12
13
  @delay = (0...remote.kind.phys_out).map { OptionDelay.new(remote, _1) }
13
14
  @buffer = OptionBuffer.new(remote)
14
15
  @mode = OptionMode.new(remote)
@@ -21,11 +22,9 @@ module Voicemeeter
21
22
 
22
23
  class OptionDelay
23
24
  include IRemote
25
+ extend MetaFunctions
24
26
 
25
- def initialize(remote, i)
26
- super
27
- make_accessor_bool :on, :ab
28
- end
27
+ attr_accessor_bool :on, :ab
29
28
 
30
29
  def identifier
31
30
  "option.delay"
@@ -42,11 +41,9 @@ module Voicemeeter
42
41
 
43
42
  class OptionBuffer
44
43
  include IRemote
44
+ extend MetaFunctions
45
45
 
46
- def initialize(remote)
47
- super
48
- make_accessor_int :mme, :wdm, :ks, :asio
49
- end
46
+ attr_accessor_int :mme, :wdm, :ks, :asio
50
47
 
51
48
  def identifier
52
49
  "option.buffer"
@@ -55,11 +52,9 @@ module Voicemeeter
55
52
 
56
53
  class OptionMode
57
54
  include IRemote
55
+ extend MetaFunctions
58
56
 
59
- def initialize(remote)
60
- super
61
- make_accessor_bool :exclusif, :swift
62
- end
57
+ attr_accessor_bool :exclusif, :swift
63
58
 
64
59
  def identifier
65
60
  "option.mode"
@@ -3,12 +3,13 @@ module Voicemeeter
3
3
  # Base class for Patch
4
4
  class Base
5
5
  include IRemote
6
+ extend MetaFunctions
7
+
6
8
  attr_reader :asio, :A2, :A3, :A4, :A5, :composite, :insert
9
+ attr_accessor_bool :postfadercomposite, :postfxinsert
7
10
 
8
11
  def initialize(remote)
9
12
  super
10
- make_accessor_bool :postfadercomposite, :postfxinsert
11
-
12
13
  asio_in, asio_out = remote.kind.asio
13
14
  @asio = (0...asio_in).map { PatchAsioIn.new(remote, _1) }
14
15
  %i[A2 A3 A4 A5].each do |param|
@@ -11,15 +11,16 @@ module Voicemeeter
11
11
  class Base
12
12
  include IRemote
13
13
  include Mixins::Outputs
14
+ extend MetaFunctions
14
15
 
15
16
  attr_reader :mode, :armstrip, :armbus
17
+ attr_action_method :play, :stop, :pause, :replay, :record, :ff, :rew
18
+ attr_accessor_int :bitresolution, :channel, :kbps
19
+ attr_accessor_float :gain
16
20
 
17
21
  def initialize(remote)
18
22
  super
19
- make_action_method :play, :stop, :pause, :replay, :record, :ff, :rew
20
- make_accessor_int :bitresolution, :channel, :kbps
21
- make_accessor_float :gain
22
-
23
+ make_attr_outputs(*remote.kind.outs)
23
24
  @mode = RecorderMode.new(remote)
24
25
  @armstrip = (0...remote.kind.num_strip).map { RecorderArmStrip.new(remote, _1) }
25
26
  @armbus = (0...remote.kind.num_bus).map { RecorderArmBus.new(remote, _1) }
@@ -51,11 +52,9 @@ module Voicemeeter
51
52
 
52
53
  class RecorderMode
53
54
  include IRemote
55
+ extend MetaFunctions
54
56
 
55
- def initialize(remote)
56
- super
57
- make_accessor_bool :recbus, :playonload, :loop, :multitrack
58
- end
57
+ attr_accessor_bool :recbus, :playonload, :loop, :multitrack
59
58
 
60
59
  def identifier
61
60
  "recorder.mode"
@@ -54,10 +54,10 @@ module Voicemeeter
54
54
  end
55
55
  end
56
56
 
57
- # Represents a RemoteBasic type
57
+ # Represents a Basic Remote
58
58
  class RemoteBasic < Remote; end
59
59
 
60
- # Represents a RemoteBanana type
60
+ # Represents a Banana Remote
61
61
  class RemoteBanana < Remote
62
62
  public attr_reader :recorder, :patch
63
63
 
@@ -66,7 +66,7 @@ module Voicemeeter
66
66
  end
67
67
  end
68
68
 
69
- # Represents a RemotePotato type
69
+ # Represents a Potato Remote
70
70
  class RemotePotato < Remote
71
71
  public attr_reader :recorder, :patch, :fx
72
72
 
@@ -5,8 +5,13 @@ module Voicemeeter
5
5
  include IRemote
6
6
  include Mixins::Outputs
7
7
  include Mixins::Fades
8
+ extend MetaFunctions
8
9
 
9
10
  attr_reader :gainlayer, :levels
11
+ attr_accessor_bool :solo, :mute, :mono
12
+ attr_accessor_float :gain
13
+ attr_accessor_int :limit
14
+ attr_accessor_string :label
10
15
 
11
16
  def self.make(remote, i)
12
17
  (i < remote.kind.phys_in) ? PhysicalStrip.new(remote, i) : VirtualStrip.new(remote, i)
@@ -14,11 +19,7 @@ module Voicemeeter
14
19
 
15
20
  def initialize(remote, i)
16
21
  super
17
- make_accessor_bool :solo, :mute, :mono
18
- make_accessor_float :gain
19
- make_accessor_int :limit
20
- make_accessor_string :label
21
-
22
+ make_attr_outputs(*remote.kind.outs)
22
23
  @gainlayer = (0...8).map { GainLayer.new(remote, i, _1) }
23
24
  @levels = StripLevels.new(remote, i)
24
25
  end
@@ -34,13 +35,13 @@ module Voicemeeter
34
35
  include Mixins::Xy::Color
35
36
  include Mixins::Xy::Fx
36
37
  include Mixins::Fx
38
+ extend MetaFunctions
37
39
 
38
40
  attr_reader :comp, :gate, :denoiser, :eq, :device
41
+ attr_accessor_float :audibility
39
42
 
40
43
  def initialize(remote, i)
41
44
  super
42
- make_accessor_float :audibility
43
-
44
45
  @comp = StripComp.new(remote, i)
45
46
  @gate = StripGate.new(remote, i)
46
47
  @denoiser = StripDenoiser.new(remote, i)
@@ -51,18 +52,16 @@ module Voicemeeter
51
52
 
52
53
  class StripComp
53
54
  include IRemote
55
+ extend MetaFunctions
54
56
 
55
- def initialize(remote, i)
56
- super
57
- make_accessor_float :gainin,
58
- :ratio,
59
- :threshold,
60
- :attack,
61
- :release,
62
- :knee,
63
- :gainout
64
- make_accessor_bool :makeup
65
- end
57
+ attr_accessor_float :gainin,
58
+ :ratio,
59
+ :threshold,
60
+ :attack,
61
+ :release,
62
+ :knee,
63
+ :gainout
64
+ attr_accessor_bool :makeup
66
65
 
67
66
  def identifier
68
67
  "strip[#{@index}].comp"
@@ -79,12 +78,10 @@ module Voicemeeter
79
78
 
80
79
  class StripGate
81
80
  include IRemote
81
+ extend MetaFunctions
82
82
 
83
- def initialize(remote, i)
84
- super
85
- make_accessor_float :threshold, :damping, :attack, :hold, :release
86
- make_accessor_int :bpsidechain
87
- end
83
+ attr_accessor_float :threshold, :damping, :attack, :hold, :release
84
+ attr_accessor_int :bpsidechain
88
85
 
89
86
  def identifier
90
87
  "strip[#{@index}].gate"
@@ -117,11 +114,9 @@ module Voicemeeter
117
114
 
118
115
  class StripEq
119
116
  include IRemote
117
+ extend MetaFunctions
120
118
 
121
- def initialize(remote, i)
122
- super
123
- make_accessor_bool :on, :ab
124
- end
119
+ attr_accessor_bool :on, :ab
125
120
 
126
121
  def identifier
127
122
  "strip[#{@index}].eq"
@@ -130,13 +125,11 @@ module Voicemeeter
130
125
 
131
126
  class StripDevice
132
127
  include IRemote
128
+ extend MetaFunctions
133
129
 
134
- def initialize(remote, i)
135
- super
136
- make_reader_int :sr
137
- make_reader_string :name
138
- make_writer_string :wdm, :ks, :mme, :asio
139
- end
130
+ attr_reader_int :sr
131
+ attr_reader_string :name
132
+ attr_writer_string :wdm, :ks, :mme, :asio
140
133
 
141
134
  def identifier
142
135
  "strip[#{@index}].device"
@@ -147,12 +140,10 @@ module Voicemeeter
147
140
  class VirtualStrip < Base
148
141
  include Mixins::Xy::Pan
149
142
  include Mixins::Apps
143
+ extend MetaFunctions
150
144
 
151
- def initialize(remote, i)
152
- super
153
- make_accessor_bool :mc
154
- make_accessor_int :karaoke
155
- end
145
+ attr_accessor_bool :mc
146
+ attr_accessor_int :karaoke
156
147
 
157
148
  def bass
158
149
  round(getter("EQGain1"), 1)
@@ -3,13 +3,11 @@ module Voicemeeter
3
3
  # Base class for Vban In/Out Streams
4
4
  class VbanStream
5
5
  include IRemote
6
+ extend MetaFunctions
6
7
 
7
- def initialize(remote, i)
8
- super
9
- make_accessor_bool :on
10
- make_accessor_string :name, :ip
11
- make_accessor_int :quality, :route
12
- end
8
+ attr_accessor_bool :on
9
+ attr_accessor_string :name, :ip
10
+ attr_accessor_int :quality, :route
13
11
 
14
12
  def identifier
15
13
  "vban.#{direction}stream[#{@index}]"
@@ -22,10 +20,7 @@ module Voicemeeter
22
20
 
23
21
  # Represents a Vban InStream
24
22
  class VbanInstream < VbanStream
25
- def initialize(remote, i)
26
- super
27
- make_reader_int :sr, :channel, :bit
28
- end
23
+ attr_reader_int :sr, :channel, :bit
29
24
 
30
25
  def direction
31
26
  :in
@@ -43,10 +38,7 @@ module Voicemeeter
43
38
 
44
39
  # Represents a Vban OutStream
45
40
  class VbanOutstream < VbanStream
46
- def initialize(remote, i)
47
- super
48
- make_accessor_int :sr, :channel, :bit
49
- end
41
+ attr_accessor_int :sr, :channel, :bit
50
42
 
51
43
  def direction
52
44
  :out
@@ -3,7 +3,7 @@ module Voicemeeter
3
3
  module_function
4
4
 
5
5
  def major
6
- 0
6
+ 1
7
7
  end
8
8
 
9
9
  def minor
@@ -7,8 +7,7 @@ module Voicemeeter
7
7
  def init_producer(que)
8
8
  @producer = Thread.new do
9
9
  Thread.current.name = "producer"
10
- Thread.current[:running] = true
11
- while Thread.current[:running]
10
+ while @running
12
11
  que << :pdirty if event.pdirty
13
12
  que << :mdirty if event.mdirty
14
13
  que << :midi if event.midi
@@ -16,7 +15,7 @@ module Voicemeeter
16
15
  sleep(@ratelimit)
17
16
  end
18
17
  logger.debug "closing #{Thread.current.name} thread"
19
- que << Thread.current[:running]
18
+ que << @running
20
19
  end
21
20
  end
22
21
 
@@ -51,12 +50,13 @@ module Voicemeeter
51
50
 
52
51
  def init_event_threads
53
52
  que = Queue.new
53
+ @running = true
54
54
  init_worker(que) and init_producer(que)
55
55
  end
56
56
 
57
57
  def end_event_threads
58
58
  if running?
59
- @producer[:running] = false
59
+ @running = false
60
60
  @producer.join
61
61
  end
62
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voicemeeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.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: 2023-08-29 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -92,8 +92,10 @@ executables: []
92
92
  extensions: []
93
93
  extra_rdoc_files:
94
94
  - README.md
95
+ - CHANGELOG.md
95
96
  - LICENSE
96
97
  files:
98
+ - CHANGELOG.md
97
99
  - LICENSE
98
100
  - README.md
99
101
  - lib/voicemeeter.rb