Module: MIDIWinMM::Map
- Extended by:
- FFI::Library
- Defined in:
- lib/midi-winmm/map.rb
Overview
Module containing C function and struct binding for the WinMM driver interface library
Defined Under Namespace
Classes: MIDIEvent, MIDIHdr, MIDIInputInfo, MIDIOutputInfo
Constant Summary collapse
- HeaderFlags =
{ 0x00000001 => :done, 0x00000002 => :prepared, 0x00000004 => :inqueue, 0x00000008 => :isstream }
- CallbackMessageTypes =
{ 0x3C1 => :input_open, 0x3C2 => :input_close, 0x3C3 => :input_data, 0x3C4 => :input_long_data, 0x3C5 => :input_error, 0x3C6 => :input_long_error, 0x3C7 => :output_open, 0x3C8 => :output_close, 0x3C9 => :output_data, 0x3CC => :output_more_data }
- Errors =
{ 1 => "Unspecified", 2 => "Bad Device ID", 3 => "Not Enabled", 4 => "Allocation", 5 => "Invalid Handle", 6 => "No Driver", 7 => "No Memory", 8 => "Not Supported", 9 => "Bad Error Number", 10 => "Invalid Flag", 11 => "Invalid Parameter", 12 => "Handle Busy", 13 => "Invalid Alias" }
- DeviceInfo =
{ :input => MIDIInputInfo, :output => MIDIOutputInfo }
Class Method Summary collapse
-
.cfunc(type, funcname, *args) ⇒ Object
shortcut for calling winmm midi functions.
- .error(num) ⇒ Object
- .error?(num) ⇒ Boolean
- .winmm_func(name, *args) ⇒ Object
Class Method Details
.cfunc(type, funcname, *args) ⇒ Object
shortcut for calling winmm midi functions
207 208 209 210 211 212 213 |
# File 'lib/midi-winmm/map.rb', line 207 def self.cfunc(type, funcname, *args) t = type.to_s.gsub(/put/,'') # convert output to out, input to in name = funcname.to_s name[0] = name[0,1].upcase # capitalize t[0] = t[0,1].upcase # capitalize self.send("midi#{t}#{name}", *args) end |
.error(num) ⇒ Object
224 225 226 |
# File 'lib/midi-winmm/map.rb', line 224 def self.error(num) Map::Errors[num] end |
.error?(num) ⇒ Boolean
220 221 222 |
# File 'lib/midi-winmm/map.rb', line 220 def self.error?(num) !Map::Errors[num].nil? end |
.winmm_func(name, *args) ⇒ Object
215 216 217 218 |
# File 'lib/midi-winmm/map.rb', line 215 def self.winmm_func(name, *args) status = self.send(name, *args) raise "#{name.to_s}: #{error(status)}" if error?(status) end |