Class: SMF::VirtualTrack

Inherits:
Track
  • Object
show all
Defined in:
lib/smf/toy/virtual.rb

Instance Method Summary collapse

Methods inherited from Track

#&, #*, #+, #-, #<<, #==, #>>, #concat!, #divert, #each, #eql?, #hash, #nevts, #nitems, #replace, #sort, #sort!, #sort_by, #to_virtual, #|

Constructor Details

#initializeVirtualTrack

Returns a new instance of VirtualTrack.



88
89
90
# File 'lib/smf/toy/virtual.rb', line 88

def initialize()
  super()
end

Instance Method Details

#to_realObject



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/smf/toy/virtual.rb', line 92

def to_real
  r = Track.new
  each do |ev|
	case ev
	when VirtualNote
	  r << NoteOn.new(ev.offset, ev.ch, ev.note, ev.vel)
	  r << NoteOff.new(ev.offset + ev.length, ev.ch, ev.note, ev.offvel)
	else
	  r << ev
	end
  end
  r
end