Class: JSound::Midi::Devices::InputDevice::Bridge

Inherits:
JSound::Midi::Device show all
Defined in:
lib/jsound/midi/devices/input_device.rb

Overview

A subcomponent of JSound::Midi::Devices::InputDevice that implements javax.sound.midi.Receiver by translating incoming Java MIDI Messages to Ruby Messages.

Instance Method Summary collapse

Methods inherited from JSound::Midi::Device

#<=, #>>, #close, #message, #open, #open?, #output, #output=, #to_s, #type

Methods included from TypeFromClassName

included

Constructor Details

#initialize(source_device) ⇒ Bridge

Returns a new instance of Bridge.



32
33
34
# File 'lib/jsound/midi/devices/input_device.rb', line 32

def initialize(source_device)
  @source_device = source_device
end

Instance Method Details

#send(java_message, timestamp = -1)) ⇒ Object

Receives incoming Java MIDI Messages, converts them to Ruby Messages, and sends them to any connected devices.



38
39
40
41
42
43
# File 'lib/jsound/midi/devices/input_device.rb', line 38

def send(java_message, timestamp=-1)
  self.message Message.from_java(java_message, :source => @source_device)
rescue
  STDERR.puts $! if $DEBUG # otherwise this can get swallowed
  raise
end