Module: Portmidi

Defined in:
lib/portmidi.rb,
lib/portmidi/input.rb,
lib/portmidi/device.rb,
lib/portmidi/output.rb,
lib/portmidi/pm_map.rb,
lib/portmidi/version.rb,
lib/portmidi/exceptions.rb

Defined Under Namespace

Modules: PM_Map Classes: Device, DeviceError, Input, Output

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.devices(rescan = false) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/portmidi.rb', line 10

def self.devices(rescan = false)
  @@devices = []
  PM_Map.Pm_CountDevices.times do |i|
    di = PM_Map::DeviceInfo.new(PM_Map.Pm_GetDeviceInfo(i))
    @@devices << Device.new(i, di[:input], di[:output], di[:name])
  end
  @@devices
end

.input_devicesObject



19
20
21
# File 'lib/portmidi.rb', line 19

def self.input_devices
  self.devices.select{|device| device.type == :input }
end

.output_devicesObject



22
23
24
# File 'lib/portmidi.rb', line 22

def self.output_devices
  self.devices.select{|device| device.type == :output }
end

.startObject

this is not a very good name, but Portmidi::initialize woulda been a worse idea



27
28
29
# File 'lib/portmidi.rb', line 27

def self.start
  PM_Map.Pm_Initialize
end