Class: SurfaceMaster::TouchOSC::Device

Inherits:
Device
  • Object
show all
Defined in:
lib/surface_master/touch_osc/device.rb

Overview

Low-level interface to TouchOSC Bridge

Instance Method Summary collapse

Methods inherited from Device

#close, #closed?, #input_enabled?, #output_enabled?

Methods included from Logging

#logger, #logger=

Constructor Details

#initialize(opts = nil, &mapper) ⇒ Device

Returns a new instance of Device.



5
6
7
8
9
# File 'lib/surface_master/touch_osc/device.rb', line 5

def initialize(opts = nil, &mapper)
  @name = "TouchOSC Bridge"
  super(opts)
  @mapper = mapper || proc { |input| input }
end

Instance Method Details

#readObject



13
14
15
16
17
# File 'lib/surface_master/touch_osc/device.rb', line 13

def read
  super
    .map { |input| @mapper.call(input) }
    .compact
end

#reset!Object



11
# File 'lib/surface_master/touch_osc/device.rb', line 11

def reset!; end

#write(messages) ⇒ Object



19
20
21
# File 'lib/surface_master/touch_osc/device.rb', line 19

def write(messages)
  @output.write(Array(messages))
end