Csound Csound-dev Csound-tekno Search About

[Cs-dev] retrieving channel type?

Date2013-05-10 15:56
FromRory Walsh
Subject[Cs-dev] retrieving channel type?
What's the handiest way of finding out the type of a channel? Something like:

int csoundGetChannelType(const char *name);

would be nice? This would return CSOUND_CONTROL_CHANNEL,
CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
of doing this already, but a little wrapper function would b nice all
the same.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-10 16:07
FromHenrik Andersson
SubjectRe: [Cs-dev] retrieving channel type?
AttachmentsNone  None  
Hi Rory,

Im new to csound since 2 days and have struggled with the api for both cs5 and cs6 just on your topic. Im currently implementing a music composer that will host csound instruments. I think having API for specific channel to get type is a not so usable at all, the best approach i have found (cs6) is still getting the list of channels and do processing while looping over the list. With that in mind i would like to see test defines like:

#define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)

if (CSOUND_IS_CONTROL_CHANNEL(chan->type))

What i ment is that the API is kind of limiting, somehow the host needs to enumerate the channel names and the only way to do that is by getting the list and while your at it, do what you need on the list.

Regards,

Henrik Andersson






2013/5/10 Rory Walsh <rorywalsh@ear.ie>
What's the handiest way of finding out the type of a channel? Something like:

int csoundGetChannelType(const char *name);

would be nice? This would return CSOUND_CONTROL_CHANNEL,
CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
of doing this already, but a little wrapper function would b nice all
the same.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-10 16:14
FromHenrik Andersson
SubjectRe: [Cs-dev] retrieving channel type?
AttachmentsNone  None  
There are also other ways to enumerate like:

while((name = csoundGetChannelName(p, idx))
{

}


2013/5/10 Henrik Andersson <henrik.4e@gmail.com>
Hi Rory,

Im new to csound since 2 days and have struggled with the api for both cs5 and cs6 just on your topic. Im currently implementing a music composer that will host csound instruments. I think having API for specific channel to get type is a not so usable at all, the best approach i have found (cs6) is still getting the list of channels and do processing while looping over the list. With that in mind i would like to see test defines like:

#define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)

if (CSOUND_IS_CONTROL_CHANNEL(chan->type))

What i ment is that the API is kind of limiting, somehow the host needs to enumerate the channel names and the only way to do that is by getting the list and while your at it, do what you need on the list.

Regards,

Henrik Andersson






2013/5/10 Rory Walsh <rorywalsh@ear.ie>
What's the handiest way of finding out the type of a channel? Something like:

int csoundGetChannelType(const char *name);

would be nice? This would return CSOUND_CONTROL_CHANNEL,
CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
of doing this already, but a little wrapper function would b nice all
the same.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-10 16:43
FromRory Walsh
SubjectRe: [Cs-dev] retrieving channel type?
But wouldn't a simple wrapper function be useful, whereby we would
only need to pass it the string, and the API would do the rest. Would
save us all from writing a whole lot of the same code over and over
again?

On 10 May 2013 16:07, Henrik Andersson  wrote:
> Hi Rory,
>
> Im new to csound since 2 days and have struggled with the api for both cs5
> and cs6 just on your topic. Im currently implementing a music composer that
> will host csound instruments. I think having API for specific channel to get
> type is a not so usable at all, the best approach i have found (cs6) is
> still getting the list of channels and do processing while looping over the
> list. With that in mind i would like to see test defines like:
>
> #define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)
>
> if (CSOUND_IS_CONTROL_CHANNEL(chan->type))
>
> What i ment is that the API is kind of limiting, somehow the host needs to
> enumerate the channel names and the only way to do that is by getting the
> list and while your at it, do what you need on the list.
>
> Regards,
>
> Henrik Andersson
>
>
>
>
>
>
> 2013/5/10 Rory Walsh 
>>
>> What's the handiest way of finding out the type of a channel? Something
>> like:
>>
>> int csoundGetChannelType(const char *name);
>>
>> would be nice? This would return CSOUND_CONTROL_CHANNEL,
>> CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
>> of doing this already, but a little wrapper function would b nice all
>> the same.
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-10 16:51
FromHenrik Andersson
SubjectRe: [Cs-dev] retrieving channel type?
AttachmentsNone  None  
Thats true if name is known to host and by now, and by now, as far 
as i have seen, the only way to get the name of a channel is to get
the channel list.

The issue here is that name is used as key, and the key is unknown
until you enumerate the available names. Another approach to this is
having and API like csoundGetChannelName(p, idx) like:

char *name = NULL;
int idx = 0;
int type;

while ((name=csoundGetChannelName(p, idx))!=NULL)
{
  type = csoundGetChannelType(name);
  if (type & CSOUND_CONTROL_CHANNEL)
  {
    ...
  }
  idx++;
}

With that kind of API your suggestion make sense, but it should not live
side by side with the csoundListChannels() imho...


/Henrik



2013/5/10 Rory Walsh <rorywalsh@ear.ie>
But wouldn't a simple wrapper function be useful, whereby we would
only need to pass it the string, and the API would do the rest. Would
save us all from writing a whole lot of the same code over and over
again?

On 10 May 2013 16:07, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Hi Rory,
>
> Im new to csound since 2 days and have struggled with the api for both cs5
> and cs6 just on your topic. Im currently implementing a music composer that
> will host csound instruments. I think having API for specific channel to get
> type is a not so usable at all, the best approach i have found (cs6) is
> still getting the list of channels and do processing while looping over the
> list. With that in mind i would like to see test defines like:
>
> #define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)
>
> if (CSOUND_IS_CONTROL_CHANNEL(chan->type))
>
> What i ment is that the API is kind of limiting, somehow the host needs to
> enumerate the channel names and the only way to do that is by getting the
> list and while your at it, do what you need on the list.
>
> Regards,
>
> Henrik Andersson
>
>
>
>
>
>
> 2013/5/10 Rory Walsh <rorywalsh@ear.ie>
>>
>> What's the handiest way of finding out the type of a channel? Something
>> like:
>>
>> int csoundGetChannelType(const char *name);
>>
>> would be nice? This would return CSOUND_CONTROL_CHANNEL,
>> CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
>> of doing this already, but a little wrapper function would b nice all
>> the same.
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-10 16:54
FromRory Walsh
SubjectRe: [Cs-dev] retrieving channel type?
So I should just use the channel list I have to get to begin with is
what your saying? Fair enough :)

