4 each_byte{|x| arr << x}
19 to_i != 0 || %w{true t yes y}.include?( self.downcase )
32 def initialize( file )
36 # send and receive a sysex message
37 # after wrapping in the header and the eox byte
39 puts "Mackie write: #{msg.unpack('C*').to_hex.inspect}"
42 puts "Mackie response: #{response.to_hex.inspect}"
46 # returns an array of bytes
49 while ( nc = @file.read( 1 ) )[0] != 0xf7
55 # send and flush a sysex message
56 # after wrapping in the header and the eox byte
57 def write_sysex( msg )
58 @file.write( hdrlc + msg + "\xf7" )
67 def translate_seven_segment( char )
78 # display the msg (which can be only 2 characters)
79 # append the number of stops. Options are '..', '. ', '. ', ' '
80 def two_char( msg, stops = ' ' )
82 two << translate_seven_segment( msg.upcase[0] )
83 two << translate_seven_segment( msg.upcase[1] )
85 two[0] += 0x40 if stops[0] == '.'[0]
86 two[1] += 0x40 if stops[1] == '.'[0]
88 midi_msg = [0xb0, 0x4a, two[1], 0x4b, two[0] ]
89 write midi_msg.pack( 'C*' )
92 # send and receive the device initialisation
94 response = sysex( "\x00" )
96 # decode host connection query
98 raise( "expected 01, got " + response.inspect ) if status != 1
100 serial = response[1..7]
101 challenge = response[8..11]
103 # send host connection reply
104 reply = "\x02" + serial.pack('C*') + challenge.pack('C*')
105 response = sysex reply
107 # decode host connection confirmation
109 raise ( "expected 03, got " + response.inspect ) if status != 3
113 "\xf0\x00\x00\x66\x10"
117 "\xf0\x00\x00\x66\x11"