These are chat archives for brunchboy/afterglow

11th
Feb 2016
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:10
afterglow.examples=> 16-02-11 00:09:13 BG-X240 INFO [afterglow.midi] - Opened MIDI output: {:name "MK2 [hw:2,0,0]", :description "Launchpad MK2, USB MIDI, Launchpad MK2", :vendor "ALSA (http://www.alsa-project.org)", :version "3.19.0-49-generic", :sources 0, :sinks 2147483647, :info #object[com.sun.media.sound.MidiOutDeviceProvider$MidiOutDeviceInfo 0x583c0e2a "MK2 [hw:2,0,0]"], :device #object[com.sun.media.sound.MidiOutDevice 0x11141d29 "com.sun.media.sound.MidiOutDevice@11141d29"], :receiver #object[com.sun.media.sound.MidiOutDevice$MidiOutReceiver 0x38c28485 "com.sun.media.sound.MidiOutDevice$MidiOutReceiver@38c28485"]}
The REPL also says: Unable to load libCoreMidi4J.dylib, CoreMIDI4J will stay inactive: java.lang.UnsatisfiedLinkError: no CoreMIDI4J in java.library.path.
James Elliott
@brunchboy
Feb 11 2016 00:13
Yeah, that’s an artifact of the fact that the project puts CoreMIDI4J’s java classes on the classpath at compile time so it can build against it, but CoreMIDI4J only gets installed on Macs, it is harmless.
Those log messages should be going to a log file, but logging is not getting initialized until you do (use-sample-show). I still need to address that.
There is no nicely formatted map coming back, apart from the log lines? Try (use-sample-show) and then running it again.
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:16
afterglow.examples=> (clojure.pprint/pprint (afterglow.midi/open-inputs-if-needed!))
({:name "MK2 [hw:2,0,0]",
  :description "Launchpad MK2, USB MIDI, Launchpad MK2",
  :vendor "ALSA (http://www.alsa-project.org)",
  :version "3.19.0-49-generic",
  :sources 2147483647,
  :sinks 0,
  :info
  #object[com.sun.media.sound.MidiInDeviceProvider$MidiInDeviceInfo 0x8f4a17b "MK2 [hw:2,0,0]"],
  :device
  #object[com.sun.media.sound.MidiInDevice 0x6bf434f "com.sun.media.sound.MidiInDevice@6bf434f"],
  :transmitter
  #object[com.sun.media.sound.MidiInDevice$MidiInTransmitter 0x546be169 "com.sun.media.sound.MidiInDevice$MidiInTransmitter@546be169"]})
nil
this is the complete output.
after I evaluated use-sample-show.
James Elliott
@brunchboy
Feb 11 2016 00:17
Great, so it looks like just one port gets created under Linux. I wonder if that is true on other platforms? But for you we are going to be able to use "MK2" as a string to select the right port.
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:20
btw: do I need to restart the REPL after some clojure files were changed?
James Elliott
@brunchboy
Feb 11 2016 00:21
In general no. That is one of the great things about Clojure. You can tell it to load the file again. But I would really suggest you use an editor with an integrated REPL support, then you can just re-evaluate a form or a function definition on the fly, jump to where things were defined, and so on.
What is your usual editor of choice?
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:22
I have neovim with some clojure plugins that connect to nREPL server and cursive for IntelliJ, but in cursive the evaluation of parts of the source code didn't work
So I'll use neovim.
James Elliott
@brunchboy
Feb 11 2016 00:23
Cursive usually works great, one of my coworkers swears by it, and Colin offers great help on the mailing list. I think you’ll be a lot more productive in that if you can get it working, so it is worth trying a bit more.
I personally use Emacs and CIDER, but if you are not already an Emacs user I would not try to steer you in that direction.
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:31
I've started Cursive and imported Afterglow as Leiningen project. Source editor and local REPL work fine.
Ahh, and I can also switch REPL ns to current file and send the top form to the REPL.
Sending the form to REPL is (per default) "cpp" in vim and C-S-P in Cursive.
James Elliott
@brunchboy
Feb 11 2016 00:37
Yeah, there are lots of powerful things you can do. I am not a great resource on Cursive but I think you will find it very useful, and I know there are some good tutorials and introductory material for it out there.
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:40
Cursive's official user guide looks very clean and accessible.
James Elliott
@brunchboy
Feb 11 2016 00:41
It’s an amazing product. If I was more of an IDE than Emacs person, I would use it heavily.
Well, I would love to dive in and start writing the Mk2 mapping right now but I need to go to the gym and then eat dinner. Hopefully you have plenty to explore in the mean time. If you want to experiment with that, I plan to start with the Launchpad Mini as the basic framework, but substitute the RGB pad support from the Launchpad Pro. There will be some areas that are a hybrid of both, such as the lack of velocity support, and I am not sure if the MIDI note assignments are the same on the Mk2 and the Pro.
If you want to experiment with that, go ahead, but otherwise I should have a mapping for you to try within the next day or so.
(And I just pushed another version of launchpad_mini.clj.)
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:45
Nice, I'll check it out tomorrow. It's very late here (my timezone is europe/berlin).
James Elliott
@brunchboy
Feb 11 2016 00:46
Yes, I had noticed you were in Germany. Are you actually in Berlin? I have visited that city a few times, but too briefly.
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:46
I live 300 kilometers west of Berlin in Hannover.
James Elliott
@brunchboy
Feb 11 2016 00:47
(My timezone is US/Chicago, I am in Madison, a medium-sized University town and the capital of Wisconsin. Many German influences here, and the countryside reminds me a lot of East Germany.)
I have not visited Hannover, but would like to someday. For now, good night!
Benjamin Gudehus
@hastebrot
Feb 11 2016 00:47
See you.
James Elliott
@brunchboy
Feb 11 2016 05:59
All right, since your Mk2 has already arrived, I stayed up late tonight to try implementing support for it. As I hoped, it was very much a mix between the Mini and Pro, with Mini-style round buttons, and Pro-style LED colors. There were a few other differences, but it was not that difficult, especially since I have done so many of these recently.
James Elliott
@brunchboy
Feb 11 2016 06:06

I have not updated the documentation yet (other than the generated API docs), but once you have called (use-sample-show) you should be able to:

(require '[afterglow.controllers.launchpad-mk2 :as mk2])
(def mk2-watcher (mk2/auto-bind *show*))

And then whenever you connect your Mk2 after that (or if it was already connected), Afterglow should see it and start up the interface on it. To shut down the watcher as well as the controller binding:

(mk2/deactivate mk2-watcher)

Since I could not test this, chances are quite high I messed something up, but we should be able to debug it jointly, hopefully fairly quickly!

I don't know if there are labels (or stickers) for the top row of round buttons, but they are mapped as (↑) (↓) (←) (→) (tap-tempo) (shift) (user) (stop)

Benjamin Gudehus
@hastebrot
Feb 11 2016 22:17
It showed the animation and ended with three round buttons lit (user1, user2, mixer).
So you reuse the Pro keymap and set (stop) for the "Mixer" button?
Benjamin Gudehus
@hastebrot
Feb 11 2016 22:25
Ahh, I see they are defined in (def control-buttons ...).
Benjamin Gudehus
@hastebrot
Feb 11 2016 22:36
Does mk2-watcher contain the :controller key I need for instance for mk2/show-round-buttons and mk2/set-pad-color?
Benjamin Gudehus
@hastebrot
Feb 11 2016 22:47
I tried this:
(mk2/set-pad-color (mk2-watcher :controller) 1 2 (create-color 128))
James Elliott
@brunchboy
Feb 11 2016 23:58
It sounds like you don’t have any cues present, which (use-sample-show) should have set up for you, there should be four pages of them to scroll through. I can’t quite use the Pro map, because some of those buttons are down the left side, which don’t exist on the Mk2.
The watcher does contain the controller object, but while the controller is running, you won’t be able to visibly affect the pad colors, because they are getting updated with current cue status fifteen times per second.