I recently implemented pitchshifting using the elasticx~ objects which I can’t distribute together with the rest of my code. In order to avoid maintaining two versions, I’d like to transparently instantiate the elastic object, and if that fails, use a common max object instead (such as wave~ or groove~).
Unfortunately, newdefault() will allow me to create the object, I just didn’t find a way to test whether the object creation was successful or not. If the external doesn’t exist, an error message is posted to the Max window. But testing the object reference (which should be null) with "if (myobject)" or "if (myobject.valid)" doesn’t really work out and seems to report true in any case.
I did succeed using the File object and the isopen method. Still, not the preferred solution as I would have to make explicit checks for OSX and WIN, due to different filetypes for externals (mxe vs. mxo).
any idea how to programmatically test for successful object creation ?