Class: Pedalboard::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/pedalboard/device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Device

Returns a new instance of Device.



9
10
11
12
13
14
15
# File 'lib/pedalboard/device.rb', line 9

def initialize opts={}
  @components = []
  @connection = opts.fetch(:connection) { Dino::TxRx::Serial.new }
  @board = opts.fetch(:board) { Dino::Board.new(connection) }
  @midi_output = opts.fetch(:midi_output) { UniMIDI::Output.gets }
  @midi_input = opts.fetch(:midi_input) { UniMIDI::Input.gets }
end

Instance Attribute Details

#boardObject (readonly)

Returns the value of attribute board.



7
8
9
# File 'lib/pedalboard/device.rb', line 7

def board
  @board
end

#componentsObject (readonly)

Returns the value of attribute components.



7
8
9
# File 'lib/pedalboard/device.rb', line 7

def components
  @components
end

#midi_inputObject (readonly)

Returns the value of attribute midi_input.



7
8
9
# File 'lib/pedalboard/device.rb', line 7

def midi_input
  @midi_input
end

#midi_outputObject (readonly)

Returns the value of attribute midi_output.



7
8
9
# File 'lib/pedalboard/device.rb', line 7

def midi_output
  @midi_output
end

Instance Method Details

#add_component(type, opts = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/pedalboard/device.rb', line 17

def add_component type, opts={}
  opts[:pedalboard] = self
  component =  eval(component_class(type))
    .new(opts)
  components << component
  component
end