Class: SMF::ScaleTuningAdjust2ByteFormRealTime

Inherits:
ExclusiveF0 show all
Defined in:
lib/smf/toy/gm.rb

Instance Attribute Summary

Attributes inherited from ExclusiveF0

#data

Attributes inherited from Event

#offset

Instance Method Summary collapse

Methods inherited from ExclusiveF0

#==

Methods inherited from Event

#<=>, #==, #eql?, #hash

Constructor Details

#initialize(offset, ch, ss_tt, dev = 0x7f) ⇒ ScaleTuningAdjust2ByteFormRealTime

Returns a new instance of ScaleTuningAdjust2ByteFormRealTime.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/smf/toy/gm.rb', line 250

def initialize(offset, ch, ss_tt, dev=0x7f)
  # ch:0/2**16-1, ss_tt:-2**13/2**13-1
  ff = ch & 0x3
  gg = (ch >> 2) & 0x7f
  hh = (ch >> 9) & 0x7f
  ss_tt.collect! do |x|
  x += 0x2000
  ss =  x       & 0x7f
  tt = (x >> 7) & 0x7f
  [ss, tt]
  end
  super(offset, [0x7f, dev, 0x08, 0x09, ff, gg, hh, ss_tt, 0xf7].
   flatten.pack('C*'))
end