On 10 May 2013 16:51, Henrik Andersson  wrote:
> Thats true if name is known to host and by now, and by now, as far
> as i have seen, the only way to get the name of a channel is to get
> the channel list.
>
> The issue here is that name is used as key, and the key is unknown
> until you enumerate the available names. Another approach to this is
> having and API like csoundGetChannelName(p, idx) like:
>
> char *name = NULL;
> int idx = 0;
> int type;
>
> while ((name=csoundGetChannelName(p, idx))!=NULL)
> {
>   type = csoundGetChannelType(name);
>   if (type & CSOUND_CONTROL_CHANNEL)
>   {
>     ...
>   }
>   idx++;
> }
>
> With that kind of API your suggestion make sense, but it should not live
> side by side with the csoundListChannels() imho...
>
>
> /Henrik
>
>
>
> 2013/5/10 Rory Walsh 
>>
>> But wouldn't a simple wrapper function be useful, whereby we would
>> only need to pass it the string, and the API would do the rest. Would
>> save us all from writing a whole lot of the same code over and over
>> again?
>>
>> On 10 May 2013 16:07, Henrik Andersson  wrote:
>> > Hi Rory,
>> >
>> > Im new to csound since 2 days and have struggled with the api for both
>> > cs5
>> > and cs6 just on your topic. Im currently implementing a music composer
>> > that
>> > will host csound instruments. I think having API for specific channel to
>> > get
>> > type is a not so usable at all, the best approach i have found (cs6) is
>> > still getting the list of channels and do processing while looping over
>> > the
>> > list. With that in mind i would like to see test defines like:
>> >
>> > #define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)
>> >
>> > if (CSOUND_IS_CONTROL_CHANNEL(chan->type))
>> >
>> > What i ment is that the API is kind of limiting, somehow the host needs
>> > to
>> > enumerate the channel names and the only way to do that is by getting
>> > the
>> > list and while your at it, do what you need on the list.
>> >
>> > Regards,
>> >
>> > Henrik Andersson
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2013/5/10 Rory Walsh 
>> >>
>> >> What's the handiest way of finding out the type of a channel? Something
>> >> like:
>> >>
>> >> int csoundGetChannelType(const char *name);
>> >>
>> >> would be nice? This would return CSOUND_CONTROL_CHANNEL,
>> >> CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
>> >> of doing this already, but a little wrapper function would b nice all
>> >> the same.
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> Learn Graph Databases - Download FREE O'Reilly Book
>> >> "Graph Databases" is the definitive new guide to graph databases and
>> >> their applications. This 200-page book is written by three acclaimed
>> >> leaders in the field. The early access version is available now.
>> >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> >> _______________________________________________
>> >> Csound-devel mailing list
>> >> Csound-devel@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Learn Graph Databases - Download FREE O'Reilly Book
>> > "Graph Databases" is the definitive new guide to graph databases and
>> > their applications. This 200-page book is written by three acclaimed
>> > leaders in the field. The early access version is available now.
>> > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> > _______________________________________________
>> > Csound-devel mailing list
>> > Csound-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/csound-devel
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-13 04:46
FromAndres Cabrera
SubjectRe: [Cs-dev] retrieving channel type?
AttachmentsNone  None  
Hi Henrik,

