Csound Csound-dev Csound-tekno Search About

[Csnd] Problems accessing chn via the Csound Java API

Date2010-08-05 16:23
FromJacob Joaquin
Subject[Csnd] Problems accessing chn via the Csound Java API
Hi everybody!

I'm trying to pass data to a chn bus using the Csound Java API, and
failing miserably. Everything I'm doing in terms of communicating with
chn is based off of Jim Hearon's examples from his Csound Journal
article "Processing and csnd.jar."
(http://www.csounds.com/journal/issue11/Processing.html) It's been a
big help. Though unfortunately, his examples no longer run and I've
been unable to find working examples elsewhere on the net.

Using his examples, I've found the code that seems to be causing the
problem. The following conditional returns the error "Invalid memory
access of location 0x0 eip=0x42018a53":

if (csnd.csoundGetChannelPtr(mycsound, myptr, "pitch", mycontch |
myinputch) == 0)   { /* ... */ }


If anyone could either help in updating his examples, or point me to
other working examples, that would be much appreciated.

Best,
Jake

Date2010-08-05 16:47
FromVictor Lazzarini
Subject[Csnd] Re: Problems accessing chn via the Csound Java API
Why don't you use the GetChannel() method of the Csound class?


cs = new Csound()

...
pitch = cs.GetChannel("pitch")

On 5 Aug 2010, at 16:23, Jacob Joaquin wrote:

> Hi everybody!
>
> I'm trying to pass data to a chn bus using the Csound Java API, and
> failing miserably. Everything I'm doing in terms of communicating with
> chn is based off of Jim Hearon's examples from his Csound Journal
> article "Processing and csnd.jar."
> (http://www.csounds.com/journal/issue11/Processing.html) It's been a
> big help. Though unfortunately, his examples no longer run and I've
> been unable to find working examples elsewhere on the net.
>
> Using his examples, I've found the code that seems to be causing the
> problem. The following conditional returns the error "Invalid memory
> access of location 0x0 eip=0x42018a53":
>
> if (csnd.csoundGetChannelPtr(mycsound, myptr, "pitch", mycontch |
> myinputch) == 0)   { /* ... */ }
>
>
> If anyone could either help in updating his examples, or point me to
> other working examples, that would be much appreciated.
>
> Best,
> Jake
> --  
> The Csound Blog - http://csound.noisepages.com/
> Slipmat - http://slipmat.noisepages.com/
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-08-05 16:56
FromVictor Lazzarini
Subject[Csnd] Re: Problems accessing chn via the Csound Java API
The problem with that code is that it does not seem right. 
It uses 2 csound instances,  (CsoundInstance and mycsound) the first of which seems to be the operational one,
which is compiled. The second is created using the C API wrapper (csoundCreate()), but is only used
for the channel call, which fails probably because csound is not compiled.

Just remove if (csnd.csoundGetChannelPtr(mycsound, myptr, "pitch",
				mycontch | myinputch) == 0) 
and you should be OK.
If you want to use that if statement with the call to csoundGetChannelPtr(), then change the code
mycsound = csnd.csoundCreate(myvoid);
for
mycsound = csoundInstance.GetCsound();
[Not tested, but it's how it's done in C++, I suppose Java is similar]
Victor
On 5 Aug 2010, at 16:23, Jacob Joaquin wrote:

Hi everybody!

I'm trying to pass data to a chn bus using the Csound Java API, and
failing miserably. Everything I'm doing in terms of communicating with
chn is based off of Jim Hearon's examples from his Csound Journal
article "Processing and csnd.jar."
(http://www.csounds.com/journal/issue11/Processing.html) It's been a
big help. Though unfortunately, his examples no longer run and I've
been unable to find working examples elsewhere on the net.

Using his examples, I've found the code that seems to be causing the
problem. The following conditional returns the error "Invalid memory
access of location 0x0 eip=0x42018a53":

if (csnd.csoundGetChannelPtr(mycsound, myptr, "pitch", mycontch |
myinputch) == 0)   { /* ... */ }


If anyone could either help in updating his examples, or point me to
other working examples, that would be much appreciated.

Best,
Jake
--
The Csound Blog - http://csound.noisepages.com/
Slipmat - http://slipmat.noisepages.com/


Send bugs reports to the Sourceforge bug tracker
           https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2010-08-05 16:56
FromJacob Joaquin
Subject[Csnd] Re: Re: Problems accessing chn via the Csound Java API
On Thu, Aug 5, 2010 at 8:47 AM, Victor Lazzarini
 wrote:
> Why don't you use the GetChannel() method of the Csound class?

Because I had no idea it existed.  :)

Seriously though, I should have been looking at csound.hpp instead of
csound.h. Which would have potentially saved my many hours.  Your
solution is easy, and works right out of the box. So I'm happy now.
And no need to deal with csoundGetChannelPtr(). Thanks!

Best,
Jake