Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use non visual MIDI message to reset rapid update pointer before chan…

…ge_all
  • Loading branch information...
commit 7b7defeb7a758c7c60d97741c964336ba5e02820 1 parent 012d623
@thomasjachmann authored
View
1  README.rdoc
@@ -72,6 +72,7 @@ For more details, see the examples. examples/color_picker.rb is the most complex
== Changelog
+* don't update grid button 0,0 before change_all (in order to reset rapid update pointer), use MIDI message without visual effect
* (at least) doubled the speed of change_all by not sending each message individually but sending them in one go (as an array)
=== v0.1.1
View
5 lib/launchpad/device.rb
@@ -157,8 +157,9 @@ def change_all(*colors)
# ensure that colors is at least and most 80 elements long
colors = colors.flatten[0..79]
colors += [0] * (80 - colors.size) if colors.size < 80
- # HACK switch off first grid LED to reset rapid LED change pointer
- output(Status::ON, 0, 0)
+ # send normal MIDI message to reset rapid LED change pointer
+ # in this case, set mapping mode to x-y layout (the default)
+ output(Status::CC, Status::NIL, GridLayout::XY)
# send colors in slices of 2
messages = []
colors.each_slice(2) do |c1, c2|
View
6 lib/launchpad/midi_codes.rb
@@ -44,6 +44,12 @@ module Velocity
TEST_LEDS = 0x7C
end
+ # Module defining MIDI data 2 codes for selecting the grid layout.
+ module GridLayout
+ XY = 0x01
+ DRUM_RACK = 0x02
+ end
+
end
end
View
8 test/test_device.rb
@@ -416,14 +416,14 @@ def stub_input(device, *args)
assert_nil @device.change_all([0])
end
- should 'fill colors with 0, set grid 0,0 to 0 and flush colors' do
- expects_output(@device, 0x90, 0, 0)
+ should 'fill colors with 0, set grid layout to XY and flush colors' do
+ expects_output(@device, 0xB0, 0, 0x01)
expects_output(@device, *([[0x92, 17, 17]] * 20 + [[0x92, 12, 12]] * 20))
@device.change_all([5] * 40)
end
- should 'cut off exceeding colors, set grid 0,0 to 0 and flush colors' do
- expects_output(@device, 0x90, 0, 0)
+ should 'cut off exceeding colors, set grid layout to XY and flush colors' do
+ expects_output(@device, 0xB0, 0, 0x01)
expects_output(@device, *([[0x92, 17, 17]] * 40))
@device.change_all([5] * 100)
end
Please sign in to comment.
Something went wrong with that request. Please try again.