We're trying to keep the API as lean as possible (it's big enough!), so there would have to be a compelling use case to add a new function. I think that the way I imagine this being used (and encouraged) is that the channels are either set in the csd header using chn_k and friends, and then queried by the host (using csoundListChannels) just after compile before running starts. Then the host should keep this list.

The other usage I imagine, is the channels being created by the host (automatically using csoundGetChannelValue) and then used by instruments. The host then keeps track of the channels it has created.

I have been thinking of adding a csoundSetChannelChangedCallback to let the host know when a channel's properties (not its value) have been changed within the Csound engine, or when a new channel has been created.

What do you think?

Cheers,
Andrés



On Fri, May 10, 2013 at 8:51 AM, Henrik Andersson <henrik.4e@gmail.com> wrote:
Thats true if name is known to host and by now, and by now, as far 
as i have seen, the only way to get the name of a channel is to get
the channel list.

The issue here is that name is used as key, and the key is unknown
until you enumerate the available names. Another approach to this is
having and API like csoundGetChannelName(p, idx) like:

char *name = NULL;
int idx = 0;
int type;

while ((name=csoundGetChannelName(p, idx))!=NULL)
{
  type = csoundGetChannelType(name);
  if (type & CSOUND_CONTROL_CHANNEL)
  {
    ...
  }
  idx++;
}

With that kind of API your suggestion make sense, but it should not live
side by side with the csoundListChannels() imho...


/Henrik



2013/5/10 Rory Walsh <rorywalsh@ear.ie>
But wouldn't a simple wrapper function be useful, whereby we would
only need to pass it the string, and the API would do the rest. Would
save us all from writing a whole lot of the same code over and over
again?

On 10 May 2013 16:07, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Hi Rory,
>
> Im new to csound since 2 days and have struggled with the api for both cs5
> and cs6 just on your topic. Im currently implementing a music composer that
> will host csound instruments. I think having API for specific channel to get
> type is a not so usable at all, the best approach i have found (cs6) is
> still getting the list of channels and do processing while looping over the
> list. With that in mind i would like to see test defines like:
>
> #define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)
>
> if (CSOUND_IS_CONTROL_CHANNEL(chan->type))
>
> What i ment is that the API is kind of limiting, somehow the host needs to
> enumerate the channel names and the only way to do that is by getting the
> list and while your at it, do what you need on the list.
>
> Regards,
>
> Henrik Andersson
>
>
>
>
>
>
> 2013/5/10 Rory Walsh <rorywalsh@ear.ie>
>>
>> What's the handiest way of finding out the type of a channel? Something
>> like:
>>
>> int csoundGetChannelType(const char *name);
>>
>> would be nice? This would return CSOUND_CONTROL_CHANNEL,
>> CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
>> of doing this already, but a little wrapper function would b nice all
>> the same.
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-13 08:12
FromHenrik Andersson
SubjectRe: [Cs-dev] retrieving channel type?
AttachmentsNone  None  
Hi Andrés,

In my case of csound interfacing i have no what so ever need for a event driven channel callback,
and i actually cant see a use case for it. Remeber i have just used Csound for 4 days so im
pretty new to its capabilities.
imho, just keep the api clean and simple, extend if there is a big need for it and in this case
i cant even see the use for csoundSetChannelChangedCallback()

One thing i have stumbled upon is:

You can set rtaudio module to "null" with api csoundSetRTAudioModule(), but there is not
paralell function for rtmidi which makes the api some kind of broken, i need to pass "-+rtmidi=null"
as argument but not "-+rtaudio=null".


Maybe someone else have a better input to this.





2013/5/13 Andres Cabrera <mantaraya36@gmail.com>
Hi Henrik,

