iainctduncan / scheme-for-pd

Pure Data port of the Scheme For Max external, providing an embedded S7 Scheme/Lisp interpreter for scripting and live-coding Pure Data in Scheme Lisp.
BSD 3-Clause "New" or "Revised" License
66 stars 5 forks source link

errors when loading object #11

Closed porres closed 2 years ago

porres commented 3 years ago

testing release candidate 1 I get this and can't make it stop. Need clear documentation

Screen Shot 2021-10-03 at 18 44 21
iainctduncan commented 3 years ago

Can you try adding s4pd/scm (not just s4pd) to your path and tell me if that does it? the object needs to find the scm files, which when you check out the code, are in the "scm" directory of the proejct. I mention this in the Readme, but if it's not adequately clear I can certainly improve it!

iainctduncan commented 3 years ago

In the screenshot here, you can see my file preferences have the path where the scm files live added, which depends on where you checked out and built the code:

Screen Shot 2021-10-03 at 3 11 51 PM
porres commented 3 years ago

I just downloaded the mac zipped release, which unpacks to a 's4pd' folder, which I moved to externals.

this folder has no 'scm' subfolder (so there's nothing in it) - so yeah, this is confusing.

The help file also just says "The s4pd object takes 2 optional arguments, an integer for number of outlets, and a filename to load, searching the Pd filepath."

for the "Pd filpath" I understand it is the same folder the opened patch lives and the ones in Pd's added user search paths and the one in declare, so yeah, it's confusing, and it's also how pd objects usually work - so I suggest you do it like that, or is it something you can't really do?

iainctduncan commented 3 years ago

Ah ok I see how we have wires crossed, I thought you were building from source. The readme says it's ready for building from source and you are using a pre-release, which I have not advertised as ready, so yes, it's not package ready. The directions are for building from source, and the users who have tried it out so far have been doing that. I will try to attend to these soon and let you know so that we can test the package. I really don't have experience with Pd packaging.

Thanks for the bug reports!

iainctduncan commented 3 years ago

Hi Alex, I just tried downloading the release candidate and put it in my pd externals file, and this worked. So I'm still trying to figure out what went wrong for you, and also still trying to figure out what the correct behaviour should be. I have two options: the scm files live in their own dir and you need to add that to the path, or they live in the same dir as the external and that folder just needs to go in ones path, or be expanded in your Pd externals directory. If you have an opinion on which is more common Pd behaviour, it would be great to know. I will also ask on the list.

iainctduncan commented 3 years ago

I have also updated the README with what I hope are better instructions, please let me know if these are clear now, thanks!

porres commented 3 years ago

did you put the download as it is? cause there's no 'smc' folder...

I also did compile it myself and the result is a just a folder, with no subfolders, and all files just in it.

So in both cases it seems you need to manually alter things, and that's bad. I did what you said manually, I created the subfolder, I put all the files there, I added the extra subfolder to the preferences path, but that just seems like a bad idea/process.

But what seems bad is that you have hardcoded things like that, which is not really intuitive and "pd-like".

It makes sense to me to have the smc files that [s4pd] needs to instanciate (those would be s4pd.scm and s4pd-schedule.scm, right?) in the same folder as the external, and then it just looks for these two there. This would actually be one default folder that pd generally looks for files and you could also hardcode it in the object - so no need for a 'smc' subfolder and also setting it up in the preferences, that seems like unnecessarily complicated.

Moreover, if you have a patch somewhere and you want to load files, it'd be good if the user could have more flexibility where to put them. Looking for it in the same folder as the patch is saved or wherever in the preferences paths is what's reasonable to me.

One can have a subfolder in the same folder of the patch called 'smc' or whatever and call files there by simply giving it a 'smcc/' prefix, this is what all externals I know do. I don't see why you'd have to make it differently.

Anyway, I hope you get what I mean.

cheers

iainctduncan commented 3 years ago

fixed in src, will update ticket when fixed in release candidate and help updated

porres commented 3 years ago

you don't need the [declare] on your help file anymore

but it'd be nice if the object could load these needed scm files at instantiation by automatically searching in the same folder it resides, so users don't need to use [declare -path scm] on other patches just so the object can find them

porres commented 3 years ago

you can use 'c_externdir' from m_imp.h to get the external directory, see https://github.com/porres/pd-cyclone/blob/master/cyclone_objects/binaries/cyclone_lib.c#L640

iainctduncan commented 3 years ago

that sounds promising, I'll try that. If it works, I can have it check for core scm files in user defined paths and fall back to the location of the external. thanks for the tip!

porres commented 3 years ago

I can have it check for core scm files in user defined paths and fall back to the location of the external.

but isn't s4pd.scm and s4pd-schedule.scm always in the location of the external? Isn't that how you're packaging it? Why not make it look there first? They're needed every time you create the external, right?

iainctduncan commented 3 years ago

An advanced user can override s4pd.scm to make their own prelude. So it does need to be easy to ensure the s4pd.scm that they want is found first. But I think this will work fine.

iainctduncan commented 3 years ago

I'm going to create a future enhancement ticket for adding the path to the external automatically and shelve this for now. Given that the user only has to set their path once in file preferences on install (or add declare path), and that users need to understand path searching to use s4pd, I think the requirement of adding the path is not too onerous for now. I don't want it blocking the other things on the bench, including porting the new stuff from Scheme for Max 0.3

iainctduncan commented 2 years ago

closing, satisfied with how this is working now.