Class: Voicemeeter::Button::Base

Inherits:
Object
  • Object
show all
Includes:
ButtonColorMixin, IRemote, Logging
Defined in:
lib/voicemeeter/button.rb

Overview

Base class for Button

Instance Method Summary collapse

Methods included from ButtonColorMixin

#color, #color=, #identifier

Methods included from IRemote

#apply, #initialize, #to_s

Methods included from Logging

#logger

Instance Method Details

#getter(mode) ⇒ Object



35
36
37
38
# File 'lib/voicemeeter/button.rb', line 35

def getter(mode)
  logger.debug "getter: button[#{@index}].#{ButtonEnum.identifier(mode)}"
  @remote.get_buttonstatus(@index, mode)
end

#setter(mode, val) ⇒ Object



40
41
42
43
# File 'lib/voicemeeter/button.rb', line 40

def setter(mode, val)
  logger.debug "setter: button[#{@index}].#{ButtonEnum.identifier(mode)}=#{val}"
  @remote.set_buttonstatus(@index, mode, val)
end

#stateObject



45
46
47
# File 'lib/voicemeeter/button.rb', line 45

def state
  getter(ButtonEnum::STATE) == 1
end

#state=(value) ⇒ Object



49
50
51
# File 'lib/voicemeeter/button.rb', line 49

def state=(value)
  setter(ButtonEnum::STATE, value && 1 || 0)
end

#stateonlyObject



53
54
55
# File 'lib/voicemeeter/button.rb', line 53

def stateonly
  getter(ButtonEnum::STATEONLY) == 1
end

#stateonly=(value) ⇒ Object



57
58
59
# File 'lib/voicemeeter/button.rb', line 57

def stateonly=(value)
  setter(ButtonEnum::STATEONLY, value && 1 || 0)
end

#triggerObject



61
62
63
# File 'lib/voicemeeter/button.rb', line 61

def trigger
  getter(ButtonEnum::TRIGGER) == 1
end

#trigger=(value) ⇒ Object



65
66
67
# File 'lib/voicemeeter/button.rb', line 65

def trigger=(value)
  setter(ButtonEnum::TRIGGER, value && 1 || 0)
end