unimidi 0.1.6-i686-linux → 0.1.7-i686-linux

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, just install the gem and set up your hardware
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
+ command = ARGV.first.to_sym or raise "no command specified"
9
+
10
+ UniMIDI.command(command, opts)
@@ -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
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.7"
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
+ $stderr.puts "Command #{command.to_s} not found"
29
+ end
30
+ end
22
31
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: unimidi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.6
5
+ version: 0.1.7
6
6
  platform: i686-linux
7
7
  authors:
8
8
  - Ari Russo
@@ -10,8 +10,8 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-10 00:00:00 -04:00
14
- default_executable:
13
+ date: 2011-05-22 00:00:00 -04:00
14
+ default_executable: unimidi
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: alsa-rawmidi
@@ -27,13 +27,14 @@ dependencies:
27
27
  description: Platform Independent, realtime MIDI input and output for Ruby.
28
28
  email:
29
29
  - ari.russo@gmail.com
30
- executables: []
31
-
30
+ executables:
31
+ - unimidi
32
32
  extensions: []
33
33
 
34
34
  extra_rdoc_files: []
35
35
 
36
36
  files:
37
+ - bin/unimidi
37
38
  - lib/unimidi.rb
38
39
  - lib/unimidi/adapter/ffi-coremidi.rb
39
40
  - lib/unimidi/adapter/midi-winmm.rb