Confusing error message when passing a symbol to MKtl.new's second argument: could not find device
madskjeldgaard opened this issue · 5 comments
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
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?
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 :)
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
@madskjeldgaard - if good enough, please close this issue ;-)
Looks great. Thanks!