Closed umlaeute closed 5 years ago
Do you have an example of "simple" project that implements loaders that I could base my work on ?
Thanks
i hope to find time in the next days to provide a rough implementation.
(Pd-0.47 has changed the interface slightly, and i would like to support both the old and the new one)
note: as mentioned in #11, a loader is closely related to the upcoming/potential [jxrt~]
object
I've just pushed the jxrt~ implementation on master. Unlike that jsusfx~ object, sliders (that are now mapped on inlets) are expecting float values that are specified by the jsfx script.
It's a rough implementation and I have questions that I'm sure you will be able to answer :
Thanks.
ad 1: only the first inlet ad 2: "yes and no". iirc, you can go away without doing so, but it's rather easy to keep a reference of the iolets.
In file included from /Users/shree/Documents/Pd/jsusfx/pd/jsusfx_pd.cpp:23: /Users/shree/Documents/Pd/jsusfx/pd/../src/jsusfx.h:146:122: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] ...bool resolveImportPath(const std::string &importPath, const std::string &parentPath, std::string &resolvedPath) override; ^ /Users/shree/Documents/Pd/jsusfx/pd/../src/jsusfx.h:147:89: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] virtual bool resolveDataPath(const std::string &importPath, std::string &resolvedPath) override; ^ /Users/shree/Documents/Pd/jsusfx/pd/../src/jsusfx.h:149:54: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] virtual std::istream open(const std::string &path) override; ^ /Users/shree/Documents/Pd/jsusfx/pd/../src/jsusfx.h:150:44: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions] virtual void close(std::istream &stream) override; ^ /Users/shree/Documents/Pd/jsusfx/pd/jsusfx_pd.cpp:93:17: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int midiPre = 0, midiExpt = 0; ^ /Users/shree/Documents/Pd/jsusfx/pd/jsusfx_pd.cpp:93:31: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int midiPre = 0, midiExpt = 0; ^ /Users/shree/Documents/Pd/jsusfx/pd/jsusfx_pd.cpp:95:21: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] int midiOutSize = 0; ^ /Users/shree/Documents/Pd/jsusfx/pd/jsusfx_pd.cpp:153:34: error: read-only variable is not assignable midi[midiSize++] = midiPreStream[i];
7 warnings and 1 error generated.
make[2]: *** [CMakeFiles/jsusfx_pd_project.dir/jsusfx_pd.cpp.o] Error 1
make[1]: *** [CMakeFiles/jsusfx_pd_project.dir/all] Error 2
@shreeswifty how is this related to the "Pd-loader support" that is discussed in this issue? (if it is not related, please delete your comment, and raise a new issue)
@umlaeute , do you know a project that completely register and load an external class from the sys_register_loader ? From what I understand, you need to create a new class with the script name that inherit the jsfx~ class ? How can we do that ?
PD-Loader is now supported with a0543802b7fae4763746619ecd55f33fdbc63db9 but I didn't implemented the legacy loader since I cannot test this.
I didn't implemented the tilde over the name either ( [tubeharmonics]
works, but not [tubeharmonics~]
based on your previous example ) since it could lead to confusion. Let me know if you have an issue on this and think that all jsfx pd-loader object should be named with a tilde.
thanks for implementing. :tada:
i'm not sure, i can follow why you think that [tubeharmonics~]
will lead to confusion (and why [tubeharmonics]
won't).
i proposed to add the tilde because all signal-processing objects in Pd have the tilde (by convention). as such, i think it is confusing, if the jsusfx-objects don't.
it would be great if jsfx scripts could be used to implement Pd-objects.
e.g.
[tubeharmonics~]
could really be implemented astubeharmonics.jsfx
.there are subtle differences to using the
[jsusfx~]
object; e.g. one could provide an abstraction fallback that can be used on platforms that lack jsusfx.Pd's mechanism to implement that is called "loaders".