unimidi 0.1.6-java → 0.1.9-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -18,32 +18,35 @@ Platform
18
18
  * Linux: {alsa-rawmidi}[http://github.com/arirusso/alsa-rawmidi]
19
19
  * OSX: {ffi-coremidi}[http://github.com/arirusso/ffi-coremidi]
20
20
  * Windows/Cygwin: {midi-winmm}[http://github.com/arirusso/midi-winmm]
21
-
22
- A couple of notes about JRuby only:
23
-
24
- * You must be in 1.9 mode. This is normally accomplished by passing --1.9 to JRuby at the command line.
25
- * javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
26
21
 
27
22
  == Install
28
23
 
29
- * gem install unimidi
24
+ gem install unimidi
25
+
26
+ No compilation required
30
27
 
31
28
  == Examples
32
29
 
33
30
  * {input}[http://github.com/arirusso/unimidi/blob/master/examples/input.rb]
34
31
  * {output}[http://github.com/arirusso/unimidi/blob/master/examples/output.rb]
35
32
 
33
+ {more}[http://github.com/arirusso/unimidi/blob/master/examples]
34
+
36
35
  == Tests
37
36
 
38
37
  * please see {test/config.rb}[http://github.com/arirusso/unimidi/blob/master/test/config.rb] before running tests
39
38
 
40
- For testing with JRuby, use
41
-
42
- jruby --1.9 -S rake test
43
-
44
39
  == Documentation
45
40
 
46
41
  * {rdoc}[http://rdoc.info/gems/unimidi]
42
+
43
+ == If you are using JRuby
44
+
45
+ A couple of notes
46
+
47
+ * You must be in 1.9 mode. This is normally accomplished by passing --1.9 to JRuby at the command line. For testing in 1.9 mode, use
48
+ jruby --1.9 -S rake test
49
+ * javax.sound has some documented issues with SysEx messages in some versions OSX Snow Leopard which do affect this library.
47
50
 
48
51
  == Author
49
52
 
data/bin/unimidi ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+
4
+ require 'unimidi'
5
+
6
+ opts = ARGV.length > 1 ? ARGV.slice(1, ARGV.length-1) : {}
7
+
8
+ raise "No command specified" if ARGV.first.nil?
9
+
10
+ UniMIDI.command(ARGV.first.to_sym, opts)
data/lib/unimidi.rb CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  module UniMIDI
8
8
 
9
- VERSION = "0.1.6"
9
+ VERSION = "0.1.9"
10
10
 
11
11
  end
12
12
 
@@ -19,4 +19,13 @@ require 'unimidi/type_conversion'
19
19
  module UniMIDI
20
20
  extend(Platform.instance.interface)
21
21
  include(Platform.instance.interface)
22
+
23
+ def self.command(command, options = {})
24
+ if [:l, :list, :list_devices].include?(command)
25
+ require 'pp'
26
+ pp Device::all
27
+ else
28
+ raise "Command #{command.to_s} not found"
29
+ end
30
+ end
22
31
  end
@@ -7,10 +7,11 @@ module UniMIDI
7
7
 
8
8
  module Device
9
9
 
10
- def initialize(device_obj)
10
+ def initialize(device_obj)
11
11
  @device = device_obj
12
12
  @id = @device.id
13
13
  @name = @device.name
14
+ @type = @device.type
14
15
  end
15
16
 
16
17
  # enable the device for use, can be passed a block to which the device will be passed back
@@ -18,7 +19,7 @@ module UniMIDI
18
19
  @device.open(*a)
19
20
  unless block.nil?
20
21
  begin
21
- block.call(self)
22
+ yield(self)
22
23
  ensure
23
24
  close
24
25
  end
@@ -41,12 +42,16 @@ module UniMIDI
41
42
 
42
43
  # returns the first device for this class
43
44
  def first(*a)
44
- new(@deference[self].first(*a))
45
+ dev = @deference[self].first(*a)
46
+ raise 'Device not found' if dev.nil?
47
+ new(dev)
45
48
  end
46
49
 
47
50
  # returns the last device for this class
48
51
  def last(*a)
49
- new(@deference[self].last(*a))
52
+ dev = @deference[self].last(*a)
53
+ raise 'Device not found' if dev.nil?
54
+ new(dev)
50
55
  end
51
56
 
52
57
  # returns all devices in an array
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unimidi
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.6
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 9
9
+ version: 0.1.9
6
10
  platform: java
7
11
  authors:
8
12
  - Ari Russo
@@ -10,38 +14,40 @@ autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2011-05-10 00:00:00 -04:00
14
- default_executable:
17
+ date: 2011-05-22 00:00:00 -04:00
18
+ default_executable: unimidi
15
19
  dependencies:
16
20
  - !ruby/object:Gem::Dependency
17
21
  name: midi-jruby
18
22
  prerelease: false
19
23
  requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
24
  requirements:
22
25
  - - ">="
23
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
24
29
  version: "0"
25
30
  type: :runtime
26
31
  version_requirements: *id001
27
32
  description: Platform Independent, realtime MIDI input and output for Ruby.
28
33
  email:
29
34
  - ari.russo@gmail.com
30
- executables: []
31
-
35
+ executables:
36
+ - unimidi
32
37
  extensions: []
33
38
 
34
39
  extra_rdoc_files: []
35
40
 
36
41
  files:
42
+ - bin/unimidi
37
43
  - lib/unimidi.rb
38
44
  - lib/unimidi/congruous_api_adapter.rb
39
45
  - lib/unimidi/platform.rb
40
46
  - lib/unimidi/type_conversion.rb
41
- - lib/unimidi/adapter/alsa-rawmidi.rb
42
47
  - lib/unimidi/adapter/ffi-coremidi.rb
43
- - lib/unimidi/adapter/midi-jruby.rb
44
48
  - lib/unimidi/adapter/midi-winmm.rb
49
+ - lib/unimidi/adapter/alsa-rawmidi.rb
50
+ - lib/unimidi/adapter/midi-jruby.rb
45
51
  - LICENSE
46
52
  - README.rdoc
47
53
  has_rdoc: true
@@ -54,21 +60,25 @@ rdoc_options: []
54
60
  require_paths:
55
61
  - lib
56
62
  required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
63
  requirements:
59
64
  - - ">="
60
65
  - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
61
68
  version: "0"
62
69
  required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
70
  requirements:
65
71
  - - ">="
66
72
  - !ruby/object:Gem::Version
73
+ segments:
74
+ - 1
75
+ - 3
76
+ - 6
67
77
  version: 1.3.6
68
78
  requirements: []
69
79
 
70
80
  rubyforge_project: unimidi
71
- rubygems_version: 1.5.1
81
+ rubygems_version: 1.3.6
72
82
  signing_key:
73
83
  specification_version: 3
74
84
  summary: Realtime MIDI input and output for Ruby.