| I am trying to add more functionality to the GUI controls provided by
lettuce by allowing for two-way communication between Csound and the
host app's that Lettuce can generate. I would like for example to allow
users to be able to change a label in their host application by calling
*chnset* in Csound. The following line of code will create a label in
the host app with a default value of "caption"
label "chanName", width, height, top, left, "caption", "colour"
I would like if "caption" would remain the label text *until* chnset is
called in Csound. As it stands each host app has a timer that keeps
calling GetValueOutChannel(see below), which in turn calls
csoundGetChannelPtr(), which then sends data to the label channel which
in turn overwrites "caption". The main issue here is that
csoundGetChannelPtr() will create the channel is it does not already
exist, and it seems to initialise it to 0. In my timer function(see
below) I was doing a simple test, if(GetValueOutChannel()!=0) then
update label, but as you can imagine this didn't work so well
considering users would often like to send 0 to the label. So my
question is how can I prevent data from being sent on a particular
software channel until a call is made to *chnset*? I hope I have
explained my self well, has anyone any suggestions?
Rory.
//-------------------------------------------------------------------
MYFLT GetValueOutChannel(CSOUND *cs, AnsiString name)
{
MYFLT *pvalue;
int result;
result =
csoundGetChannelPtr(cs, &pvalue, name.c_str(),
CSOUND_OUTPUT_CHANNEL | CSOUND_CONTROL_CHANNEL);
return *pvalue;
}
//-------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
for(int i=0;i(guiObj[i]))
{
if(GetValueOutChannel(pd->instance, channelname[i])!=0)
((TPanel*)guiObj[i])->Caption=
(AnsiString)GetValueOutChannel(pd->instance, channelname[i]);
}
etc, etc......
}
}
P.S. guiObj is a vector of GUI objects while channelname is a vector of
strings, and AnsiString is a Borland string type. It's ok to cast a
value as an AnsiString in the fashion above without any problems.
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 |