Class: Zgomot::Drivers::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/zgomot/drivers/driver.rb

Direct Known Subclasses

CoreMidi

Constant Summary collapse

ON =

MIDI commands


Note on

0x90
OFF =

Note off

0x80
PA =

Polyphonic aftertouch

0xa0
CC =

Control change

0xb0
PC =

Program change

0xc0
CA =

Channel aftertouch

0xd0
PB =

Pitch bend

0xe0

Instance Method Summary collapse

Constructor Details

#initializeDriver

Returns a new instance of Driver.



29
30
31
# File 'lib/zgomot/drivers/driver.rb', line 29

def initialize
  open
end

Instance Method Details

#aftertouch(note, channel, pressure) ⇒ Object



41
42
43
# File 'lib/zgomot/drivers/driver.rb', line 41

def aftertouch(note, channel, pressure)
  write(PA | channel, note, pressure)
end

#channel_aftertouch(channel, pressure) ⇒ Object



53
54
55
# File 'lib/zgomot/drivers/driver.rb', line 53

def channel_aftertouch(channel, pressure)
  write(CA | channel, pressure)
end

#closeObject


Driver API


Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/zgomot/drivers/driver.rb', line 64

def close
  raise NotImplementedError, "You must implement #close in your driver."
end

#control_change(number, channel, value) ⇒ Object



45
46
47
# File 'lib/zgomot/drivers/driver.rb', line 45

def control_change(number, channel, value)
  write(CC | channel, number, value)
end

#note_off(note, channel, velocity = 0) ⇒ Object



37
38
39
# File 'lib/zgomot/drivers/driver.rb', line 37

def note_off(note, channel, velocity = 0)
  write(OFF | channel, note, velocity)
end

#note_on(note, channel, velocity) ⇒ Object



33
34
35
# File 'lib/zgomot/drivers/driver.rb', line 33

def note_on(note, channel, velocity)
  write(ON | channel, note, velocity)
end

#pitch_bend(channel, value) ⇒ Object



57
58
59
# File 'lib/zgomot/drivers/driver.rb', line 57

def pitch_bend(channel, value)
  write(PB | channel, value)
end

#program_change(channel, program) ⇒ Object



49
50
51
# File 'lib/zgomot/drivers/driver.rb', line 49

def program_change(channel, program)
  write(PC | channel, program)
end

#write(*args) ⇒ Object

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/zgomot/drivers/driver.rb', line 68

def write(*args)
  raise NotImplementedError, "You must implement #write in your driver."
end