midiator 0.1.1 → 0.2.0

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.
@@ -14,6 +14,7 @@
14
14
  # This code released under the terms of the MIT license.
15
15
  #
16
16
 
17
+ require 'rubygems'
17
18
  require 'midiator'
18
19
 
19
20
  midi = MIDIator::Interface.new
@@ -39,6 +39,7 @@ if input = ARGV[0]
39
39
  end
40
40
  end
41
41
 
42
+ require 'rubygems'
42
43
 
43
44
  ########################################################################
44
45
  ### M I D I A T O R S E T U P
@@ -13,12 +13,24 @@
13
13
  # This code released under the terms of the MIT license.
14
14
  #
15
15
 
16
- require 'string_extensions'
17
-
18
16
  module MIDIator
19
- VERSION = "0.1.1"
17
+ VERSION = "0.2.0"
20
18
  end
21
19
 
20
+ #####################################################################
21
+ ### E X T E R N A L D E P E N D E N C I E S
22
+ #####################################################################
23
+ require 'rubygems'
24
+ require 'platform'
25
+
26
+ #####################################################################
27
+ ### C O R E L I B R A R Y E X T E N S I O N S
28
+ #####################################################################
29
+ require 'string_extensions'
30
+
31
+ #####################################################################
32
+ ### M I D I A T O R C O R E
33
+ #####################################################################
22
34
  require 'midiator/driver'
23
35
  require 'midiator/driver_registry'
24
36
  require 'midiator/exceptions'
@@ -7,6 +7,10 @@
7
7
  #
8
8
  # * Ben Bleything <ben@bleything.net>
9
9
  #
10
+ # == Contributors
11
+ #
12
+ # * Giles Bowkett
13
+ #
10
14
  # == Copyright
11
15
  #
12
16
  # Copyright (c) 2008 Ben Bleything
@@ -21,9 +25,16 @@ class MIDIator::Interface
21
25
 
22
26
  ### Automatically select a driver to use
23
27
  def autodetect_driver
24
- self.use( :winmm ) if RUBY_PLATFORM.include? 'win32'
25
- self.use( :core_midi ) if RUBY_PLATFORM.include? 'darwin'
26
- self.use( :alsa ) if RUBY_PLATFORM.include? 'linux'
28
+ driver = case Platform::IMPL
29
+ when :macosx
30
+ :core_midi
31
+ when :mswin
32
+ :winmm
33
+ when :linux
34
+ :alsa
35
+ end
36
+
37
+ self.use(driver)
27
38
  end
28
39
 
29
40
 
@@ -7,6 +7,10 @@
7
7
  #
8
8
  # * Ben Bleything <ben@bleything.net>
9
9
  #
10
+ # == Contributors
11
+ #
12
+ # * Xavier Shay
13
+ #
10
14
  # == Copyright
11
15
  #
12
16
  # Copyright (c) 2008 Ben Bleything
@@ -80,13 +84,6 @@ module MIDIator::Notes # this file does not rdoc well, so uhh.... :nodoc:
80
84
  As8 = 118 ; Bb8 = 118
81
85
  B8 = 119 ; Cb9 = 119
82
86
 
83
- # these notes are not valid MIDI notes but they're here to complete the
84
- # octave. Use at your own risk?
85
- Gs9 = 128 ; Ab9 = 128
86
- A9 = 129 ;
87
- As9 = 130 ; Bb9 = 130
88
- B9 = 131 ; Cb10 = 131
89
-
90
87
  # Shortcuts!
91
88
  MiddleC = 84
92
89
 
@@ -39,6 +39,8 @@ gemspec = Gem::Specification.new do |gem|
39
39
  collect {|f| f.relative_path_from(BASE_DIR).to_s }
40
40
  gem.test_files = SPEC_FILES.
41
41
  collect {|f| f.relative_path_from(BASE_DIR).to_s }
42
+
43
+ gem.add_dependency 'Platform', [">= 0.4.0"]
42
44
  end
43
45
 
44
46
  Rake::GemPackageTask.new( gemspec ) do |task|
@@ -6,6 +6,10 @@
6
6
  #
7
7
  # * Ben Bleything <ben@bleything.net>
8
8
  #
9
+ # == Contributors
10
+ #
11
+ # * Giles Bowkett
12
+ #
9
13
  # == Copyright
10
14
  #
11
15
  # Copyright (c) 2008 Ben Bleything
@@ -25,39 +29,37 @@ describe MIDIator::Interface do
25
29
 
26
30
  describe "auto-detects the correct driver for your platform" do
27
31
  before( :all ) do
28
- # remember RUBY_PLATFORM so we can reset it later
29
- @ruby_platform = RUBY_PLATFORM
32
+ # remember platform so we can reset it later
33
+ @ruby_platform = Platform::IMPL
30
34
 
31
- $stderr.puts "*" * 72
32
- $stderr.puts "NOTE: constant redefinition warnings are normal for these specs"
33
- $stderr.puts "*" * 72
35
+ # suppress warnings (http://www.ruby-forum.com/topic/127608)
36
+ $-v = nil
34
37
  end
35
38
 
36
39
  after( :all ) do
37
- # reset RUBY_PLATFORM to whatever is correct for our platform
38
- RUBY_PLATFORM = @ruby_platform
40
+ # reset platform to whatever is correct for our platform
41
+ Platform::IMPL = @ruby_platform
39
42
 
40
- $stderr.puts "*" * 72
41
- $stderr.puts "NOTE: you shouldn't see any more warnings"
42
- $stderr.puts "*" * 72
43
+ # restore warnings (http://www.ruby-forum.com/topic/127608)
44
+ $-v = false
43
45
  end
44
46
 
45
47
  it "selects WinMM for Windows" do
46
- RUBY_PLATFORM = "i386-win32"
48
+ Platform::IMPL = :mswin
47
49
  @interface.should_receive( :use ).with( :winmm )
48
50
 
49
51
  @interface.autodetect_driver
50
52
  end
51
53
 
52
54
  it "selects CoreMIDI for OSX" do
53
- RUBY_PLATFORM = "universal-darwin9.0"
55
+ Platform::IMPL = :macosx
54
56
  @interface.should_receive( :use ).with( :core_midi )
55
57
 
56
58
  @interface.autodetect_driver
57
59
  end
58
60
 
59
61
  it "selects ALSA for Linux" do
60
- RUBY_PLATFORM = "i486-linux"
62
+ Platform::IMPL = :linux
61
63
  @interface.should_receive( :use ).with( :alsa )
62
64
 
63
65
  @interface.autodetect_driver
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Bleything
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-19 00:00:00 -07:00
12
+ date: 2008-10-29 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: Platform
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.4.0
24
+ version:
16
25
  description: MIDIator provides an OS-agnostic way to send live MIDI messages to your machine's MIDI playback system.
17
26
  email: ben@bleything.net
18
27
  executables: []