class Fluent::MIDIOutput

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_midi.rb, line 7
def initialize
  super
  require 'rtmidi'
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_midi.rb, line 12
def configure(conf)
  super
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_midi.rb, line 27
def emit(tag, es, chain)
  chain.next
  es.each do |time, record|
    status   = record['status']   || 0x90 # note on
    note     = record['note']     || 0
    velocity = record['velocity'] || 0
    duration = record['duration']

    @output.send_channel_message(status, note, velocity)
    if duration
      sleep duration
      @output.send_channel_message(status, note, 0)
    end
  end
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_midi.rb, line 22
def shutdown
  super
  @output.close_port
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_midi.rb, line 16
def start
  super
  @output = RtMidi::Out.new
  @output.open_port(@port)
end