Module: JSound::Midi

Defined in:
lib/jsound/midi.rb,
lib/jsound/midi/device.rb,
lib/jsound/midi/message.rb,
lib/jsound/midi/device_list.rb,
lib/jsound/midi/devices/jdevice.rb,
lib/jsound/midi/devices/monitor.rb,
lib/jsound/midi/message_builder.rb,
lib/jsound/midi/devices/recorder.rb,
lib/jsound/midi/messages/note_on.rb,
lib/jsound/midi/devices/generator.rb,
lib/jsound/midi/messages/note_off.rb,
lib/jsound/midi/devices/transformer.rb,
lib/jsound/midi/messages/pitch_bend.rb,
lib/jsound/midi/devices/input_device.rb,
lib/jsound/midi/devices/output_device.rb,
lib/jsound/midi/messages/poly_pressure.rb,
lib/jsound/midi/messages/control_change.rb,
lib/jsound/midi/messages/program_change.rb,
lib/jsound/midi/messages/channel_pressure.rb

Overview

Module containing all MIDI functionality.

Also provies the core interface for accessing MIDI devices, see the device list constants defined here.

Defined Under Namespace

Modules: Devices, MessageBuilder, Messages Classes: Device, DeviceList, Message

Constant Summary collapse

DEVICES =

All MIDI devices

Returns:

DeviceList.new
INPUTS =

MIDI input devices

Returns:

DeviceList.new
OUTPUTS =

MIDI output devices

Returns:

DeviceList.new
SYNTHESIZERS =

MIDI synthesizer devices

Returns:

SYNTHS = DeviceList.new
SEQUENCERS =

MIDI sequencer devices

Returns:

DeviceList.new

Class Method Summary collapse

Class Method Details

.DeviceList(*devices) ⇒ Object



170
171
172
# File 'lib/jsound/midi/device_list.rb', line 170

def DeviceList(*devices)
  DeviceList.new(devices)
end

.refresh_devicesObject

Note:

this happens automatically when JSound is required.

Refresh the list of connected devices.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/jsound/midi.rb', line 55

def refresh_devices
  [DEVICES,INPUTS,OUTPUTS,SYNTHESIZERS,SEQUENCERS].each{|collection| collection.clear}
  MidiSystem.getMidiDeviceInfo.each do |device_info| 
    java_device = MidiSystem.getMidiDevice(device_info)
    device = Devices::JDevice.from_java(java_device)
    case device.type
    when :sequencer   then SEQUENCERS   << device
    when :synthesizer then SYNTHESIZERS << device
    when :input       then INPUTS       << device
    when :output      then OUTPUTS      << device
    end 
    DEVICES << device    
  end
  DEVICES
end