Class: MIDIator::Driver

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

Direct Known Subclasses

ALSA, CoreMIDI, DLSSynth, Mmj, WinMM

Defined Under Namespace

Classes: ALSA, CoreMIDI, DLSSynth, Mmj, WinMM

Constant Summary collapse

ON =

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDriver

Do any pre-open setup necessary. Often will not be overridden.



69
70
71
# File 'lib/midiator/driver.rb', line 69

def initialize
  open
end

Class Method Details

.inherited(driver_class) ⇒ Object

Auto-registers subclasses of MIDIator::Driver with the driver registry.



55
56
57
58
# File 'lib/midiator/driver.rb', line 55

def self::inherited( driver_class )
  driver_name = driver_class.to_s.underscore
  MIDIator::DriverRegistry.instance.register( driver_name, driver_class )
end

Instance Method Details

#aftertouch(note, channel, pressure) ⇒ Object

Shortcut to send a polyphonic aftertouch message for an individual note.



87
88
89
# File 'lib/midiator/driver.rb', line 87

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

#channel_aftertouch(channel, pressure) ⇒ Object

Shortcut to send a channel aftertouch message.



105
106
107
# File 'lib/midiator/driver.rb', line 105

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

#control_change(number, channel, value) ⇒ Object

Shortcut to send a control change.



93
94
95
# File 'lib/midiator/driver.rb', line 93

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

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

Shortcut to send a note_off message.



81
82
83
# File 'lib/midiator/driver.rb', line 81

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

#note_on(note, channel, velocity) ⇒ Object

Shortcut to send a note_on message.



75
76
77
# File 'lib/midiator/driver.rb', line 75

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

#pitch_bend(channel, value) ⇒ Object Also known as: bend

Shortcut to send a pitch bend message.



111
112
113
# File 'lib/midiator/driver.rb', line 111

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

#program_change(channel, program) ⇒ Object

Shortcut to send a program_change message.



99
100
101
# File 'lib/midiator/driver.rb', line 99

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