get method added to BusMode class

This commit is contained in:
onyx-and-iris 2023-07-18 10:34:51 +01:00
parent 049b8614a2
commit d5f1dd7814
3 changed files with 40 additions and 24 deletions

View File

@ -65,7 +65,7 @@ Pass the kind of Voicemeeter as an argument. KIND_ID may be:
### Strip ### Strip
The following properties are available. The following attributes are available.
- `mono`: boolean - `mono`: boolean
- `solo`: boolean - `solo`: boolean
@ -121,7 +121,7 @@ vm.strip[5].appmute("Spotify", true)
#### Comp #### Comp
The following properties are available. The following attributes are available.
- `knob`: float, from 0.0 to 10.0 - `knob`: float, from 0.0 to 10.0
- `gainin`: float, from -24.0 to 24.0 - `gainin`: float, from -24.0 to 24.0
@ -145,7 +145,7 @@ Strip Comp parameters are defined for PhysicalStrips.
#### Gate #### Gate
The following properties are available. The following attributes are available.
- `knob`: float, from 0.0 to 10.0 - `knob`: float, from 0.0 to 10.0
- `threshold`: float, from -60.0 to -10.0 - `threshold`: float, from -60.0 to -10.0
@ -167,7 +167,7 @@ Strip Gate parameters are defined for PhysicalStrips.
#### Denoiser #### Denoiser
The following properties are available. The following attributes are available.
- `knob`: float, from 0.0 to 10.0 - `knob`: float, from 0.0 to 10.0
@ -181,7 +181,7 @@ Strip Denoiser parameters are defined for PhysicalStrips, potato version only.
#### EQ #### EQ
The following properties are available. The following attributes are available.
- `on`: boolean - `on`: boolean
- `ab`: boolean - `ab`: boolean
@ -208,7 +208,7 @@ Gainlayers are defined for potato version only.
##### Levels ##### Levels
The following properties are available. The following attributes are available.
- `prefader` - `prefader`
- `postfader` - `postfader`
@ -224,11 +224,10 @@ Level properties will return -200.0 if no audio detected.
### Bus ### Bus
The following properties are available. The following attributes are available.
- `mono`: boolean - `mono`: boolean
- `mute`: boolean - `mute`: boolean
- `eq`: boolean
- `sel`: boolean - `sel`: boolean
- `gain`: float, from -60.0 to 12.0 - `gain`: float, from -60.0 to 12.0
- `label`: string - `label`: string
@ -249,9 +248,9 @@ vm.bus[4].mono = true
##### EQ ##### EQ
The following properties are available. The following attributes are available.
- `eq`: boolean - `on`: boolean
- `ab`: boolean - `ab`: boolean
example: example:
@ -262,6 +261,8 @@ vm.bus[4].eq.on = true
##### Modes ##### Modes
The following attributes are available.
- `normal`: boolean - `normal`: boolean
- `amix`: boolean - `amix`: boolean
- `bmix`: boolean - `bmix`: boolean
@ -274,15 +275,20 @@ vm.bus[4].eq.on = true
- `lfeonly`: boolean - `lfeonly`: boolean
- `rearonly`: boolean - `rearonly`: boolean
The following methods are available.
- `get`
example: example:
```ruby ```ruby
vm.bus[4].mode.amix = true vm.bus[4].mode.amix = true
puts vm.bus[3].mode.get
``` ```
##### Levels ##### Levels
The following properties are available. The following attributes are available.
- `all` - `all`
@ -312,7 +318,7 @@ vm.bus[3].fadeby(-5.6, 500)
#### Strip.Device | Bus.Device #### Strip.Device | Bus.Device
The following properties are available The following attributes are available
- `name`: str - `name`: str
- `sr`: int - `sr`: int
@ -349,7 +355,7 @@ vm.button[55].trigger = false
### Recorder ### Recorder
The following properties accept boolean values. The following attributes accept boolean values.
- `loop`: boolean - `loop`: boolean
- `A1 - A5`: boolean - `A1 - A5`: boolean
@ -383,11 +389,11 @@ vm.recorder.load('C:\music\mytune.mp3')
### VBAN ### VBAN
- `vm.vban.enable` `vm.vban.disable` Turn VBAN on or off - `vm.vban.enable` | `vm.vban.disable` Turn VBAN on or off
##### Instream | Outstream ##### Instream | Outstream
The following properties are available. The following attributes are available.
- `on`: boolean - `on`: boolean
- `name`: string - `name`: string
@ -419,10 +425,11 @@ vm.vban.outstream[3].bit = 24
Certain 'special' commands are defined by the API as performing actions rather than setting values. The following methods are available: Certain 'special' commands are defined by the API as performing actions rather than setting values. The following methods are available:
- `show` : Bring Voiceemeter GUI to the front - `show` : Bring Voiceemeter GUI to the front
- `hide` : Hide Voicemeeter GUI
- `shutdown` : Shuts down the GUI - `shutdown` : Shuts down the GUI
- `restart` : Restart the audio engine - `restart` : Restart the audio engine
The following properties are write only and accept boolean values. The following attributes are write only and accept boolean values.
- `showvbanchat`: boolean - `showvbanchat`: boolean
- `lock`: boolean - `lock`: boolean
@ -447,7 +454,7 @@ vm.run { (0...vm.device.ins).each { |i| puts vm.device.input(i) } }
### Midi ### Midi
The following properties are available: The following attributes are available:
- `channel`: int, returns the midi channel - `channel`: int, returns the midi channel
- `current`: int, returns the current (or most recently pressed) key - `current`: int, returns the current (or most recently pressed) key
@ -511,8 +518,7 @@ current settings before loading a config. To set one you may do:
```ruby ```ruby
require "voicemeeter" require "voicemeeter"
vm = Voicemeeter::Remote.new(:banana) Voicemeeter::Remote.new(:banana).run { |vm| vm.apply_config(:example) }
vm.run { vm.apply_config(:example) }
``` ```
will load a config file at mydir/configs/banana/example.toml for Voicemeeter Banana. will load a config file at mydir/configs/banana/example.toml for Voicemeeter Banana.
@ -529,8 +535,8 @@ example:
require 'voicemeeter' require 'voicemeeter'
# Set updates to occur every 50ms # Set updates to occur every 50ms
# Listen for level updates # Listen for level updates
vm = Voicemeeter::Remote.new(:banana, ratelimit: 0.05, ldirty: true) Voicemeeter::Remote.new(:banana, ratelimit: 0.05, ldirty: true).run do
vm.run { ... } ...
``` ```
#### `vm.register`|`vm.deregister` #### `vm.register`|`vm.deregister`
@ -555,7 +561,7 @@ class App():
Use the event class to toggle updates as necessary. Use the event class to toggle updates as necessary.
The following properties are available: The following attributes are available:
- `pdirty`: boolean - `pdirty`: boolean
- `mdirty`: boolean - `mdirty`: boolean

