Csound Csound-dev Csound-tekno Search About

[Cs-dev] formatting values being sent to software bus...

Date2006-06-23 09:45
FromRory Walsh
Subject[Cs-dev] formatting values being sent to software bus...
I am sending k-rate values to a host app from Csound using the software 
bus. Is there a way to format the values first before they are sent? For 
example I would like to format the float values to one decimal place 
before they are sent. Can this be done in Csound or will I have to 
implement this in the host software. Actually I have another question, 
I've been using csoundGetChannelPtr() to communicate with the software 
bus. This stores a pointer to the specified channel, but the pointer is 
to type MYFLT, so how can I send and receive strings this way? Cheers,

Rory.

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-23 10:48
FromIstvan Varga
SubjectRe: [Cs-dev] formatting values being sent to software bus...
AttachmentsNone  

Date2006-06-23 11:00
FromRory Walsh
SubjectRe: [Cs-dev] formatting values being sent to software bus...
Thanks Istvan. That answers all my questions!

Rory.



Istvan Varga wrote:
> On Friday 23 June 2006 10:45, Rory Walsh wrote:
> 
>> I am sending k-rate values to a host app from Csound using the software 
>> bus. Is there a way to format the values first before they are sent? For 
>> example I would like to format the float values to one decimal place 
>> before they are sent.
> 
> What do you mean by formatting the float value to one decimal place ?
> If you want to send it as a string, you can use sprintf:
> 
> Stmp sprintf "%.1f", ivalue
>      chnset Stmp, "ChannelName"
> 
> Or, if you just want to send a float but with rounding (note that this
> will not be accurate):
> 
>      chnset round(ivalue * 10) / 10, "ChannelName"
> 
>> Actually I have another question, I've been using csoundGetChannelPtr()
>> to communicate with the software bus. This stores a pointer to the
>> specified channel, but the pointer is to type MYFLT, so how can I send
>> and receive strings this way?
> 
> By casting the MYFLT* pointer to char* (if you are using C or C++; in
> Python or Java, the csnd.CsoundMYFLTArray class is used). The string
> channels are a buffer of characters with a size that can be queried
> with the csoundGetStrVarMaxLen() function which should be called after
> csoundCompile(). Note that you also need space for the NUL character
> that terminates the string, so if csoundGetStrVarMaxLen() returns 256,
> you can store 255 characters and a '\0'.
> 
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net