launchpad 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,6 +72,10 @@ For more details, see the examples. examples/color_picker.rb is the most complex
72
72
 
73
73
  == Changelog
74
74
 
75
+ === v.0.2.2
76
+
77
+ * single threading fix: prevent ThreadError when Launchpad::Interaction#stop is called within an action response
78
+
75
79
  === v.0.2.1
76
80
 
77
81
  * Launchpad::Interaction#close now properly stops interaction first
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{launchpad}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thomas Jachmann"]
12
- s.date = %q{2010-01-24}
12
+ s.date = %q{2010-02-24}
13
13
  s.description = %q{This gem provides an interface to access novation's launchpad programmatically. LEDs can be lighted and button presses can be evaluated using launchpad's MIDI input/output.}
14
14
  s.email = %q{tom.j@gmx.net}
15
15
  s.extra_rdoc_files = [
@@ -74,7 +74,7 @@ module Launchpad
74
74
  # Optional options hash:
75
75
  #
76
76
  # [<tt>:detached</tt>] <tt>true/false</tt>,
77
- # whether to detach the interaction, method is blocking when +false+
77
+ # whether to detach the interaction, method is blocking when +false+,
78
78
  # optional, defaults to +false+
79
79
  #
80
80
  # Errors raised:
@@ -90,7 +90,7 @@ module Launchpad
90
90
  @reader_thread ||= Thread.new do
91
91
  begin
92
92
  while @active do
93
- @device.read_pending_actions.each {|action| respond_to_action(action)}
93
+ @device.read_pending_actions.each {|action| Thread.new {respond_to_action(action)}}
94
94
  sleep @latency unless @latency <= 0
95
95
  end
96
96
  rescue Portmidi::DeviceError => e
@@ -1,3 +1,3 @@
1
1
  module Launchpad
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -278,4 +278,25 @@ class TestInteraction < Test::Unit::TestCase
278
278
 
279
279
  end
280
280
 
281
+ context 'regression tests' do
282
+
283
+ should 'not raise an exception when calling stop within a response in attached mode' do
284
+ i = Launchpad::Interaction.new
285
+ # strangely, you have to sleep 0.001 or do anything else before
286
+ # calling i.stop - the ThreadError won't be thrown otherwise...
287
+ i.response_to(:mixer, :down) {|i,a| sleep 0.001; i.stop}
288
+ i.device.stubs(:read_pending_actions).returns([{
289
+ :timestamp => 0,
290
+ :state => :down,
291
+ :type => :mixer
292
+ }])
293
+ assert_nothing_raised do
294
+ Thread.new do
295
+ i.start
296
+ end.join
297
+ end
298
+ end
299
+
300
+ end
301
+
281
302
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launchpad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Jachmann
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-24 00:00:00 +01:00
12
+ date: 2010-02-24 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency