MrJoy / surface_master

A gem for accessing various MIDI controllers, including the Novation Launchpad, and Numark Orbit programmatically and easily.
MIT License
0 stars 0 forks source link

undefined method `change' for #<SurfaceMaster::Launchpad::Device:0x0055d7fd1e6178> (NoMethodError) #1

Open movitto opened 6 years ago

movitto commented 6 years ago

Hey there! I just gave your surface_master project a quick whirl but was unable to get the 'launchpad_playground' example working. I didn't spend an extensive amount of time on it but figure I'd shout out here.

The first issue was similar to https://github.com/thomasjachmann/launchpad/pull/7 in that the library isn't correctly detecting the launchpad mini. By changing the following line, it can be made compatible but obviously removes support for the MK2:

diff --git a/lib/surface_master/launchpad/device.rb b/lib/surface_master/launchpad/device.rb
index 31ad4c9..3136e3d 100644
--- a/lib/surface_master/launchpad/device.rb
+++ b/lib/surface_master/launchpad/device.rb
@@ -5,7 +5,7 @@ module SurfaceMaster
       include MIDICodes

       def initialize(opts = nil)
-        @name = "Launchpad MK2"
+        @name = "Launchpad Mini MIDI 1"
         super(opts)
         reset! if output_enabled?
         raw         = (0..8)

The next error seemed to be more involved:

$ ruby -Ilib ./examples/launchpad_playground.rb 
D, [2018-01-21T09:14:44.335627 #17876] DEBUG -- : Initializing SurfaceMaster::Launchpad::Interaction#47420070064800 with {}
D, [2018-01-21T09:14:44.335871 #17876] DEBUG -- : writing messages to launchpad:
  {:message=>[176, 0, 0], :timestamp=>0}
D, [2018-01-21T09:14:44.336430 #17876] DEBUG -- : Setting response to :grid for state :both with nil
D, [2018-01-21T09:14:44.336508 #17876] DEBUG -- : Setting response to :scene1 for state :down with nil
D, [2018-01-21T09:14:44.336548 #17876] DEBUG -- : Setting response to :scene2 for state :down with nil
D, [2018-01-21T09:14:44.336602 #17876] DEBUG -- : Setting response to :scene3 for state :down with nil
D, [2018-01-21T09:14:44.336655 #17876] DEBUG -- : Setting response to :scene4 for state :down with nil
D, [2018-01-21T09:14:44.336689 #17876] DEBUG -- : Setting response to :mixer for state :down with nil
/home/mmorsi/workspace/lp/surface_master/lib/surface_master/interaction.rb:22:in `change': undefined method `change' for #<SurfaceMaster::Launchpad::Device:0x005641b0dcd320> (NoMethodError)
Did you mean?  changes
    from ./examples/launchpad_playground.rb:177:in `<main>'

I notice that this 'change' method is not defined in either of the launchpad or touch_osc device classes. This is where is stopped debugging.

Hope this helps!

MrJoy commented 6 years ago

This was all code written in a sleep-deprived, fevered state (wedding prep). I suspect I got caught up mid-way through refactoring / redesigning things and never came back to it. As such the examples are probably pretty grossly out of date. You might try poking around in the git history to find a stable point to branch off from.

MrJoy commented 6 years ago

This commit is probably the root of your issue. So you could either update the launchpad playground to the new interface implied by this, or cut a branch of this commit's parent and go from there:

https://github.com/MrJoy/surface_master/commit/7a5d7f067b19c796c25611df8731a2aa81d6cd23