Class: Pedalboard::Commands

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

Constant Summary collapse

NOTES =
[
  'c1', 'd1', 'e1',
  'f1', 'g1', 'a1'
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Commands

Returns a new instance of Commands.



10
11
12
# File 'lib/pedalboard/commands.rb', line 10

def initialize opts={}
  @pedalboard = opts.fetch(:pedalboard) { }
end

Instance Attribute Details

#pedalboardObject (readonly)

Returns the value of attribute pedalboard.



8
9
10
# File 'lib/pedalboard/commands.rb', line 8

def pedalboard
  @pedalboard
end

Instance Method Details

#midi(&block) ⇒ Object



38
39
40
41
42
# File 'lib/pedalboard/commands.rb', line 38

def midi &block
  MIDI.using(pedalboard.midi_input, pedalboard.midi_output) do
    instance_exec &block
  end
end

#next_setObject



20
21
22
23
24
# File 'lib/pedalboard/commands.rb', line 20

def next_set
  midi do
    note 'b1'
  end
end

#patch(number) ⇒ Object



14
15
16
17
18
# File 'lib/pedalboard/commands.rb', line 14

def patch number
  midi do
    note NOTES[number - 1]
  end
end

#previous_setObject



26
27
28
29
30
# File 'lib/pedalboard/commands.rb', line 26

def previous_set
  midi do
    note 'c2'
  end
end

#set_volume(value) ⇒ Object



32
33
34
35
36
# File 'lib/pedalboard/commands.rb', line 32

def set_volume value
  midi do
    cc 7, value
  end
end