class MTK::IO::JSoundOutput
Provides realtime MIDI
output for JRuby via the jsound and gamelan gems. @note This class is optional and only available if you require ‘mtk/midi/jsound_output’.
It depends on the 'jsound' and 'gamelan' gems.
Public Class Methods
devices()
click to toggle source
# File lib/mtk/io/jsound_output.rb, line 13 def self.devices @devices ||= ::JSound::Midi::OUTPUTS.devices end
devices_by_name()
click to toggle source
# File lib/mtk/io/jsound_output.rb, line 17 def self.devices_by_name @devices_by_name ||= devices.each_with_object( Hash.new ){|device,hash| hash[device.description] = device } end
new(device, options={})
click to toggle source
# File lib/mtk/io/jsound_output.rb, line 22 def initialize(device, options={}) @device = device # and create an object for generating MIDI message to send to the output: @generator = ::JSound::Midi::Devices::Generator.new if options[:monitor] @monitor = ::JSound::Midi::Devices::Monitor.new @generator >> [@monitor, @device] else @generator >> @device end @device.open end
Public Instance Methods
name()
click to toggle source
# File lib/mtk/io/jsound_output.rb, line 37 def name @device.description end
Protected Instance Methods
bend(midi_value, channel)
click to toggle source
(see MIDIOutput#bend
)
# File lib/mtk/io/jsound_output.rb, line 70 def bend(midi_value, channel) @generator.pitch_bend(midi_value, channel) end
channel_pressure(midi_value, channel)
click to toggle source
(see MIDIOutput#channel_pressure
)
# File lib/mtk/io/jsound_output.rb, line 60 def channel_pressure(midi_value, channel) @generator.channel_pressure(midi_value, channel) end
control(number, midi_value, channel)
click to toggle source
(see MIDIOutput#control
)
# File lib/mtk/io/jsound_output.rb, line 55 def control(number, midi_value, channel) @generator.control_change(number, midi_value, channel) end
note_off(pitch, velocity, channel)
click to toggle source
(see MIDIOutput#note_off
)
# File lib/mtk/io/jsound_output.rb, line 50 def note_off(pitch, velocity, channel) @generator.note_off(pitch, velocity, channel) end
note_on(pitch, velocity, channel)
click to toggle source
(see MIDIOutput#note_on
)
# File lib/mtk/io/jsound_output.rb, line 45 def note_on(pitch, velocity, channel) @generator.note_on(pitch, velocity, channel) end
poly_pressure(pitch, midi_value, channel)
click to toggle source
(see MIDIOutput#poly_pressure
)
# File lib/mtk/io/jsound_output.rb, line 65 def poly_pressure(pitch, midi_value, channel) @generator.poly_pressure(pitch, midi_value, channel) end
program(number, channel)
click to toggle source
(see MIDIOutput#program
)
# File lib/mtk/io/jsound_output.rb, line 75 def program(number, channel) @generator.program_change(number, channel) end