Csound Csound-dev Csound-tekno Search About

[Csnd] Sending strings in Android app

Date2013-06-15 00:44
Fromhcenteno
Subject[Csnd] Sending strings in Android app
Hello,

I'm trying to send strings to a Csound channel in an Android app. Is this
what SetString(String s, int maxLen) is for? For some reason it's failing
with this:

06-14 19:23:52.727: I/AndroidCsound(26693): INIT ERROR in instr 1: 
06-14 19:23:52.727: I/AndroidCsound(26693): channel already exists with
incompatible type

This is how I'm setting up the channel:
csChannels[7] = csoundObj.getInputChannelPtr("filename");

In my orchestra the channel is defined like this:
SFile chnget "filename"

Thanks,

Hector




--
View this message in context: http://csound.1045644.n5.nabble.com/Sending-strings-in-Android-app-tp5724527.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-06-15 01:46
FromSteven Yi
SubjectRe: [Csnd] Sending strings in Android app
Hi Hector,

I think getInputChannelPtr only returns k-rate var channels wrapped in
CsoundMYFLTArray's:

public CsoundMYFLTArray getInputChannelPtr(String channelName) {
                CsoundMYFLTArray ptr = new CsoundMYFLTArray(1);
                getCsound().GetChannelPtr(
                                ptr.GetPtr(),
                                channelName,

controlChannelType.CSOUND_CONTROL_CHANNEL.swigValue()
                                                |
controlChannelType.CSOUND_INPUT_CHANNEL.swigValue());
                return ptr;
        }

I think there isn't a really good wrapping of String channels in the
API currently.  You can use these methods though from the Csound
object:

  public void SetChannel(String name, String string) {
csndJNI.Csound_SetChannel__SWIG_1(swigCPtr, this, name, string);
  }

  public void GetStringChannel(String name, String string) {
    csndJNI.Csound_GetStringChannel(swigCPtr, this, name, string);
  }

(you can access the object from csoundObj.getCsound())

>From that method signature though, I'm not sure if GetStringChannel
will work to set the value in the string argument.  It seems like
really the API should be modified to be:

  public String GetStringChannel(String name) {
    ....
    return value;
  }

I'd give those two a try to see if you can get and set the value from
the channel.  If not, we can work on the API wrapping before the CS6
final release.

Thanks!
steven

On Fri, Jun 14, 2013 at 4:44 PM, hcenteno  wrote:
> Hello,
>
> I'm trying to send strings to a Csound channel in an Android app. Is this
> what SetString(String s, int maxLen) is for? For some reason it's failing
> with this:
>
> 06-14 19:23:52.727: I/AndroidCsound(26693): INIT ERROR in instr 1:
> 06-14 19:23:52.727: I/AndroidCsound(26693): channel already exists with
> incompatible type
>
> This is how I'm setting up the channel:
> csChannels[7] = csoundObj.getInputChannelPtr("filename");
>
> In my orchestra the channel is defined like this:
> SFile chnget "filename"
>
> Thanks,
>
> Hector
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Sending-strings-in-Android-app-tp5724527.html
> Sent from the Csound - General mailing list archive at Nabble.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"
>

Date2013-06-20 16:39
Fromhcenteno
Subject[Csnd] Re: Sending strings in Android app
Thank you Steven for your help. I haven't had a chance to test what you are
proposing since I opted to send the strings as a score entry using
sendScore(), which worked fine.



--
View this message in context: http://csound.1045644.n5.nabble.com/Sending-strings-in-Android-app-tp5724527p5724682.html
Sent from the Csound - General mailing list archive at Nabble.com.