unimidi 0.0.4-i386-mingw32 → 0.0.7-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +21 -9
- data/lib/unimidi/adapter/alsa-rawmidi.rb +11 -4
- data/lib/unimidi/adapter/midi-jruby.rb +26 -0
- data/lib/unimidi/adapter/midi-winmm.rb +11 -4
- data/lib/unimidi/congruous_api_adapter.rb +84 -5
- data/lib/unimidi/platform.rb +4 -3
- data/lib/unimidi.rb +1 -1
- metadata +5 -4
data/README.rdoc
CHANGED
@@ -1,22 +1,24 @@
|
|
1
1
|
= UniMIDI
|
2
2
|
|
3
|
-
Author:: Ari Russo
|
4
|
-
Copyright:: Copyright (c) 2011 Ari Russo
|
5
|
-
|
6
3
|
== Summary
|
7
4
|
|
8
|
-
|
5
|
+
Platform independent realtime MIDI input and output for Ruby.
|
9
6
|
|
10
7
|
== Features
|
11
8
|
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
9
|
+
* Platform independent. Currently Linux, JRuby, Windows and Cygwin are supported. More platforms will follow (see "to-do")
|
10
|
+
* Both input and output to and from multiple devices concurrently
|
11
|
+
* Agnostically handle different MIDI Message types (including SysEx)
|
15
12
|
|
16
13
|
== Requirements
|
17
14
|
|
15
|
+
Platform
|
16
|
+
|
17
|
+
* JRuby: {midi-jruby}[http://github.com/arirusso/midi-jruby]
|
18
18
|
* Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
|
19
|
-
* Windows/Cygwin: {midi-winmm}[
|
19
|
+
* Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
|
20
|
+
|
21
|
+
Note that if you are using JRuby you must be in 1.9 mode. This is normally accomplished by passing --1.9 to JRuby at the command line.
|
20
22
|
|
21
23
|
== Install
|
22
24
|
|
@@ -34,7 +36,17 @@ Cross-Platform, realtime MIDI input and output for Ruby
|
|
34
36
|
== Documentation
|
35
37
|
|
36
38
|
* {rdoc}[http://rdoc.info/gems/unimidi]
|
39
|
+
|
40
|
+
== To-do
|
41
|
+
|
42
|
+
* OSX (coremidirb?) implementation
|
37
43
|
|
44
|
+
== Author
|
45
|
+
|
46
|
+
{Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
|
47
|
+
|
38
48
|
== License
|
39
49
|
|
40
|
-
Apache 2.0, See the file LICENSE
|
50
|
+
Apache 2.0, See the file LICENSE
|
51
|
+
|
52
|
+
Copyright (c) 2010-2011 Ari Russo
|
@@ -1,17 +1,24 @@
|
|
1
|
+
require 'alsa-rawmidi'
|
2
|
+
|
1
3
|
module UniMIDI
|
2
4
|
|
3
5
|
module AlsaRawMIDIAdapter
|
4
6
|
|
7
|
+
class Device
|
8
|
+
extend CongruousApiAdapter::Device::ClassMethods
|
9
|
+
defer_to AlsaRawMIDI::Device
|
10
|
+
end
|
11
|
+
|
5
12
|
class Input
|
6
13
|
include CongruousApiAdapter::Device
|
7
|
-
|
8
|
-
|
14
|
+
include CongruousApiAdapter::Input
|
15
|
+
defer_to AlsaRawMIDI::Input
|
9
16
|
end
|
10
17
|
|
11
18
|
class Output
|
12
19
|
include CongruousApiAdapter::Device
|
13
|
-
|
14
|
-
|
20
|
+
include CongruousApiAdapter::Output
|
21
|
+
defer_to AlsaRawMIDI::Output
|
15
22
|
end
|
16
23
|
|
17
24
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'midi-jruby'
|
2
|
+
|
3
|
+
module UniMIDI
|
4
|
+
|
5
|
+
module AlsaRawMIDIAdapter
|
6
|
+
|
7
|
+
class Device
|
8
|
+
extend CongruousApiAdapter::Device::ClassMethods
|
9
|
+
defer_to MIDIJRuby::Device
|
10
|
+
end
|
11
|
+
|
12
|
+
class Input
|
13
|
+
include CongruousApiAdapter::Device
|
14
|
+
include CongruousApiAdapter::Input
|
15
|
+
defer_to MIDIJRuby::Input
|
16
|
+
end
|
17
|
+
|
18
|
+
class Output
|
19
|
+
include CongruousApiAdapter::Device
|
20
|
+
include CongruousApiAdapter::Output
|
21
|
+
defer_to MIDIJRuby::Output
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -1,17 +1,24 @@
|
|
1
|
+
require 'midi-winmm'
|
2
|
+
|
1
3
|
module UniMIDI
|
2
4
|
|
3
5
|
module MIDIWinMMAdapter
|
4
6
|
|
7
|
+
class Device
|
8
|
+
extend CongruousApiAdapter::Device::ClassMethods
|
9
|
+
defer_to MIDIWinMM::Device
|
10
|
+
end
|
11
|
+
|
5
12
|
class Input
|
6
13
|
include CongruousApiAdapter::Device
|
7
|
-
|
8
|
-
|
14
|
+
include CongruousApiAdapter::Input
|
15
|
+
defer_to MIDIWinMM::Input
|
9
16
|
end
|
10
17
|
|
11
18
|
class Output
|
12
19
|
include CongruousApiAdapter::Device
|
13
|
-
|
14
|
-
|
20
|
+
include CongruousApiAdapter::Output
|
21
|
+
defer_to MIDIWinMM::Output
|
15
22
|
end
|
16
23
|
|
17
24
|
end
|
@@ -8,23 +8,102 @@ module UniMIDI
|
|
8
8
|
@device = device_obj
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def open(*a, &block)
|
12
|
+
begin
|
13
|
+
@device.open(*a)
|
14
|
+
block.call(self)
|
15
|
+
ensure
|
16
|
+
close
|
17
|
+
end
|
13
18
|
end
|
14
19
|
|
20
|
+
def close(*a)
|
21
|
+
@device.close(*a)
|
22
|
+
end
|
23
|
+
|
15
24
|
def self.included(base)
|
16
25
|
base.send(:attr_reader, :device)
|
17
26
|
end
|
18
27
|
|
19
28
|
module ClassMethods
|
29
|
+
|
30
|
+
def first
|
31
|
+
new(device_class.first)
|
32
|
+
end
|
33
|
+
|
34
|
+
def last
|
35
|
+
new(device_class.last)
|
36
|
+
end
|
37
|
+
|
38
|
+
def all
|
39
|
+
device_class.all.map { |d| new(d) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def all_by_type
|
43
|
+
{
|
44
|
+
:input => device_class.all_by_type[:input].map { |d| new(d) },
|
45
|
+
:output => device_class.all_by_type[:output].map { |d| new(d) }
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def defer_to(klass)
|
50
|
+
const_set("DeferToClass", klass)
|
51
|
+
end
|
52
|
+
|
20
53
|
def device_class
|
21
|
-
const_get("
|
54
|
+
const_get("DeferToClass")
|
22
55
|
end
|
23
56
|
|
24
|
-
|
25
|
-
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
module Input
|
62
|
+
|
63
|
+
def self.included(base)
|
64
|
+
base.extend(Device::ClassMethods)
|
65
|
+
base.extend(ClassMethods)
|
66
|
+
end
|
67
|
+
|
68
|
+
def gets(*a)
|
69
|
+
@device.gets(*a)
|
70
|
+
end
|
71
|
+
|
72
|
+
def gets_bytestr(*a)
|
73
|
+
@device.gets_bytestr(*a)
|
74
|
+
end
|
75
|
+
|
76
|
+
module ClassMethods
|
77
|
+
|
78
|
+
def self.all
|
79
|
+
device_class.all_by_type[:input].map { |d| new(d) }
|
26
80
|
end
|
81
|
+
|
82
|
+
end
|
27
83
|
|
84
|
+
end
|
85
|
+
|
86
|
+
module Output
|
87
|
+
|
88
|
+
def self.included(base)
|
89
|
+
base.extend(Device::ClassMethods)
|
90
|
+
base.extend(ClassMethods)
|
91
|
+
end
|
92
|
+
|
93
|
+
def puts(*a)
|
94
|
+
@device.puts(*a)
|
95
|
+
end
|
96
|
+
|
97
|
+
def puts_bytestr(*a)
|
98
|
+
@device.puts_bytestr(*a)
|
99
|
+
end
|
100
|
+
|
101
|
+
module ClassMethods
|
102
|
+
|
103
|
+
def self.all
|
104
|
+
device_class.all_by_type[:output].map { |d| new(d) }
|
105
|
+
end
|
106
|
+
|
28
107
|
end
|
29
108
|
|
30
109
|
end
|
data/lib/unimidi/platform.rb
CHANGED
@@ -10,16 +10,17 @@ module UniMIDI
|
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
lib = case RUBY_PLATFORM
|
13
|
+
when /java/ then 'midi-jruby'
|
13
14
|
when /linux/ then 'alsa-rawmidi'
|
14
|
-
when /win/ then 'midi-winmm'
|
15
15
|
when /mingw/ then 'midi-winmm' #cygwin
|
16
|
+
when /win/ then 'midi-winmm'
|
16
17
|
end
|
17
|
-
require(lib)
|
18
18
|
require("unimidi/adapter/#{lib}")
|
19
19
|
@interface = case RUBY_PLATFORM
|
20
|
+
when /java/ then MIDIJRuby
|
20
21
|
when /linux/ then AlsaRawMIDIAdapter
|
21
|
-
when /win/ then MIDIWinMMAdapter
|
22
22
|
when /mingw/ then MIDIWinMMAdapter #cygwin
|
23
|
+
when /win/ then MIDIWinMMAdapter
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
data/lib/unimidi.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimidi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: i386-mingw32
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-04-
|
12
|
+
date: 2011-04-24 00:00:00.000000000 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: midi-winmm
|
17
|
-
requirement: &
|
17
|
+
requirement: &21157896 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *21157896
|
26
26
|
description: Cross-Platform, realtime MIDI input and output for Ruby.
|
27
27
|
email:
|
28
28
|
- ari.russo@gmail.com
|
@@ -31,6 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/unimidi/adapter/alsa-rawmidi.rb
|
34
|
+
- lib/unimidi/adapter/midi-jruby.rb
|
34
35
|
- lib/unimidi/adapter/midi-winmm.rb
|
35
36
|
- lib/unimidi/congruous_api_adapter.rb
|
36
37
|
- lib/unimidi/platform.rb
|