midi-message 0.0.1-i686-linux → 0.0.2-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 +13 -4
- data/lib/midi-message/channel_message.rb +21 -8
- data/lib/midi-message/simple_message.rb +13 -7
- data/lib/midi-message/system_message.rb +11 -1
- data/lib/midi-message.rb +1 -1
- metadata +8 -8
data/README.rdoc
CHANGED
@@ -1,17 +1,26 @@
|
|
1
|
-
= midi-
|
1
|
+
= midi-message
|
2
2
|
|
3
3
|
== Summary
|
4
4
|
|
5
|
-
MIDI
|
5
|
+
MIDI messages, objectified in Ruby
|
6
6
|
|
7
7
|
== Features
|
8
8
|
|
9
|
-
*
|
9
|
+
* All message types and components
|
10
10
|
* YAML Dictionary of MIDI constants
|
11
11
|
|
12
12
|
== Install
|
13
13
|
|
14
|
-
* gem install midi-message
|
14
|
+
* gem install midi-message
|
15
|
+
|
16
|
+
== Examples
|
17
|
+
|
18
|
+
* {melody}[http://github.com/arirusso/midi-message/blob/master/examples/melody.rb]
|
19
|
+
* {parse}[http://github.com/arirusso/midi-message/blob/master/examples/parse.rb]
|
20
|
+
|
21
|
+
== Documentation
|
22
|
+
|
23
|
+
* {rdoc}[http://rdoc.info/gems/midi-message]
|
15
24
|
|
16
25
|
== Author
|
17
26
|
|
@@ -122,7 +122,12 @@ module MIDIMessage
|
|
122
122
|
schema :channel, :number, :value
|
123
123
|
type_id 0xB
|
124
124
|
display_name 'Control Change'
|
125
|
-
|
125
|
+
use_constants 'Control Change', :for => 'Number'
|
126
|
+
|
127
|
+
def self.find(name, channel, value)
|
128
|
+
c = const(name)
|
129
|
+
new(channel, c, value)
|
130
|
+
end
|
126
131
|
|
127
132
|
end
|
128
133
|
|
@@ -137,8 +142,12 @@ module MIDIMessage
|
|
137
142
|
schema :channel, :note, :velocity
|
138
143
|
type_id 0x8
|
139
144
|
display_name 'Note Off'
|
140
|
-
use_constants 'Note'
|
141
|
-
|
145
|
+
use_constants 'Note', :for => :note
|
146
|
+
|
147
|
+
def self.find(name, channel, velocity)
|
148
|
+
c = const(name)
|
149
|
+
new(channel, name, velocity)
|
150
|
+
end
|
142
151
|
|
143
152
|
end
|
144
153
|
|
@@ -153,8 +162,12 @@ module MIDIMessage
|
|
153
162
|
schema :channel, :note, :velocity
|
154
163
|
type_id 0x9
|
155
164
|
display_name 'Note On'
|
156
|
-
use_constants 'Note'
|
157
|
-
|
165
|
+
use_constants 'Note', :for => :note
|
166
|
+
|
167
|
+
def self.find(name, channel, velocity)
|
168
|
+
c = const(name)
|
169
|
+
new(channel, name, velocity)
|
170
|
+
end
|
158
171
|
|
159
172
|
end
|
160
173
|
|
@@ -168,7 +181,7 @@ module MIDIMessage
|
|
168
181
|
|
169
182
|
schema :channel, :low, :high
|
170
183
|
type_id 0xE
|
171
|
-
|
184
|
+
display_name 'Pitch Bend'
|
172
185
|
|
173
186
|
end
|
174
187
|
|
@@ -182,7 +195,7 @@ module MIDIMessage
|
|
182
195
|
|
183
196
|
schema :channel, :note, :value
|
184
197
|
type_id 0xA
|
185
|
-
|
198
|
+
display_name 'Polyphonic Aftertouch'
|
186
199
|
|
187
200
|
end
|
188
201
|
|
@@ -196,7 +209,7 @@ module MIDIMessage
|
|
196
209
|
|
197
210
|
schema :channel, :program
|
198
211
|
type_id 0xC
|
199
|
-
|
212
|
+
display_name 'Program Change'
|
200
213
|
|
201
214
|
end
|
202
215
|
|
@@ -10,10 +10,10 @@ module MIDIMessage
|
|
10
10
|
:verbose_name
|
11
11
|
|
12
12
|
def initialize_simple_message(status_nibble_1, status_nibble_2)
|
13
|
-
|
13
|
+
@status = [status_nibble_1, status_nibble_2]
|
14
14
|
group_name = self.class.const_get(:DisplayName)
|
15
15
|
group_name_alias = self.class.const_get(:UseConstants) rescue nil
|
16
|
-
val = self.send(self.class.const_get(:
|
16
|
+
val = self.send(self.class.const_get(:ConstProp)) rescue @status[1]
|
17
17
|
group = Constant[group_name] || (group_name_alias.nil? ? nil : Constant[group_name_alias])
|
18
18
|
unless group.nil?
|
19
19
|
const = group.find { |k,v| k if v.eql?(val) }
|
@@ -35,18 +35,24 @@ module MIDIMessage
|
|
35
35
|
|
36
36
|
module ClassMethods
|
37
37
|
|
38
|
+
def const(name)
|
39
|
+
key = const_get(:DisplayName) rescue nil
|
40
|
+
key = const_get(:UseConstants) rescue key
|
41
|
+
unless key.nil?
|
42
|
+
Constant.instance[key.to_s][name.to_s]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
def display_name(name)
|
39
47
|
const_set(:DisplayName, name)
|
40
48
|
end
|
41
49
|
|
42
|
-
def use_constants(name)
|
50
|
+
def use_constants(name, options = {})
|
51
|
+
for_prop = options[:for]
|
52
|
+
const_set(:ConstProp, for_prop) unless for_prop.nil?
|
43
53
|
const_set(:UseConstants, name)
|
44
54
|
end
|
45
55
|
|
46
|
-
def identifier(name)
|
47
|
-
const_set(:Identifier, name)
|
48
|
-
end
|
49
|
-
|
50
56
|
end
|
51
57
|
|
52
58
|
end
|
@@ -17,6 +17,11 @@ module MIDIMessage
|
|
17
17
|
@data = [data_byte_1, data_byte_2]
|
18
18
|
initialize_simple_message(0xF, status_nibble_2)
|
19
19
|
end
|
20
|
+
|
21
|
+
def self.find(const_name, data_byte_1 = nil, data_byte_2 = nil)
|
22
|
+
c = const(const_name)
|
23
|
+
new(c, data_byte_1, data_byte_2)
|
24
|
+
end
|
20
25
|
|
21
26
|
end
|
22
27
|
|
@@ -34,10 +39,15 @@ module MIDIMessage
|
|
34
39
|
initialize_simple_message(0xF, id)
|
35
40
|
end
|
36
41
|
|
42
|
+
def self.find(const_name)
|
43
|
+
c = const(const_name)
|
44
|
+
new(c)
|
45
|
+
end
|
46
|
+
|
37
47
|
def id
|
38
48
|
@status[1]
|
39
49
|
end
|
40
50
|
|
41
51
|
end
|
42
52
|
|
43
|
-
end
|
53
|
+
end
|
data/lib/midi-message.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: midi-message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: i686-linux
|
7
7
|
authors:
|
8
8
|
- Ari Russo
|
@@ -14,7 +14,7 @@ date: 2011-04-29 00:00:00 -04:00
|
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
17
|
-
description: MIDI
|
17
|
+
description: MIDI messages, objectified in Ruby.
|
18
18
|
email:
|
19
19
|
- ari.russo@gmail.com
|
20
20
|
executables: []
|
@@ -25,13 +25,13 @@ extra_rdoc_files: []
|
|
25
25
|
|
26
26
|
files:
|
27
27
|
- lib/midi-message.rb
|
28
|
-
- lib/midi-message/
|
29
|
-
- lib/midi-message/channel_message.rb
|
28
|
+
- lib/midi-message/constant.rb
|
30
29
|
- lib/midi-message/simple_message.rb
|
31
|
-
- lib/midi-message/constants.rb
|
32
|
-
- lib/midi-message/parser.rb
|
33
30
|
- lib/midi-message/system_message.rb
|
34
|
-
- lib/midi-message/
|
31
|
+
- lib/midi-message/parser.rb
|
32
|
+
- lib/midi-message/constants.rb
|
33
|
+
- lib/midi-message/system_exclusive.rb
|
34
|
+
- lib/midi-message/channel_message.rb
|
35
35
|
- LICENSE
|
36
36
|
- README.rdoc
|
37
37
|
has_rdoc: true
|
@@ -61,6 +61,6 @@ rubyforge_project: midi-message
|
|
61
61
|
rubygems_version: 1.6.2
|
62
62
|
signing_key:
|
63
63
|
specification_version: 3
|
64
|
-
summary: MIDI
|
64
|
+
summary: MIDI messages, objectified in Ruby.
|
65
65
|
test_files: []
|
66
66
|
|