Class: Moc::Controller::Toggle
- Inherits:
-
Object
- Object
- Moc::Controller::Toggle
- Defined in:
- lib/moc/controller/toggle.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#equalizer ⇒ Object
toggle equalizer.
-
#initialize(controller) ⇒ Toggle
constructor
A new instance of Toggle.
-
#mixer_channel ⇒ Object
toggle mixer channel.
-
#mono ⇒ Object
toggle mono.
-
#off(name) ⇒ Object
deactivate the named item.
-
#on(name) ⇒ Object
activate the named item.
-
#on?(name) ⇒ Boolean
check if an item is active.
-
#pause ⇒ Object
toggle the pause status.
-
#soft_mixer ⇒ Object
toggle soft mixer.
-
#toggle(name) ⇒ Object
toggle the named item.
Constructor Details
#initialize(controller) ⇒ Toggle
Returns a new instance of Toggle.
16 17 18 |
# File 'lib/moc/controller/toggle.rb', line 16 def initialize (controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
14 15 16 |
# File 'lib/moc/controller/toggle.rb', line 14 def controller @controller end |
Instance Method Details
#equalizer ⇒ Object
toggle equalizer
103 104 105 106 107 |
# File 'lib/moc/controller/toggle.rb', line 103 def equalizer controller.send_command :toggle_equalizer self end |
#mixer_channel ⇒ Object
toggle mixer channel
89 90 91 92 93 |
# File 'lib/moc/controller/toggle.rb', line 89 def mixer_channel controller.send_command :toggle_mixer_channel self end |
#mono ⇒ Object
toggle mono
110 111 112 113 114 |
# File 'lib/moc/controller/toggle.rb', line 110 def mono controller.send_command :toggle_mono self end |
#off(name) ⇒ Object
deactivate the named item
44 45 46 47 48 49 50 |
# File 'lib/moc/controller/toggle.rb', line 44 def off (name) controller.send_command :set_option controller.send_string name controller.send_integer 0 self end |
#on(name) ⇒ Object
activate the named item
35 36 37 38 39 40 41 |
# File 'lib/moc/controller/toggle.rb', line 35 def on (name) controller.send_command :set_option controller.send_string name controller.send_integer 1 self end |
#on?(name) ⇒ Boolean
check if an item is active
53 54 55 56 57 58 |
# File 'lib/moc/controller/toggle.rb', line 53 def on? (name) controller.send_command :get_option controller.send_string name !controller.get_integer.zero? end |
#pause ⇒ Object
toggle the pause status
81 82 83 84 85 86 |
# File 'lib/moc/controller/toggle.rb', line 81 def pause controller.send_command :get_state controller.send_command controller.get_state == :pause ? :unpause : :pause self end |
#soft_mixer ⇒ Object
toggle soft mixer
96 97 98 99 100 |
# File 'lib/moc/controller/toggle.rb', line 96 def soft_mixer controller.send_command :toggle_softmixer self end |
#toggle(name) ⇒ Object
toggle the named item
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/moc/controller/toggle.rb', line 21 def toggle (name) controller.send_command :get_option controller.send_string name value = !controller.get_integer.zero? controller.send_command :set_option controller.send_string name controller.send_integer value ? 0 : 1 self end |