unimidi 0.3.5 → 0.4.4
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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +3 -3
- data/lib/unimidi.rb +16 -26
- data/lib/unimidi/adapter/alsa-rawmidi.rb +22 -17
- data/lib/unimidi/adapter/ffi-coremidi.rb +21 -25
- data/lib/unimidi/adapter/midi-jruby.rb +21 -16
- data/lib/unimidi/adapter/midi-winmm.rb +21 -16
- data/lib/unimidi/command.rb +26 -0
- data/lib/unimidi/device.rb +182 -0
- data/lib/unimidi/input.rb +113 -0
- data/lib/unimidi/loader.rb +30 -0
- data/lib/unimidi/output.rb +63 -0
- data/lib/unimidi/platform.rb +11 -10
- data/lib/unimidi/type_conversion.rb +1 -1
- data/test/adapter_test.rb +70 -0
- data/test/class_methods_test.rb +99 -0
- data/test/functional_test.rb +128 -0
- data/test/helper.rb +20 -25
- data/test/input_test.rb +46 -0
- data/test/platform_test.rb +41 -23
- data/test/type_conversion_test.rb +14 -6
- metadata +16 -11
- data/lib/unimidi/congruous_api_adapter.rb +0 -321
- data/test/congruous_api_adapter_test.rb +0 -36
- data/test/input_buffer_test.rb +0 -40
- data/test/io_test.rb +0 -115
- data/test/selectors_test.rb +0 -59
data/test/helper.rb
CHANGED
@@ -1,37 +1,34 @@
|
|
1
1
|
dir = File.dirname(File.expand_path(__FILE__))
|
2
2
|
$LOAD_PATH.unshift dir + '/../lib'
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "test/unit"
|
5
|
+
require "mocha/test_unit"
|
6
|
+
require "shoulda-context"
|
7
|
+
require "unimidi"
|
6
8
|
|
7
9
|
module UniMIDI
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
TestSysex = !RUBY_PLATFORM.include?("java")
|
11
|
+
class TestDeviceHelper
|
12
12
|
|
13
|
-
def self.
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def self.setup
|
14
|
+
if @test_devices.nil?
|
15
|
+
@test_devices = {}
|
16
|
+
{ :input => UniMIDI::Input, :output => UniMIDI::Output }.each do |type, klass|
|
17
|
+
@test_devices[type] = klass.gets
|
18
|
+
end
|
17
19
|
end
|
18
|
-
end
|
20
|
+
end
|
19
21
|
|
20
|
-
def
|
21
|
-
|
22
|
-
input_class ||= mod::Input
|
23
|
-
output_class ||= mod::Output
|
24
|
-
assert_equal(adapter, UniMIDI::Platform.instance.interface)
|
25
|
-
assert_not_same(input_class, UniMIDI::Input)
|
26
|
-
assert_not_same(output_class, UniMIDI::Output)
|
27
|
-
assert_not_same(device_class, UniMIDI::Device)
|
28
|
-
assert_equal(input_class.first.name, UniMIDI::Input.first.name)
|
29
|
-
assert_equal(input_class.first.id, UniMIDI::Input.first.id)
|
30
|
-
assert_not_same(output_class.first, UniMIDI::Output.first)
|
31
|
-
assert_equal(output_class.first.name, UniMIDI::Output.first.name)
|
32
|
-
assert_equal(output_class.first.id, UniMIDI::Output.first.id)
|
22
|
+
def self.devices
|
23
|
+
@test_devices
|
33
24
|
end
|
34
25
|
|
26
|
+
end
|
27
|
+
|
28
|
+
module TestHelper
|
29
|
+
|
30
|
+
TestSysex = !RUBY_PLATFORM.include?("java")
|
31
|
+
|
35
32
|
def bytestrs_to_ints(arr)
|
36
33
|
data = arr.map { |m| m[:data] }.join
|
37
34
|
output = []
|
@@ -87,5 +84,3 @@ module UniMIDI
|
|
87
84
|
end
|
88
85
|
|
89
86
|
end
|
90
|
-
|
91
|
-
UniMIDI::TestHelper.select_devices
|
data/test/input_test.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class UniMIDI::InputBufferTest < UniMIDI::TestCase
|
4
|
+
|
5
|
+
context "Input" do
|
6
|
+
|
7
|
+
setup do
|
8
|
+
TestDeviceHelper.setup
|
9
|
+
end
|
10
|
+
|
11
|
+
context "#buffer" do
|
12
|
+
|
13
|
+
setup do
|
14
|
+
sleep(1)
|
15
|
+
@messages = VariousMIDIMessages
|
16
|
+
@bytes = []
|
17
|
+
end
|
18
|
+
|
19
|
+
should "add received messages to the buffer" do
|
20
|
+
|
21
|
+
TestDeviceHelper.devices[:output].open do |output|
|
22
|
+
TestDeviceHelper.devices[:input].open do |input|
|
23
|
+
|
24
|
+
input.buffer.clear
|
25
|
+
|
26
|
+
@messages.each do |msg|
|
27
|
+
|
28
|
+
$>.puts "sending: " + msg.inspect
|
29
|
+
output.puts(msg)
|
30
|
+
@bytes += msg
|
31
|
+
sleep(0.5)
|
32
|
+
buffer = input.buffer.map { |m| m[:data] }.flatten
|
33
|
+
$>.puts "received: " + buffer.to_s
|
34
|
+
assert_equal(@bytes, buffer)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
assert_equal(@bytes.length, input.buffer.map { |m| m[:data] }.flatten.length)
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/test/platform_test.rb
CHANGED
@@ -1,29 +1,47 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class PlatformTest < UniMIDI::TestCase
|
4
|
-
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
class UniMIDI::PlatformTest < UniMIDI::TestCase
|
4
|
+
|
5
|
+
def platform_test(adapter, mod, device_class = nil, input_class = nil, output_class = nil)
|
6
|
+
device_class ||= mod::Device
|
7
|
+
input_class ||= mod::Input
|
8
|
+
output_class ||= mod::Output
|
9
|
+
assert_not_same(input_class, UniMIDI::Input)
|
10
|
+
assert_not_same(output_class, UniMIDI::Output)
|
11
|
+
assert_not_same(device_class, UniMIDI::Device)
|
12
|
+
assert_equal(input_class.first.name, UniMIDI::Input.first.name)
|
13
|
+
assert_equal(input_class.first.id, UniMIDI::Input.first.id)
|
14
|
+
assert_not_same(output_class.first, UniMIDI::Output.first)
|
15
|
+
assert_equal(output_class.first.name, UniMIDI::Output.first.name)
|
16
|
+
assert_equal(output_class.first.id, UniMIDI::Output.first.id)
|
15
17
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
|
19
|
+
context "Platform" do
|
20
|
+
|
21
|
+
should "recognize java" do
|
22
|
+
if RUBY_PLATFORM.include?("java")
|
23
|
+
platform_test(Adapter::MIDIJRuby, ::MIDIJRuby)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
should "recognize linux" do
|
28
|
+
if RUBY_PLATFORM.include?("linux")
|
29
|
+
platform_test(Adapter::AlsaRawMIDI, ::AlsaRawMIDI)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
should "recognize osx" do
|
34
|
+
if RUBY_PLATFORM.include?("darwin")
|
35
|
+
platform_test(Adapter::CoreMIDI, ::CoreMIDI, ::CoreMIDI::Endpoint, ::CoreMIDI::Source, ::CoreMIDI::Destination)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
should "recognize windows" do
|
40
|
+
if RUBY_PLATFORM.include?("mingw")
|
41
|
+
platform_test(Adapter::MIDIWinMM, ::MIDIWinMM)
|
42
|
+
end
|
20
43
|
end
|
44
|
+
|
21
45
|
end
|
22
|
-
|
23
|
-
def test_windows
|
24
|
-
if RUBY_PLATFORM.include?("mingw")
|
25
|
-
platform_test(MIDIWinMMAdapter, MIDIWinMM)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
46
|
+
|
29
47
|
end
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
class TypeConversionTest < UniMIDI::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
class UniMIDI::TypeConversionTest < UniMIDI::TestCase
|
4
|
+
|
5
|
+
context "TypeConversion" do
|
6
|
+
|
7
|
+
context "#numeric_byte_array_to_hex_string" do
|
8
|
+
|
9
|
+
should "convert byte array to hex string" do
|
10
|
+
result = TypeConversion.numeric_byte_array_to_hex_string([0x90, 0x40, 0x40])
|
11
|
+
assert "904040", result
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
8
16
|
end
|
9
|
-
|
17
|
+
|
10
18
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimidi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Russo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: alsa-rawmidi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: ffi-coremidi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: midi-jruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
@@ -80,18 +80,23 @@ files:
|
|
80
80
|
- lib/unimidi/adapter/ffi-coremidi.rb
|
81
81
|
- lib/unimidi/adapter/midi-jruby.rb
|
82
82
|
- lib/unimidi/adapter/midi-winmm.rb
|
83
|
-
- lib/unimidi/
|
83
|
+
- lib/unimidi/command.rb
|
84
|
+
- lib/unimidi/device.rb
|
85
|
+
- lib/unimidi/input.rb
|
86
|
+
- lib/unimidi/loader.rb
|
87
|
+
- lib/unimidi/output.rb
|
84
88
|
- lib/unimidi/platform.rb
|
85
89
|
- lib/unimidi/type_conversion.rb
|
86
|
-
- test/
|
90
|
+
- test/adapter_test.rb
|
91
|
+
- test/class_methods_test.rb
|
92
|
+
- test/functional_test.rb
|
87
93
|
- test/helper.rb
|
88
|
-
- test/
|
89
|
-
- test/io_test.rb
|
94
|
+
- test/input_test.rb
|
90
95
|
- test/platform_test.rb
|
91
|
-
- test/selectors_test.rb
|
92
96
|
- test/type_conversion_test.rb
|
93
97
|
homepage: http://github.com/arirusso/unimidi
|
94
|
-
licenses:
|
98
|
+
licenses:
|
99
|
+
- Apache 2.0
|
95
100
|
metadata: {}
|
96
101
|
post_install_message:
|
97
102
|
rdoc_options: []
|
@@ -1,321 +0,0 @@
|
|
1
|
-
module UniMIDI
|
2
|
-
|
3
|
-
module CongruousApiAdapter
|
4
|
-
|
5
|
-
module Device
|
6
|
-
|
7
|
-
def initialize(device_obj)
|
8
|
-
@device = device_obj
|
9
|
-
@id = @device.id
|
10
|
-
@name = @device.name
|
11
|
-
populate_type
|
12
|
-
end
|
13
|
-
|
14
|
-
def enabled?
|
15
|
-
@device.enabled
|
16
|
-
end
|
17
|
-
|
18
|
-
# enable the device for use, can be passed a block to which the device will be passed back
|
19
|
-
def open(*a, &block)
|
20
|
-
@device.open(*a) unless enabled?
|
21
|
-
if block_given?
|
22
|
-
begin
|
23
|
-
yield(self)
|
24
|
-
ensure
|
25
|
-
close
|
26
|
-
end
|
27
|
-
else
|
28
|
-
at_exit do
|
29
|
-
close
|
30
|
-
end
|
31
|
-
self
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def pretty_name
|
36
|
-
"#{id}) #{name}"
|
37
|
-
end
|
38
|
-
|
39
|
-
# close the device
|
40
|
-
def close(*a)
|
41
|
-
@device.close(*a)
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.included(base)
|
45
|
-
base.send(:attr_reader, :name)
|
46
|
-
base.send(:attr_reader, :id)
|
47
|
-
base.send(:attr_reader, :type)
|
48
|
-
base.send(:alias_method, :direction, :type)
|
49
|
-
end
|
50
|
-
|
51
|
-
module ClassMethods
|
52
|
-
|
53
|
-
include Enumerable
|
54
|
-
|
55
|
-
def each(&block)
|
56
|
-
all.each { |device| yield(device) }
|
57
|
-
end
|
58
|
-
|
59
|
-
# Prints ids and names of each device to the console
|
60
|
-
def list
|
61
|
-
all.each { |device| puts(device.pretty_name) }
|
62
|
-
end
|
63
|
-
|
64
|
-
# Shortcut to get a device by its name
|
65
|
-
def find_by_name(name)
|
66
|
-
all.find { |device| name == device.name }
|
67
|
-
end
|
68
|
-
|
69
|
-
# streamlined console prompt that asks the user to select a device
|
70
|
-
def gets(&block)
|
71
|
-
device = nil
|
72
|
-
class_name = self.name.split("::").last.downcase
|
73
|
-
puts ""
|
74
|
-
puts "Select a MIDI #{class_name}..."
|
75
|
-
while device.nil?
|
76
|
-
list
|
77
|
-
print "> "
|
78
|
-
selection = $stdin.gets.chomp
|
79
|
-
if selection != ""
|
80
|
-
selection = Integer(selection) rescue nil
|
81
|
-
device = all.find { |d| d.id == selection }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
device.open(&block)
|
85
|
-
end
|
86
|
-
|
87
|
-
# returns the first device for this class
|
88
|
-
def first(&block)
|
89
|
-
use_device(all.first, &block)
|
90
|
-
end
|
91
|
-
|
92
|
-
# returns the last device for this class
|
93
|
-
def last(&block)
|
94
|
-
use_device(all.last, &block)
|
95
|
-
end
|
96
|
-
|
97
|
-
# returns all devices in an array
|
98
|
-
def all
|
99
|
-
all_by_type.values.flatten
|
100
|
-
end
|
101
|
-
|
102
|
-
# returns the device at <em>index</em> and opens it
|
103
|
-
def use(index, &block)
|
104
|
-
index = case index
|
105
|
-
when :first then 0
|
106
|
-
when :last then all.size - 1
|
107
|
-
else index
|
108
|
-
end
|
109
|
-
use_device(all[index], &block)
|
110
|
-
end
|
111
|
-
alias_method :open, :use
|
112
|
-
|
113
|
-
# returns the device at <em>index</em>
|
114
|
-
def [](index)
|
115
|
-
all[index]
|
116
|
-
end
|
117
|
-
|
118
|
-
# returns all devices as a hash as such
|
119
|
-
# { :input => [input devices], :output => [output devices] }
|
120
|
-
def all_by_type
|
121
|
-
ensure_initialized
|
122
|
-
@devices
|
123
|
-
end
|
124
|
-
|
125
|
-
def defer_to(klass)
|
126
|
-
@deference ||= {}
|
127
|
-
@deference[self] = klass
|
128
|
-
end
|
129
|
-
|
130
|
-
def device_class(klass)
|
131
|
-
@device_class = klass
|
132
|
-
end
|
133
|
-
|
134
|
-
def input_class(klass)
|
135
|
-
@input_class = klass
|
136
|
-
end
|
137
|
-
|
138
|
-
def output_class(klass)
|
139
|
-
@output_class = klass
|
140
|
-
end
|
141
|
-
|
142
|
-
def populate
|
143
|
-
klass = @deference[self].respond_to?(:all_by_type) ? @deference[self] : @device_class
|
144
|
-
@devices = {
|
145
|
-
:input => klass.all_by_type[:input].map { |d| @input_class.new(d) },
|
146
|
-
:output => klass.all_by_type[:output].map { |d| @output_class.new(d) }
|
147
|
-
}
|
148
|
-
end
|
149
|
-
alias_method :refresh, :populate
|
150
|
-
|
151
|
-
private
|
152
|
-
|
153
|
-
def ensure_initialized
|
154
|
-
populate unless initialized?
|
155
|
-
end
|
156
|
-
|
157
|
-
def initialized?
|
158
|
-
instance_variable_defined?(:@devices) && !@devices.nil?
|
159
|
-
end
|
160
|
-
|
161
|
-
def use_device(device, &block)
|
162
|
-
device.open(&block)
|
163
|
-
device
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|
167
|
-
|
168
|
-
private
|
169
|
-
|
170
|
-
def populate_type
|
171
|
-
@type = case @device.type
|
172
|
-
when :source, :input then :input
|
173
|
-
when :destination, :output then :output
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
class CongruousApiInput
|
182
|
-
|
183
|
-
include CongruousApiAdapter::Device
|
184
|
-
extend CongruousApiAdapter::Device::ClassMethods
|
185
|
-
extend Forwardable
|
186
|
-
|
187
|
-
def_delegators :@device, :buffer
|
188
|
-
|
189
|
-
#
|
190
|
-
# returns an array of MIDI event hashes as such:
|
191
|
-
# [
|
192
|
-
# { :data => [144, 60, 100], :timestamp => 1024 },
|
193
|
-
# { :data => [128, 60, 100], :timestamp => 1100 },
|
194
|
-
# { :data => [144, 40, 120], :timestamp => 1200 }
|
195
|
-
# ]
|
196
|
-
#
|
197
|
-
# the data is an array of Numeric bytes
|
198
|
-
# the timestamp is the number of millis since this input was enabled
|
199
|
-
#
|
200
|
-
def gets(*a)
|
201
|
-
@device.gets(*a)
|
202
|
-
rescue SystemExit, Interrupt
|
203
|
-
exit
|
204
|
-
end
|
205
|
-
|
206
|
-
#
|
207
|
-
# same as gets but returns message data as string of hex digits as such:
|
208
|
-
# [
|
209
|
-
# { :data => "904060", :timestamp => 904 },
|
210
|
-
# { :data => "804060", :timestamp => 1150 },
|
211
|
-
# { :data => "90447F", :timestamp => 1300 }
|
212
|
-
# ]
|
213
|
-
#
|
214
|
-
def gets_s(*a)
|
215
|
-
@device.gets_s(*a)
|
216
|
-
rescue SystemExit, Interrupt
|
217
|
-
exit
|
218
|
-
end
|
219
|
-
alias_method :gets_bytestr, :gets_s
|
220
|
-
alias_method :gets_hex, :gets_s
|
221
|
-
|
222
|
-
#
|
223
|
-
# returns an array of data bytes such as
|
224
|
-
# [144, 60, 100, 128, 60, 100, 144, 40, 120]
|
225
|
-
#
|
226
|
-
def gets_data(*a)
|
227
|
-
arr = gets
|
228
|
-
arr.map { |msg| msg[:data] }.inject(:+)
|
229
|
-
end
|
230
|
-
|
231
|
-
#
|
232
|
-
# returns a string of data such as
|
233
|
-
# "90406080406090447F"
|
234
|
-
#
|
235
|
-
def gets_data_s(*a)
|
236
|
-
arr = gets_bytestr
|
237
|
-
arr.map { |msg| msg[:data] }.join
|
238
|
-
end
|
239
|
-
alias_method :gets_data_bytestr, :gets_data_s
|
240
|
-
alias_method :gets_data_hex, :gets_data_s
|
241
|
-
|
242
|
-
# clears the buffer
|
243
|
-
def clear_buffer
|
244
|
-
@device.buffer.clear
|
245
|
-
end
|
246
|
-
|
247
|
-
# gets any messages in the buffer in the same format as CongruousApiInput#gets
|
248
|
-
def gets_buffer(*a)
|
249
|
-
@device.buffer
|
250
|
-
end
|
251
|
-
|
252
|
-
# gets any messages in the buffer in the same format as CongruousApiInput#gets_s
|
253
|
-
def gets_buffer_s(*a)
|
254
|
-
@device.buffer.map { |msg| msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data]); msg }
|
255
|
-
end
|
256
|
-
|
257
|
-
# gets any messages in the buffer in the same format as CongruousApiInput#gets_data
|
258
|
-
def gets_buffer_data(*a)
|
259
|
-
@device.buffer.map { |msg| msg[:data] }
|
260
|
-
end
|
261
|
-
|
262
|
-
# returns all inputs
|
263
|
-
def self.all
|
264
|
-
UniMIDI::Device.all_by_type[:input]
|
265
|
-
end
|
266
|
-
|
267
|
-
end
|
268
|
-
|
269
|
-
class CongruousApiOutput
|
270
|
-
|
271
|
-
include CongruousApiAdapter::Device
|
272
|
-
extend CongruousApiAdapter::Device::ClassMethods
|
273
|
-
|
274
|
-
# sends a message to the output. the message can be:
|
275
|
-
#
|
276
|
-
# bytes eg output.puts(0x90, 0x40, 0x40)
|
277
|
-
# an array of bytes eg output.puts([0x90, 0x40, 0x40])
|
278
|
-
# or a string eg output.puts("904040")
|
279
|
-
# if none of those types are found, unimidi will attempt
|
280
|
-
# to call to_bytes and then to_a on the object
|
281
|
-
#
|
282
|
-
def puts(*a)
|
283
|
-
case a.first
|
284
|
-
when Array then puts_bytes(*a.first)
|
285
|
-
when Numeric then puts_bytes(*a)
|
286
|
-
when String then puts_s(*a)
|
287
|
-
else
|
288
|
-
if a.first.respond_to?(:to_bytes)
|
289
|
-
puts_bytes(*a.first.to_bytes.flatten)
|
290
|
-
elsif a.first.respond_to?(:to_a)
|
291
|
-
puts_bytes(*a.first.to_a.flatten)
|
292
|
-
end
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
# sends a message to the output in a form of a string eg "904040". this method does not do
|
297
|
-
# type checking and therefore is more performant than puts
|
298
|
-
def puts_s(*a)
|
299
|
-
@device.puts_s(*a)
|
300
|
-
end
|
301
|
-
alias_method :puts_bytestr, :puts_s
|
302
|
-
alias_method :puts_hex, :puts_s
|
303
|
-
|
304
|
-
# sends a message to the output in a form of bytes eg output.puts_bytes(0x90, 0x40, 0x40).
|
305
|
-
# this method does not do type checking and therefore is more performant than puts
|
306
|
-
def puts_bytes(*a)
|
307
|
-
@device.puts_bytes(*a)
|
308
|
-
end
|
309
|
-
|
310
|
-
# returns all outputs
|
311
|
-
def self.all
|
312
|
-
UniMIDI::Device.all_by_type[:output]
|
313
|
-
end
|
314
|
-
|
315
|
-
end
|
316
|
-
|
317
|
-
class CongruousApiDevice
|
318
|
-
extend CongruousApiAdapter::Device::ClassMethods
|
319
|
-
end
|
320
|
-
|
321
|
-
end
|