ListChannels(controlChannelInfo_t* &lst) Usage?
| Date | 2015-06-04 14:56 |
| From | fumanwho |
| Subject | ListChannels(controlChannelInfo_t* &lst) Usage? |
Hi list
I want to get the names of all channels, and use them to automatically build
OSC addresses.
I can get at some member variables returned by ListChannels().
controlChannelInfo_t* chanList = NULL;
int numOfChans = csnd->ListChannels(&chanList);
std::cout << "INFO Number of channels returned = " << numOfChans <<
std::endl;
std::cout << "INFO Name of 1st chan = " << chanList->name << std::endl;
std::cout << "INFO Type of 1st chan = " << chanList->type << std::endl;
Does ListChannels() return a pointer to a list of structs? If so how do i
access these structs?
--
View this message in context: http://csound.1045644.n5.nabble.com/ListChannels-controlChannelInfo-t-lst-Usage-tp5742010.html
Sent from the Csound - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2015-06-04 17:05 |
| From | Rory Walsh |
| Subject | Re: ListChannels(controlChannelInfo_t* &lst) Usage? |
| Attachments | None None |
Can you use an array operator with the returned list, as in chanList[n]... I used to have some code lying around that did this, but I can't seem to find it now. On 4 June 2015 at 14:56, fumanwho <skell999@gmail.com> wrote: Hi list |
| Date | 2015-06-04 17:36 |
| From | fumanwho |
| Subject | Re: ListChannels(controlChannelInfo_t* &lst) Usage? |
I have tried this.
std::cout << "INFO Name of 1st chan = " << chanList[1]->name << std::endl;
But i get a compile error
error: base operand of '->' has non-pointer type 'controlChannelInfo_t {aka
controlChannelInfo_s}'|
I have also tried to get at the next struct with this
controlChannelInfo_t* testList = chanList + (sizeof(controlChannelInfo_t));
std::cout << "INFO Type of 2nd chan = " << chanList->type << std::endl;
This causes the console to pause printing just after the "INFO Type of 2nd
chan = " string.
--
View this message in context: http://csound.1045644.n5.nabble.com/ListChannels-controlChannelInfo-t-lst-Usage-tp5742010p5742015.html
Sent from the Csound - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2015-06-04 17:37 |
| From | fumanwho |
| Subject | Re: ListChannels(controlChannelInfo_t* &lst) Usage? |
Typo correction.
controlChannelInfo_t* testList = chanList + (sizeof(controlChannelInfo_t));
std::cout << "INFO Type of 2nd chan = " << testList->type << std::endl;
This causes the console to pause printing just after the "INFO Type of 2nd
chan = " string.
--
View this message in context: http://csound.1045644.n5.nabble.com/ListChannels-controlChannelInfo-t-lst-Usage-tp5742010p5742016.html
Sent from the Csound - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2015-06-05 13:36 |
| From | Rory Walsh |
| Subject | Re: ListChannels(controlChannelInfo_t* &lst) Usage? |
| Attachments | None None |
I managed to dig up my older code but it uses Csound5 structures that don't exist any more :( Are you on the Csound dev list? Might be best to ask there, where more people are familiar with those API routines. On 4 June 2015 at 17:37, fumanwho <skell999@gmail.com> wrote:
|
| Date | 2015-06-05 16:22 |
| From | fumanwho |
| Subject | Re: ListChannels(controlChannelInfo_t* &lst) Usage? |
Its a list of pointers to structs
This is the test code i used.
for (int i = 1; i < 62; i++)
{
std::cout << "INFO Index = " << i << std::endl;
controlChannelInfo_t* memAddr = chanList + i;
std::cout << "INFO Name chan = " << memAddr->name << std::endl;
std::cout << "INFO Type chan = " << memAddr->type << std::endl;
std::cout << "INFO Hints = " << memAddr->hints.attributes << std::endl;
}
This prints some info from all three channels in my csd then seg faults on
the fourth loop.
So all i have to do is increment the pointer that is passed to
ListChannels() to get at each struct.
Cheers rory
--
View this message in context: http://csound.1045644.n5.nabble.com/ListChannels-controlChannelInfo-t-lst-Usage-tp5742010p5742020.html
Sent from the Csound - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2015-06-05 20:47 |
| From | Rory Walsh |
| Subject | Re: ListChannels(controlChannelInfo_t* &lst) Usage? |
| Attachments | None None |
Nice one. On 5 June 2015 at 16:22, fumanwho <skell999@gmail.com> wrote: Its a list of pointers to structs |