Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Java slider demo

Date2008-01-28 17:46
FromPINOT Francois
SubjectRe: [Cs-dev] Java slider demo
Hello,

I tried to compile this slider demo too and I got the same error 
messages. I compared the csnd.jar from my current csound version (5.07) 
to the old csound versions and here is what I found:

until csound5.04 (2006-11-10), the signature of the 
csnd.Csound.GetChannelPtr method was:
     public int GetChannelPtr(csnd.SWIGTYPE_p_p_double, 
java.lang.String, int);

from csound5.05 (2007-03-08), it has been changed to:
     public int GetChannelPtr(csnd.SWIGTYPE_p_double, java.lang.String, 
int);

I think the latter is wrong because the corresponding entry in 
csound.hpp is:
     virtual int GetChannelPtr(MYFLT* &p, const char *name, int type)

where the first param is a reference to a MYFLT pointer which means that 
the type generated by SWIG in the java interface for that param should 
be csnd.SWIGTYPE_p_p_double instead of csnd.SWIGTYPE_p_double

Actually I modified the demo by adding this line after the
' Csound csound = new Csound(); ' line in the variables declaration part:
     SWIGTYPE_p_CSOUND_ csInstance = csound.GetCsound();

Then I modified the two statements with GetChannelPtr to this:
   if (csnd.csoundGetChannelPtr(csInstance, myfltarray.GetPtr(), "pitch",
         csndConstants.CSOUND_INPUT_CHANNEL |
         csndConstants.CSOUND_CONTROL_CHANNEL) == 0)

Doing so, I use the csnd.csoundGetChannelPtr static method which, 
fortunately, works fine. This hack isn't very nice because it mixes 
low-level static methods with higher level class usage, but it works.

BTW I produced for my own use a pdf file with the description of the 
java interface classes and methods (using the javap disassembler applied 
to the csnd.jar archive content). You can get this file here:

http://perso.numericable.fr/~fpinotfran36/fp.carnets/csound/manual-fr/

the file name is 'csnd.jar.pdf'

If people are interested, I can maintain an updated version of this pdf 
file for the next releases, provided I get the csnd.jar archive before 
the release (it's not heavy, about 80Ko, and thus can be attached to a 
mail).

Best regards

François


On Jan 20, 2008 10:01 AM, kalma  wrote:
 >
 > Hello
 >
 > I was trying to compile the slider demo from Csound journal summer 
2006, but
 > it seems gives these error messages:
 >
 > SliderDemo.java:180:
 > SliderDemo.java:180: 
GetChannelPtr(csnd.SWIGTYPE_p_double,java.lang.String,int) in 
csnd.Csound cannot be applied to
 > (csnd.SWIGTYPE_p_p_double,java.lang.String,int)
 > if(csound.GetChannelPtr(myfltarray.GetPtr(), "pitch",

 > SliderDemo.java:217: 
GetChannelPtr(csnd.SWIGTYPE_p_double,java.lang.String,int) in 
csnd.Csound cannot be applied to
 >  (csnd.SWIGTYPE_p_p_double,java.lang.String,int)
 > if(csound.GetChannelPtr(myfltarray.GetPtr(), "pitch",

 > I was searching this mailing list archieves and somewhere was that 
GetChannel and SetChannel
 > should be used instead of those *ChannelPtr methods, but I couldn't 
find an example of it.

 > Is there working example of Csound java wrapper usage and or 
documentation how to use it?

 > Thanks,
 > Matti


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net