ModalityTeam / Modality-toolkit

A SuperCollider toolkit to simplify the creation of personal (electronic) instruments utilising hardware and software controllers of any kind.
http://modalityteam.github.io/
87 stars 26 forks source link

Confusing error message when passing a symbol to MKtl.new's second argument: could not find device #316

Closed madskjeldgaard closed 5 years ago

madskjeldgaard commented 5 years ago

Hello all

I recently started using Modality and I stumbled on this quirk that caused a bit of confusion for me (probably because the first argument is a symbol and the second a string). When (accidentally) passing a symbol as the second argument ("lookupNameOrDesc") instead of a string, it posts an error message about not being able to find a device. I think this can generally cause confusement for modality beginners.

Here's an example

c = MKtl('lp', '*lpd8');
// Results in the following error:

// HID: found 5 devices.
// 
// /* OSC devices not found automagically yet. Use OSCMon: */
// o = OSCMon.new.enable.show;
// Meta_MKtl:new: could not find device for key *lpd8, cannot create MKtl(lp)!

c = MKtl('lp', "*lpd8"); // Whereas this works fine
LFSaw commented 5 years ago

Hello and welcome to Modality! I see your difficulties and the source of confusion. How would you think should this be resolved? I'd rather not add an additional step of converting the second argument into a String to prevent possible side-effect of such a fix. Maybe a note in the documentation is sufficient?

madskjeldgaard commented 5 years ago

Well to be honest, I think I get confused by because the string-to-symbol conversion is done automatically so many other places in SC (like SynthDef("someString") or Ndef("stringamathing")). But looking at the source code for for MKtl.new I can see how that's not a possible solution at the moment so maybe a big fat warning in the documentation would be good at the moment :)

adcxyz commented 5 years ago

Hi Mads, I explained this more clearly in MKtl.schelp / MKtl:new, and expanded the failure infos, should be there when you update/re-checkout the quark.

c = MKtl('lp2', 'Nonono'); 
// posts: 
Meta_MKtl:new: lookupNameOrDesc 'Nonono' was a Symbol, which looks for present devices in 
MKtlLookup.all;
No matching device was found, so could not create MKtl('lp2').
Maybe try with a string, which looks for a desc file?-> nil

c = MKtl('lp2', "*nope"); 
// posts:
Meta_MKtl:new: lookupNameOrDesc "*nope" was a String, which looks for description files in 
MKtlDesc.allDescs;
No matching description was found, so could not create MKtl('lp2').
Maybe try with a symbol, which looks for a present device?-> nil

Hope this is better? best adc

adcxyz commented 5 years ago

@madskjeldgaard - if good enough, please close this issue ;-)

madskjeldgaard commented 5 years ago

Looks great. Thanks!