markusschloesser / MackieC4_P3

A Mackie C4 Midi Remote Script for Ableton 11
20 stars 2 forks source link

import DEVICE_DICT for default device parameters #12

Closed BilldarBagdar closed 3 years ago

BilldarBagdar commented 3 years ago

Based on the details in the comment, I think you know that DEVICE_DICT is defined in ...Midi Remote Scripts/_Generics/Devices.py.

What I suspect though is that because you asked about importing it, that PyCharm puts a red underline on it, like it doesn't understand the reference. Is that correct?

If so, then I don't think you have completely set up your IDE references. If you are only referencing those decompiled remote scripts from Julien Bayle's web site, then you don't have the complete setup yet. What my buddy did for me, and I suspect you need to do for yourself (unless I can help), is to write a little Python script that recursively traverses your own Midi Remote Scripts install folder, decompiles every .pyc file it finds, and puts the decompiled .py files in a mirrored (decompiled) Midi Remote Scripts folder somewhere else on your drive. Then you bring that decompiled folder structure into your project as a "reference" just like the internet "remote scripts" are a reference now. In fact, you can remove the "public" reference, and just use your own (which you can refresh any time Ableton updates something and not have to wait for the website to update). None of the "Ableton specific" files in the "Midi Remote Scripts" folder are posted publicly. It seems to be an open secret, once you get serious about learning remote scripting, this fact appears to be something you need to figure out for yourself (or have a friend like I do who just knows their Python stuff :)).

After you have done this correctly, you should no longer see red underlines decorating DEVICE_DICT or get_parameter_by_name(). But you will still see red underlines decorating anything, like the "Live" object and/or some imports, that Live only provides at runtime.

I was able to load your repo "attached to" the same PyCharm project I was already using (so it is still a 2.7 environment). PyCharm decorates the fresh gitHub repo DEVICE_DICT with a red underline, but does not "red underline" the same things in my project from last year. Which tells me I need to associate that same dependency to the fresh repo, and also that you might need to do the same.

markusschloesser commented 3 years ago

no, I have successfully decompiled the Live11 b28 scripts that are relevant. And

  1. have them as additional root source in pycharm
  2. like I wrote in the pycharm community thread even managed to generate a stub, so that when I hover over Live/LOM stuff it even shows me the args etc But thanks for the kind offer! :-) The question/comment in the code is on a more meta level: Does it make more sense to get everything thru a "generic control surface" or, because the C4 has 32 knobs, do we need to do stuff manually
markusschloesser commented 3 years ago

oh and also: I made the decompiled Live 11 scripts available in a separate rep

BilldarBagdar commented 3 years ago

that is awesome. Great job. I have even more catching up to do. You have surprised and delighted me.

On the meta question, I doubt the number of knobs is a factor with any significant weight in a decision like that. The BCR2000 controller has 32 knobs and its default Remote script uses generics. But I also own the Arsenal BCR2000 script, and that script is heavily customized and doesn't necessarily use generics.

Is it possible to make one of the unused modes a "generics mode" just to try out features of working that way, or would it be much easier to start a "generic C4 remote script" by copying from (and editing) the default BCR2000 remote script instead of trying to bolt-on (or hack-in) generics to Leigh's base. I suspect the C4's LCD displays might not be supported by "the generics way". For example, if you can't customize and call on_display_update() from "generics", then I don't think we could use "generics". But replacing the entire "big list database" with a "generics based data structure" could also become a big win in terms of readability...

markusschloesser commented 3 years ago

I have added Hanz Petrov's old introduction to _framework classes to the wiki here. Very very helpful!

markusschloesser commented 3 years ago

DEVICE_DICT automatically comes from Live/LOM, so closing this for now