We're trying to keep the API as lean as possible (it's big enough!), so there would have to be a compelling use case to add a new function. I think that the way I imagine this being used (and encouraged) is that the channels are either set in the csd header using chn_k and friends, and then queried by the host (using csoundListChannels) just after compile before running starts. Then the host should keep this list.

The other usage I imagine, is the channels being created by the host (automatically using csoundGetChannelValue) and then used by instruments. The host then keeps track of the channels it has created.

I have been thinking of adding a csoundSetChannelChangedCallback to let the host know when a channel's properties (not its value) have been changed within the Csound engine, or when a new channel has been created.

What do you think?

Cheers,
Andrés



On Fri, May 10, 2013 at 8:51 AM, Henrik Andersson <henrik.4e@gmail.com> wrote:
Thats true if name is known to host and by now, and by now, as far 
as i have seen, the only way to get the name of a channel is to get
the channel list.

The issue here is that name is used as key, and the key is unknown
until you enumerate the available names. Another approach to this is
having and API like csoundGetChannelName(p, idx) like:

char *name = NULL;
int idx = 0;
int type;

while ((name=csoundGetChannelName(p, idx))!=NULL)
{
  type = csoundGetChannelType(name);
  if (type & CSOUND_CONTROL_CHANNEL)
  {
    ...
  }
  idx++;
}

With that kind of API your suggestion make sense, but it should not live
side by side with the csoundListChannels() imho...


/Henrik



2013/5/10 Rory Walsh <rorywalsh@ear.ie>
But wouldn't a simple wrapper function be useful, whereby we would
only need to pass it the string, and the API would do the rest. Would
save us all from writing a whole lot of the same code over and over
again?

On 10 May 2013 16:07, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Hi Rory,
>
> Im new to csound since 2 days and have struggled with the api for both cs5
> and cs6 just on your topic. Im currently implementing a music composer that
> will host csound instruments. I think having API for specific channel to get
> type is a not so usable at all, the best approach i have found (cs6) is
> still getting the list of channels and do processing while looping over the
> list. With that in mind i would like to see test defines like:
>
> #define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)
>
> if (CSOUND_IS_CONTROL_CHANNEL(chan->type))
>
> What i ment is that the API is kind of limiting, somehow the host needs to
> enumerate the channel names and the only way to do that is by getting the
> list and while your at it, do what you need on the list.
>
> Regards,
>
> Henrik Andersson
>
>
>
>
>
>
> 2013/5/10 Rory Walsh <rorywalsh@ear.ie>
>>
>> What's the handiest way of finding out the type of a channel? Something
>> like:
>>
>> int csoundGetChannelType(const char *name);
>>
>> would be nice? This would return CSOUND_CONTROL_CHANNEL,
>> CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are ways
>> of doing this already, but a little wrapper function would b nice all
>> the same.
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-13 11:57
FromRory Walsh
SubjectRe: [Cs-dev] retrieving channel type?
I on the other hand would be all over a
csoundSetChannelHintsChangedCallback() function. But it would have to
be coupled with a way of changing the hints at k-rate. Can this
already be done? But yes, it would be handy on the host side.



On 13 May 2013 08:12, Henrik Andersson  wrote:
> Hi Andrés,
>
> In my case of csound interfacing i have no what so ever need for a event
> driven channel callback,
> and i actually cant see a use case for it. Remeber i have just used Csound
> for 4 days so im
> pretty new to its capabilities.
> imho, just keep the api clean and simple, extend if there is a big need for
> it and in this case
> i cant even see the use for csoundSetChannelChangedCallback()
>
> One thing i have stumbled upon is:
>
> You can set rtaudio module to "null" with api csoundSetRTAudioModule(), but
> there is not
> paralell function for rtmidi which makes the api some kind of broken, i need
> to pass "-+rtmidi=null"
> as argument but not "-+rtaudio=null".
>
>
> Maybe someone else have a better input to this.
>
>
>
>
>
> 2013/5/13 Andres Cabrera 
>>
>> Hi Henrik,
>>
>> We're trying to keep the API as lean as possible (it's big enough!), so
>> there would have to be a compelling use case to add a new function. I think
>> that the way I imagine this being used (and encouraged) is that the channels
>> are either set in the csd header using chn_k and friends, and then queried
>> by the host (using csoundListChannels) just after compile before running
>> starts. Then the host should keep this list.
>>
>> The other usage I imagine, is the channels being created by the host
>> (automatically using csoundGetChannelValue) and then used by instruments.
>> The host then keeps track of the channels it has created.
>>
>> I have been thinking of adding a csoundSetChannelChangedCallback to let
>> the host know when a channel's properties (not its value) have been changed
>> within the Csound engine, or when a new channel has been created.
>>
>> What do you think?
>>
>> Cheers,
>> Andrés
>>
>>
>>
>> On Fri, May 10, 2013 at 8:51 AM, Henrik Andersson 
>> wrote:
>>>
>>> Thats true if name is known to host and by now, and by now, as far
>>> as i have seen, the only way to get the name of a channel is to get
>>> the channel list.
>>>
>>> The issue here is that name is used as key, and the key is unknown
>>> until you enumerate the available names. Another approach to this is
>>> having and API like csoundGetChannelName(p, idx) like:
>>>
>>> char *name = NULL;
>>> int idx = 0;
>>> int type;
>>>
>>> while ((name=csoundGetChannelName(p, idx))!=NULL)
>>> {
>>>   type = csoundGetChannelType(name);
>>>   if (type & CSOUND_CONTROL_CHANNEL)
>>>   {
>>>     ...
>>>   }
>>>   idx++;
>>> }
>>>
>>> With that kind of API your suggestion make sense, but it should not live
>>> side by side with the csoundListChannels() imho...
>>>
>>>
>>> /Henrik
>>>
>>>
>>>
>>> 2013/5/10 Rory Walsh 
>>>>
>>>> But wouldn't a simple wrapper function be useful, whereby we would
>>>> only need to pass it the string, and the API would do the rest. Would
>>>> save us all from writing a whole lot of the same code over and over
>>>> again?
>>>>
>>>> On 10 May 2013 16:07, Henrik Andersson  wrote:
>>>> > Hi Rory,
>>>> >
>>>> > Im new to csound since 2 days and have struggled with the api for both
>>>> > cs5
>>>> > and cs6 just on your topic. Im currently implementing a music composer
>>>> > that
>>>> > will host csound instruments. I think having API for specific channel
>>>> > to get
>>>> > type is a not so usable at all, the best approach i have found (cs6)
>>>> > is
>>>> > still getting the list of channels and do processing while looping
>>>> > over the
>>>> > list. With that in mind i would like to see test defines like:
>>>> >
>>>> > #define CSOUND_IS_CONTROL_CHANNEL(t) (t & CSOUND_CONTROL_CHANNEL)
>>>> >
>>>> > if (CSOUND_IS_CONTROL_CHANNEL(chan->type))
>>>> >
>>>> > What i ment is that the API is kind of limiting, somehow the host
>>>> > needs to
>>>> > enumerate the channel names and the only way to do that is by getting
>>>> > the
>>>> > list and while your at it, do what you need on the list.
>>>> >
>>>> > Regards,
>>>> >
>>>> > Henrik Andersson
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > 2013/5/10 Rory Walsh 
>>>> >>
>>>> >> What's the handiest way of finding out the type of a channel?
>>>> >> Something
>>>> >> like:
>>>> >>
>>>> >> int csoundGetChannelType(const char *name);
>>>> >>
>>>> >> would be nice? This would return CSOUND_CONTROL_CHANNEL,
>>>> >> CSOUND_AUDIO_CHANNEL or CSOUND_STRING_CHANNEL. I'm sure there are
>>>> >> ways
>>>> >> of doing this already, but a little wrapper function would b nice all
>>>> >> the same.
>>>> >>
>>>> >>
>>>> >>
>>>> >> ------------------------------------------------------------------------------
>>>> >> Learn Graph Databases - Download FREE O'Reilly Book
>>>> >> "Graph Databases" is the definitive new guide to graph databases and
>>>> >> their applications. This 200-page book is written by three acclaimed
>>>> >> leaders in the field. The early access version is available now.
>>>> >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> >> _______________________________________________
>>>> >> Csound-devel mailing list
>>>> >> Csound-devel@lists.sourceforge.net
>>>> >> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > ------------------------------------------------------------------------------
>>>> > Learn Graph Databases - Download FREE O'Reilly Book
>>>> > "Graph Databases" is the definitive new guide to graph databases and
>>>> > their applications. This 200-page book is written by three acclaimed
>>>> > leaders in the field. The early access version is available now.
>>>> > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> > _______________________________________________
>>>> > Csound-devel mailing list
>>>> > Csound-devel@lists.sourceforge.net
>>>> > https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>> >
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Learn Graph Databases - Download FREE O'Reilly Book
>>> "Graph Databases" is the definitive new guide to graph databases and
>>> their applications. This 200-page book is written by three acclaimed
>>> leaders in the field. The early access version is available now.
>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net