micromidi 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +13 -0
- data/README.rdoc +103 -0
- data/TODO +8 -0
- data/lib/micromidi/context.rb +57 -0
- data/lib/micromidi/instructions/composite.rb +35 -0
- data/lib/micromidi/instructions/input.rb +114 -0
- data/lib/micromidi/instructions/message.rb +100 -0
- data/lib/micromidi/instructions/output.rb +28 -0
- data/lib/micromidi/instructions/process.rb +57 -0
- data/lib/micromidi/instructions/shorthand.rb +79 -0
- data/lib/micromidi/instructions/sticky.rb +59 -0
- data/lib/micromidi/instructions/sysex.rb +43 -0
- data/lib/micromidi/state.rb +79 -0
- data/lib/micromidi.rb +67 -0
- data/lib/midi.rb +15 -0
- data/test/helper.rb +32 -0
- data/test/test_composite.rb +36 -0
- data/test/test_context.rb +33 -0
- data/test/test_effect.rb +135 -0
- data/test/test_input.rb +23 -0
- data/test/test_message.rb +123 -0
- data/test/test_output.rb +21 -0
- data/test/test_state.rb +32 -0
- data/test/test_sticky.rb +134 -0
- data/test/test_sysex.rb +60 -0
- metadata +103 -0
data/test/test_sticky.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
class StickyTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include MicroMIDI
|
8
|
+
include MIDIMessage
|
9
|
+
include TestHelper
|
10
|
+
|
11
|
+
def test_channel
|
12
|
+
m = MicroMIDI.message
|
13
|
+
msg = m.note "C0"
|
14
|
+
assert_equal(NoteOn, msg.class)
|
15
|
+
assert_equal(12, msg.note)
|
16
|
+
assert_equal(0, msg.channel)
|
17
|
+
|
18
|
+
m.channel 7
|
19
|
+
msg = m.note "C0"
|
20
|
+
assert_equal(NoteOn, msg.class)
|
21
|
+
assert_equal(12, msg.note)
|
22
|
+
assert_equal(7, msg.channel)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_channel_override
|
26
|
+
m = MicroMIDI.message
|
27
|
+
m.channel 7
|
28
|
+
msg = m.note "C0", :channel => 3
|
29
|
+
assert_equal(NoteOn, msg.class)
|
30
|
+
assert_equal(12, msg.note)
|
31
|
+
assert_equal(3, msg.channel)
|
32
|
+
assert_equal(100, msg.velocity)
|
33
|
+
|
34
|
+
msg = m.note "C0"
|
35
|
+
assert_equal(NoteOn, msg.class)
|
36
|
+
assert_equal(12, msg.note)
|
37
|
+
assert_equal(7, msg.channel)
|
38
|
+
assert_equal(100, msg.velocity)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_velocity
|
42
|
+
m = MicroMIDI.message
|
43
|
+
msg = m.note "C0"
|
44
|
+
assert_equal(NoteOn, msg.class)
|
45
|
+
assert_equal(12, msg.note)
|
46
|
+
assert_equal(0, msg.channel)
|
47
|
+
assert_equal(100, msg.velocity)
|
48
|
+
|
49
|
+
m.velocity 10
|
50
|
+
msg = m.note "C0"
|
51
|
+
assert_equal(NoteOn, msg.class)
|
52
|
+
assert_equal(12, msg.note)
|
53
|
+
assert_equal(0, msg.channel)
|
54
|
+
assert_equal(10, msg.velocity)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_octave
|
58
|
+
m = MicroMIDI.message
|
59
|
+
msg = m.note "C"
|
60
|
+
assert_equal(NoteOn, msg.class)
|
61
|
+
assert_equal(36, msg.note)
|
62
|
+
assert_equal(0, msg.channel)
|
63
|
+
assert_equal(100, msg.velocity)
|
64
|
+
|
65
|
+
m.octave 4
|
66
|
+
msg = m.note "C"
|
67
|
+
assert_equal(NoteOn, msg.class)
|
68
|
+
assert_equal(60, msg.note)
|
69
|
+
assert_equal(0, msg.channel)
|
70
|
+
assert_equal(100, msg.velocity)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_octave_super_sticky
|
74
|
+
m = MicroMIDI.message
|
75
|
+
m.super_sticky
|
76
|
+
|
77
|
+
msg = m.note "C"
|
78
|
+
assert_equal(NoteOn, msg.class)
|
79
|
+
assert_equal(36, msg.note)
|
80
|
+
assert_equal(0, msg.channel)
|
81
|
+
assert_equal(100, msg.velocity)
|
82
|
+
|
83
|
+
m.octave 4
|
84
|
+
msg = m.note "C0"
|
85
|
+
assert_equal(NoteOn, msg.class)
|
86
|
+
assert_equal(12, msg.note)
|
87
|
+
assert_equal(0, msg.channel)
|
88
|
+
assert_equal(100, msg.velocity)
|
89
|
+
|
90
|
+
msg = m.note "D"
|
91
|
+
assert_equal(NoteOn, msg.class)
|
92
|
+
assert_equal(14, msg.note)
|
93
|
+
assert_equal(0, msg.channel)
|
94
|
+
assert_equal(100, msg.velocity)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_velocity_super_sticky
|
98
|
+
m = MicroMIDI.message
|
99
|
+
m.super_sticky
|
100
|
+
|
101
|
+
msg = m.note "C0"
|
102
|
+
assert_equal(NoteOn, msg.class)
|
103
|
+
assert_equal(12, msg.note)
|
104
|
+
assert_equal(0, msg.channel)
|
105
|
+
assert_equal(100, msg.velocity)
|
106
|
+
|
107
|
+
m.velocity 10
|
108
|
+
msg = m.note "C0", :velocity => 20
|
109
|
+
assert_equal(NoteOn, msg.class)
|
110
|
+
assert_equal(12, msg.note)
|
111
|
+
assert_equal(0, msg.channel)
|
112
|
+
assert_equal(20, msg.velocity)
|
113
|
+
|
114
|
+
msg = m.note "C1"
|
115
|
+
assert_equal(NoteOn, msg.class)
|
116
|
+
assert_equal(24, msg.note)
|
117
|
+
assert_equal(0, msg.channel)
|
118
|
+
assert_equal(20, msg.velocity)
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_sysex_node
|
122
|
+
m = MicroMIDI.message
|
123
|
+
assert_equal(nil, m.sysex_node)
|
124
|
+
|
125
|
+
node = m.node 0x41, :model_id => 0x42, :device_id => 0x10
|
126
|
+
assert_equal(SystemExclusive::Node, node.class)
|
127
|
+
assert_equal(65, node.manufacturer_id)
|
128
|
+
assert_equal(66, node.model_id)
|
129
|
+
assert_equal(16, node.device_id)
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
data/test/test_sysex.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'helper'
|
4
|
+
|
5
|
+
class SysexTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include MicroMIDI
|
8
|
+
include MIDIMessage
|
9
|
+
include TestHelper
|
10
|
+
|
11
|
+
def test_command
|
12
|
+
m = MicroMIDI.message
|
13
|
+
m.sysex_node 0x41, :model_id => 0x42, :device_id => 0x10
|
14
|
+
msg = m.sysex_command [0x40, 0x7F, 0x00], 0x00
|
15
|
+
assert_equal(SystemExclusive::Command, msg.class)
|
16
|
+
assert_equal([0x40, 0x7F, 0x00], msg.address)
|
17
|
+
assert_equal(0, msg.data)
|
18
|
+
assert_equal([0xF0, 0x41, 0x10, 0x42, 0x12, 0x40, 0x7F, 0x00, 0x00, 0x41, 0xF7], msg.to_bytes)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_request
|
22
|
+
m = MicroMIDI.message
|
23
|
+
m.sysex_node 0x41, :model_id => 0x42, :device_id => 0x10
|
24
|
+
msg = m.sysex_request [0x40, 0x7F, 0x00], 0x02
|
25
|
+
assert_equal(SystemExclusive::Request, msg.class)
|
26
|
+
assert_equal([0x40, 0x7F, 0x00], msg.address)
|
27
|
+
assert_equal([0x0, 0x0, 0x02], msg.size)
|
28
|
+
assert_equal([0xF0, 0x41, 0x10, 0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02, 0x3F, 0xF7], msg.to_bytes)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_message
|
32
|
+
m = MicroMIDI.message
|
33
|
+
msg = m.sysex_message [0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02]
|
34
|
+
assert_equal(SystemExclusive::Message, msg.class)
|
35
|
+
assert_equal([0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02], msg.data)
|
36
|
+
assert_equal([0xF0, 0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02, 0xF7], msg.to_bytes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_message_with_node
|
40
|
+
m = MicroMIDI.message
|
41
|
+
m.sysex_node 0x41, :model_id => 0x42, :device_id => 0x10
|
42
|
+
msg = m.sysex_message [0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02]
|
43
|
+
assert_equal(SystemExclusive::Message, msg.class)
|
44
|
+
assert_equal([0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02], msg.data)
|
45
|
+
assert_equal([0xF0, 0x41, 0x10, 0x42, 0x42, 0x11, 0x40, 0x7F, 0x00, 0x0, 0x0, 0x02, 0xF7], msg.to_bytes)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_no_model_id
|
49
|
+
m = MicroMIDI.message
|
50
|
+
m.sysex_node 0x41, :device_id => 0x10
|
51
|
+
msg = m.sysex_command [0x40, 0x7F, 0x00], 0x00
|
52
|
+
assert_equal(SystemExclusive::Command, msg.class)
|
53
|
+
assert_equal([0x41, 0x10], msg.node.to_a)
|
54
|
+
assert_equal([0x40, 0x7F, 0x00], msg.address)
|
55
|
+
assert_equal(0, msg.data)
|
56
|
+
assert_equal([0xF0, 0x41, 0x10, 0x12, 0x40, 0x7F, 0x00, 0x00, 0x41, 0xF7], msg.to_bytes)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: micromidi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ari Russo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-17 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: midi-eye
|
16
|
+
requirement: &70314148983600 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70314148983600
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: midi-message
|
27
|
+
requirement: &70314148983000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.2.2
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70314148983000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: unimidi
|
38
|
+
requirement: &70314148982400 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.2.3
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70314148982400
|
47
|
+
description: A Ruby DSL for MIDI
|
48
|
+
email:
|
49
|
+
- ari.russo@gmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- lib/micromidi/context.rb
|
55
|
+
- lib/micromidi/instructions/composite.rb
|
56
|
+
- lib/micromidi/instructions/input.rb
|
57
|
+
- lib/micromidi/instructions/message.rb
|
58
|
+
- lib/micromidi/instructions/output.rb
|
59
|
+
- lib/micromidi/instructions/process.rb
|
60
|
+
- lib/micromidi/instructions/shorthand.rb
|
61
|
+
- lib/micromidi/instructions/sticky.rb
|
62
|
+
- lib/micromidi/instructions/sysex.rb
|
63
|
+
- lib/micromidi/state.rb
|
64
|
+
- lib/micromidi.rb
|
65
|
+
- lib/midi.rb
|
66
|
+
- test/helper.rb
|
67
|
+
- test/test_composite.rb
|
68
|
+
- test/test_context.rb
|
69
|
+
- test/test_effect.rb
|
70
|
+
- test/test_input.rb
|
71
|
+
- test/test_message.rb
|
72
|
+
- test/test_output.rb
|
73
|
+
- test/test_state.rb
|
74
|
+
- test/test_sticky.rb
|
75
|
+
- test/test_sysex.rb
|
76
|
+
- LICENSE
|
77
|
+
- README.rdoc
|
78
|
+
- TODO
|
79
|
+
homepage: http://github.com/arirusso/micromidi
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.3.6
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project: micromidi
|
99
|
+
rubygems_version: 1.8.6
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: A Ruby DSL for MIDI
|
103
|
+
test_files: []
|