View File

@ -110,7 +110,7 @@ module Voicemeeter
end end
def get(name, is_string = false) def get(name, is_string = false)
polling(:get, name: name) do polling(:get, name:) do
if is_string if is_string
cget = FFI::MemoryPointer.new(:string, 512, true) cget = FFI::MemoryPointer.new(:string, 512, true)
CBindings.call(:bind_get_parameter_string_a, name, cget) CBindings.call(:bind_get_parameter_string_a, name, cget)
@ -133,7 +133,7 @@ module Voicemeeter
end end
def get_buttonstatus(id, mode) def get_buttonstatus(id, mode)
polling(:get_buttonstatus, id: id, mode: mode) do polling(:get_buttonstatus, id:, mode:) do
cget = FFI::MemoryPointer.new(:float, 1) cget = FFI::MemoryPointer.new(:float, 1)
CBindings.call(:bind_macro_button_get_status, id, cget, mode) CBindings.call(:bind_macro_button_get_status, id, cget, mode)
cget.read_float.to_i cget.read_float.to_i

View File

@ -68,6 +68,16 @@ module Voicemeeter
def identifier def identifier
"bus[#{@index}].mode" "bus[#{@index}].mode"
end end
def get
sleep(@remote.delay)
%i[amix bmix repeat composite tvmix upmix21 upmix41 upmix61 centeronly lfeonly rearonly].each do |mode|
if send(mode)
return mode
end
end
:normal
end
end end
end end