unimidi 0.0.2-i686-linux → 0.0.5-i686-linux

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,17 +1,14 @@
1
1
  = UniMIDI
2
2
 
3
- Author:: Ari Russo
4
- Copyright:: Copyright (c) 2011 Ari Russo
5
-
6
3
  == Summary
7
4
 
8
- Realtime MIDI input and output for Ruby
5
+ Platform independent realtime MIDI input and output for Ruby.
9
6
 
10
7
  == Features
11
8
 
12
- * Multiple platforms supported (currently Linux, Windows/Cygwin, more to follow)
13
- * Handle both input and output
14
- * Supports messaging to and from multiple devices concurrently
9
+ * Platform independent. Currently Linux, 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
 
@@ -34,7 +31,18 @@ Realtime MIDI input and output for Ruby
34
31
  == Documentation
35
32
 
36
33
  * {rdoc}[http://rdoc.info/gems/unimidi]
34
+
35
+ == To-do
36
+
37
+ * JRuby implementation
38
+ * OSX
37
39
 
40
+ == Author
41
+
42
+ {Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
43
+
38
44
  == License
39
45
 
40
- Apache 2.0, See the file LICENSE
46
+ Apache 2.0, See the file LICENSE
47
+
48
+ Copyright (c) 2010-2011 Ari Russo
data/lib/unimidi.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  #
5
5
  module UniMIDI
6
6
 
7
- VERSION = "0.0.2"
7
+ VERSION = "0.0.5"
8
8
 
9
9
  end
10
10
 
@@ -14,4 +14,4 @@ require 'unimidi/platform'
14
14
  module UniMIDI
15
15
  extend(Platform.instance.interface)
16
16
  include(Platform.instance.interface)
17
- end
17
+ end
@@ -2,16 +2,21 @@ module UniMIDI
2
2
 
3
3
  module AlsaRawMIDIAdapter
4
4
 
5
+ class Device
6
+ extend CongruousApiAdapter::Device::ClassMethods
7
+ defer_to AlsaRawMIDI::Device
8
+ end
9
+
5
10
  class Input
6
11
  include CongruousApiAdapter::Device
7
- extend CongruousApiAdapter::Device::ClassMethods
8
- DeviceClass = ::AlsaRawMIDI::Input
12
+ include CongruousApiAdapter::Input
13
+ defer_to AlsaRawMIDI::Input
9
14
  end
10
15
 
11
16
  class Output
12
17
  include CongruousApiAdapter::Device
13
- extend CongruousApiAdapter::Device::ClassMethods
14
- DeviceClass = ::AlsaRawMIDI::Output
18
+ include CongruousApiAdapter::Output
19
+ defer_to AlsaRawMIDI::Output
15
20
  end
16
21
 
17
22
  end
@@ -2,16 +2,21 @@ module UniMIDI
2
2
 
3
3
  module MIDIWinMMAdapter
4
4
 
5
+ class Device
6
+ extend CongruousApiAdapter::Device::ClassMethods
7
+ defer_to MIDIWinMM::Device
8
+ end
9
+
5
10
  class Input
6
11
  include CongruousApiAdapter::Device
7
- extend CongruousApiAdapter::Device::ClassMethods
8
- DeviceClass = ::MIDIWinMM::Input
12
+ include CongruousApiAdapter::Input
13
+ defer_to MIDIWinMM::Input
9
14
  end
10
15
 
11
16
  class Output
12
17
  include CongruousApiAdapter::Device
13
- extend CongruousApiAdapter::Device::ClassMethods
14
- DeviceClass = ::MIDIWinMM::Output
18
+ include CongruousApiAdapter::Output
19
+ defer_to MIDIWinMM::Output
15
20
  end
16
21
 
17
22
  end
@@ -8,27 +8,85 @@ module UniMIDI
8
8
  @device = device_obj
9
9
  end
10
10
 
11
- def method_missing(method, *args, &block)
12
- @device.send(method, *args, &block)
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
20
- def device_class
21
- const_get("DeviceClass")
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
+ end
45
+
46
+ def defer_to(klass)
47
+ const_set("DeferToClass", klass)
22
48
  end
23
49
 
24
- def method_missing(method, *args, &block)
25
- device_class.send(method, *args, &block)
50
+ def device_class
51
+ const_get("DeferToClass")
26
52
  end
27
53
 
28
54
  end
29
55
 
30
56
  end
31
57
 
58
+ module Input
59
+
60
+ def self.included(base)
61
+ base.extend(Device::ClassMethods)
62
+ end
63
+
64
+ def gets(*a)
65
+ @device.gets(*a)
66
+ end
67
+
68
+ def gets_bytestr(*a)
69
+ @device.gets_bytestr(*a)
70
+ end
71
+
72
+ end
73
+
74
+ module Output
75
+
76
+ def self.included(base)
77
+ base.extend(Device::ClassMethods)
78
+ end
79
+
80
+ def puts(*a)
81
+ @device.puts(*a)
82
+ end
83
+
84
+ def puts_bytestr(*a)
85
+ @device.puts_bytestr(*a)
86
+ end
87
+
88
+ end
89
+
32
90
  end
33
91
 
34
92
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: unimidi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.5
6
6
  platform: i686-linux
7
7
  authors:
8
8
  - Ari Russo
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-19 00:00:00 -04:00
13
+ date: 2011-04-21 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency