class Shmidi::Led

Constants

CTYPE

Public Class Methods

new(socket, channel, note, turned_on = false) click to toggle source
Calls superclass method Shmidi::Control::new
# File lib/shmidi/controls/led.rb, line 6
def initialize(socket, channel, note, turned_on = false)
  super(socket, channel, note)
  init(turned_on)
end

Public Instance Methods

init(turned_on = false) click to toggle source
# File lib/shmidi/controls/led.rb, line 11
def init(turned_on = false)
  @turned_on = false
  @__turn_on_event = Event.new_on(@channel, @note)
  @__turn_off_event = Event.new_off(@channel, @note)
  turn_on if turned_on
end
on?() click to toggle source
# File lib/shmidi/controls/led.rb, line 22
def on?
  !!@turned_on
end
reset() click to toggle source
# File lib/shmidi/controls/led.rb, line 18
def reset
  turn_off
end
turn_off(clock = nil) click to toggle source
# File lib/shmidi/controls/led.rb, line 31
def turn_off(clock = nil)
  (clock && clock.sync(@__turn_off_event)) || socket.push(@__turn_off_event)
  @turned_on = false
end
turn_on(clock = nil) click to toggle source
# File lib/shmidi/controls/led.rb, line 26
def turn_on(clock = nil)
  (clock && clock.sync(@__turn_on_event)) || socket.push(@__turn_on_event)
  @turned_on = true
end