unimidi 0.0.8-java → 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# (c)2010-2011 Ari Russo and licensed under the Apache 2.0 License
|
4
|
+
#
|
5
|
+
|
1
6
|
module UniMIDI
|
2
7
|
|
3
8
|
module CongruousApiAdapter
|
@@ -10,6 +15,7 @@ module UniMIDI
|
|
10
15
|
@name = @device.name
|
11
16
|
end
|
12
17
|
|
18
|
+
# enable the device for use, can be passed a block to which the device will be passed back
|
13
19
|
def open(*a, &block)
|
14
20
|
begin
|
15
21
|
@device.open(*a)
|
@@ -19,6 +25,7 @@ module UniMIDI
|
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
28
|
+
# close the device
|
22
29
|
def close(*a)
|
23
30
|
@device.close(*a)
|
24
31
|
end
|
@@ -130,6 +137,7 @@ module UniMIDI
|
|
130
137
|
|
131
138
|
module ClassMethods
|
132
139
|
|
140
|
+
# returns all inputs
|
133
141
|
def all
|
134
142
|
device_class.all.map { |d| new(d) }
|
135
143
|
end
|
@@ -145,16 +153,31 @@ module UniMIDI
|
|
145
153
|
base.extend(ClassMethods)
|
146
154
|
end
|
147
155
|
|
156
|
+
# sends a message to the output. the message can be:
|
157
|
+
#
|
158
|
+
# bytes eg output.puts(0x90, 0x40, 0x40)
|
159
|
+
# an array of bytes eg output.puts([0x90, 0x40, 0x40])
|
160
|
+
# or a string eg output.puts("904040")
|
161
|
+
#
|
148
162
|
def puts(*a)
|
149
163
|
@device.puts(*a)
|
150
164
|
end
|
151
165
|
|
166
|
+
# sends a message to the output in a form of a string eg "904040". this method does not do
|
167
|
+
# type checking and therefore is more performant than puts
|
152
168
|
def puts_bytestr(*a)
|
153
169
|
@device.puts_bytestr(*a)
|
154
170
|
end
|
171
|
+
|
172
|
+
# sends a message to the output in a form of bytes eg output.puts_bytes(0x90, 0x40, 0x40).
|
173
|
+
# this method does not do type checking and therefore is more performant than puts
|
174
|
+
def puts_bytes(*a)
|
175
|
+
@device.puts_bytes(*a)
|
176
|
+
end
|
155
177
|
|
156
178
|
module ClassMethods
|
157
179
|
|
180
|
+
# returns all outputs
|
158
181
|
def all
|
159
182
|
device_class.all.map { |d| new(d) }
|
160
183
|
end
|
data/lib/unimidi/platform.rb
CHANGED
data/lib/unimidi.rb
CHANGED