[Cs-dev] more SWIG generated code issues
Date | 2005-11-17 14:36 |
From | Victor Lazzarini |
Subject | [Cs-dev] more SWIG generated code issues |
I have been looking at and playing a little bit with the SWIG-generated wrappers for the API (mainly Java), and I have a few comments. The first is in relation to certain API functions, the ones that are used to set callbacks for various things; for instance csoundSetInputValueCallback(). I'm not completely sure it is possible to use them in Java or Python in the current state. I don't think we can, because they use C function pointer types which do not seem to be usable, as there seems to be no converting methods for them (at least in Java). Can you have something akin to function pointers in these languages? I see that it might be possible perhaps in Java. However I don't think it is possible to use it in the current state. So my point is: should we keep these API methods, even if they are useless? Would it not look a little untidy and unelegant to be offering something that looks interesting, but in the end is not? Would it not cause confusion? My second point is that, with much of this functionality lost, a lot of what a language wrapper can do is also lost. Take for instance, getting access to a named IO channel. I don't see how I can use the Csound method public int GetChannelPtr(SWIGTYPE_p_p_float p, String name, int type) in Java. It might be possible (and someone please show me how to), but I don't think there is a way of dealing with SWIGTYPE_p_p_float p, I can't see any public methods to provide any access to it. But I don't know any real Java and I am just a C++ programmer guessing it. A way forward? Do it by hand. I know this might not be attractive to anyone, but certain things can only be done by hand. For instance a C function or C++ method could be used to retrieve values from a named channel (in the case above). A simple set of functions could be created to provide an interface to invalue and outvalue, creating lists of channels, in the case of the other control channel system, and so on. In other words, create an intermediary interface to the C API .In addition, it is possible that many API functions cannot be translated into Java or Python, and these are not included. In any case, I might be wrong and it is possible to use all the SWIG supplied interface in both Java and Python. In that case just tell me to shut up and show me how to do it. Thanks Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2005-11-17 14:52 |
From | Istvan Varga |
Subject | Re: [Cs-dev] more SWIG generated code issues |
Victor Lazzarini wrote: > So my point is: should we keep these API methods, even if they > are useless? Would it not look a little untidy and unelegant to be offering > something that looks interesting, but in the end is not? Would it not > cause confusion? I can add #ifndef SWIG to those functions in csound.h and csound.hpp if needed. > My second point is that, with much of this functionality lost, a lot of > what a language wrapper can do is also lost. Take for instance, getting > access to a named IO channel. I don't see how I can use the Csound > method You also have Csound::SetChannel(const char *name, MYFLT value) Csound::SetChannel(const char *name, const char *value) MYFLT Csound::GetChannel(const char *name) This is somewhat limited and also not as efficient as using GetChannelPtr() (as you always look up the channel name, and not just once as in the case of a C/C++ host), but the above methods do work at least in Python. ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2005-11-17 15:06 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] more SWIG generated code issues |
So at least the channel functionality is there; that's fine then. No real need for inputvalue, outputvalue functions unless compatibility is needed. Thanks for pointing that to me. I would be in favour of infdefing SWIG the C functions that don't translate. Victor At 14:52 17/11/2005, you wrote: >Victor Lazzarini wrote: > >>So my point is: should we keep these API methods, even if they >>are useless? Would it not look a little untidy and unelegant to be offering >>something that looks interesting, but in the end is not? Would it not >>cause confusion? > >I can add #ifndef SWIG to those functions in csound.h and csound.hpp >if needed. > >>My second point is that, with much of this functionality lost, a lot of >>what a language wrapper can do is also lost. Take for instance, getting >>access to a named IO channel. I don't see how I can use the Csound >>method > >You also have > >Csound::SetChannel(const char *name, MYFLT value) >Csound::SetChannel(const char *name, const char *value) >MYFLT Csound::GetChannel(const char *name) > >This is somewhat limited and also not as efficient as using GetChannelPtr() >(as you always look up the channel name, and not just once as in the case >of a C/C++ host), but the above methods do work at least in Python. > > > >------------------------------------------------------- >This SF.Net email is sponsored by the JBoss Inc. Get Certified Today >Register for a JBoss Training Course. Free Certification Exam >for All Training Attendees Through End of 2005. For more info visit: >http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click >_______________________________________________ >Csound-devel mailing list >Csound-devel@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/csound-devel Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |