Csound Csound-dev Csound-tekno Search About

[Cs-dev] Channels and types

Date2013-07-02 20:06
FromAndres Cabrera
Subject[Cs-dev] Channels and types
AttachmentsNone  None  
Hi,

To be able to check types in the generic invalue/outvalue callbacks, I am includeing "csound_standard_types.h" and then checking type with:

    if (channelType == &CS_VAR_TYPE_S) {
        ud->csEngine->passOutString(channelName, (const char *) channelValuePtr);
    }
    else if (channelType == &CS_VAR_TYPE_K){
        ud->csEngine->passOutValue(channelName, *((MYFLT *)channelValuePtr));
    }

Would this be a good way to do it? And how would this play together with user defined types, once this is available?

Cheers,
Andrés

Date2013-07-04 22:12
FromSteven Yi
SubjectRe: [Cs-dev] Channels and types
Hi Andres,

I think for now, comparing those internal types could work, but I
would imagine the correct way in the future would be to:

1. Query the defined types from csound to find a type by given
properties (maybe searching by it's var type name, using
csoundGetTypeWithVarTypeName)

2. Store that as a reference and use that to compare types.

That'd probably be the most generic way to do it.  Does that seem good to you?

Thanks!
steven

On Tue, Jul 2, 2013 at 3:06 PM, Andres Cabrera  wrote:
> Hi,
>
> To be able to check types in the generic invalue/outvalue callbacks, I am
> includeing "csound_standard_types.h" and then checking type with:
>
>     if (channelType == &CS_VAR_TYPE_S) {
>         ud->csEngine->passOutString(channelName, (const char *)
> channelValuePtr);
>     }
>     else if (channelType == &CS_VAR_TYPE_K){
>         ud->csEngine->passOutValue(channelName, *((MYFLT
> *)channelValuePtr));
>     }
>
> Would this be a good way to do it? And how would this play together with
> user defined types, once this is available?
>
> Cheers,
> Andrés
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-07-04 23:06
FromAndres Cabrera
SubjectRe: [Cs-dev] Channels and types
AttachmentsNone  None  
Hi Steven,

I think that sounds good. There could even be a function that describes or can cast the pointer to get data structures defined within Csound only, to avoid haveing to define the structure in C too.

Cheers,
Andrés


On Thu, Jul 4, 2013 at 2:12 PM, Steven Yi <stevenyi@gmail.com> wrote:
Hi Andres,

I think for now, comparing those internal types could work, but I
would imagine the correct way in the future would be to:

1. Query the defined types from csound to find a type by given
properties (maybe searching by it's var type name, using
csoundGetTypeWithVarTypeName)

2. Store that as a reference and use that to compare types.

That'd probably be the most generic way to do it.  Does that seem good to you?

Thanks!
steven

On Tue, Jul 2, 2013 at 3:06 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:
> Hi,
>
> To be able to check types in the generic invalue/outvalue callbacks, I am
> includeing "csound_standard_types.h" and then checking type with:
>
>     if (channelType == &CS_VAR_TYPE_S) {
>         ud->csEngine->passOutString(channelName, (const char *)
> channelValuePtr);
>     }
>     else if (channelType == &CS_VAR_TYPE_K){
>         ud->csEngine->passOutValue(channelName, *((MYFLT
> *)channelValuePtr));
>     }
>
> Would this be a good way to do it? And how would this play together with
> user defined types, once this is available?
>
> Cheers,
> Andrés
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel