Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] pvsdemix in MacCsound (and other plugins)

Date2005-03-27 22:30
FromVictor Lazzarini
SubjectRe: [Cs-dev] pvsdemix in MacCsound (and other plugins)
I think that certainly it is better to be able to obtain
a pointer to a table rather than having to call
an API function to get a value each time.

The memory allocation function is there alright, but
you'd have to be able to de-allocate things, isn't it?
So it's not the same as the auxalloc mechanism, which
I think is one great thing that csound has.
I think the two things are there for different jobs.

Adding ftfind() etc to the API should be a good idea.
As it is, we can still use it, but if things are going to
be locked away and hidden in the future (a good idea),
then these facilities have to be there.

With all these things, opcodes are starting to look
quite different now, between cs4.23 and 5.

Victor

PS.: I hadn't looked at the csound API for a couple
of months now, it is looking more and more impressive!
Good job, lads!

> 
> These still not include auxalloc which is frequently used
> for things like delay lines etc. The csound5 API does
> include auxalloc (actually, with the name auxalloc_, but I
> assume these ugly underscored names are only for
> compatibility with the - even uglier - macros, and thus
> may eventually be replaced). It is interesting that the
> table functions do not include one that returns a MYFLT*
> pointer to the table data.
> 
> Steven Yi wrote:
> 
> > Plugins can probably use these functions for those
> > operations: 
> > /**
> >    * Returns the length of a function table, or -1 if
> >    the table does * not exist.
> >    */
> >   PUBLIC int csoundTableLength(void *csound, int table);
> > 
> >   /**
> >    * Returns the value of a slot in a function table.
> >    */
> >   PUBLIC MYFLT csoundTableGet(void *csound, int table,
> > int index); 
> >   /**
> >    * Sets the value of a slot in a function table.
> >    */
> >   PUBLIC void csoundTableSet(void *csound, int table,
> > int index, MYFLT value); 
> > /**
> >    * Allocate nbytes bytes of memory that can be
> >    accessed later by calling *
> csoundQueryGlobalVariable() with the specified name; the
> >    space is * cleared to zero.
> >    * Returns CSOUND_SUCCESS on success, 
CSOUND_ERROR in
> >    case of invalid * parameters (zero nbytes, invalid or
> >    already used name), or * CSOUND_MEMORY if there is
> >    not enough memory. */
> >   PUBLIC int csoundCreateGlobalVariable(void *csound,
> >                                         const char *name
> > , size_t nbytes); 
> >   /**
> >    * Get pointer to space allocated with the name
> >    "name". * Returns NULL if the specified name is not
> >    defined. */
> >   PUBLIC void *csoundQueryGlobalVariable(void *csound,
> > const char *name); 
> >   /**
> >    * This function is the same as
> >    csoundQueryGlobalVariable(), except the * variable is
> >    assumed to exist and no error checking is done. *
> Faster, but may crash or return an invalid pointer if
> >    'name' is * not defined.
> >    */
> >   PUBLIC void *csoundQueryGlobalVariableNoCheck(void
> > *csound, const char *name); 
> >   /**
> >    * Free memory allocated for "name" and remove 
"name"
> >    from the database. * Return value is 
CSOUND_SUCCESS
> >    on success, or CSOUND_ERROR if the name is * not
> >    defined. */
> >   PUBLIC int csoundDestroyGlobalVariable(void *csound,
> const char *name);
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products
> from real users. Discover which products truly live up to
> the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=
click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-28 02:18
FromSteven Yi
SubjectRe: [Cs-dev] pvsdemix in MacCsound (and other plugins)
Hi Victor,

If I understand correctly, I believe that global variables allocated
by the csoundCreateGlobalVariable is automatically cleared at the end
of a run, with the following code in csoundReset:

    csoundDeleteAllConfigurationVariables(csound);
    csoundDeleteAllGlobalVariables(csound);

But as Istvan and you have pointed out, the two features are different.  

So how do the following sound to everyone: 

void csoundAuxAlloc(ENVIRON * csound, long nbytes, AUXCH * auxchp) 
FUNC * csoundFtFind(ENVIRON * csound, MYFLT * arg)
MYFLT * csoundGetTable(ENVIRON * csound, int tableNum)

?

steven






On Sun, 27 Mar 2005 22:30:40 +0100, Victor Lazzarini
 wrote:
> I think that certainly it is better to be able to obtain
> a pointer to a table rather than having to call
> an API function to get a value each time.
> 
> The memory allocation function is there alright, but
> you'd have to be able to de-allocate things, isn't it?
> So it's not the same as the auxalloc mechanism, which
> I think is one great thing that csound has.
> I think the two things are there for different jobs.
> 
> Adding ftfind() etc to the API should be a good idea.
> As it is, we can still use it, but if things are going to
> be locked away and hidden in the future (a good idea),
> then these facilities have to be there.
> 
> With all these things, opcodes are starting to look
> quite different now, between cs4.23 and 5.
> 
> Victor
> 
> PS.: I hadn't looked at the csound API for a couple
> of months now, it is looking more and more impressive!
> Good job, lads!
> 
> >
> > These still not include auxalloc which is frequently used
> > for things like delay lines etc. The csound5 API does
> > include auxalloc (actually, with the name auxalloc_, but I
> > assume these ugly underscored names are only for
> > compatibility with the - even uglier - macros, and thus
> > may eventually be replaced). It is interesting that the
> > table functions do not include one that returns a MYFLT*
> > pointer to the table data.
> >
> > Steven Yi wrote:
> >
> > > Plugins can probably use these functions for those
> > > operations:
> > > /**
> > >    * Returns the length of a function table, or -1 if
> > >    the table does * not exist.
> > >    */
> > >   PUBLIC int csoundTableLength(void *csound, int table);
> > >
> > >   /**
> > >    * Returns the value of a slot in a function table.
> > >    */
> > >   PUBLIC MYFLT csoundTableGet(void *csound, int table,
> > > int index);
> > >   /**
> > >    * Sets the value of a slot in a function table.
> > >    */
> > >   PUBLIC void csoundTableSet(void *csound, int table,
> > > int index, MYFLT value);
> > > /**
> > >    * Allocate nbytes bytes of memory that can be
> > >    accessed later by calling *
> > csoundQueryGlobalVariable() with the specified name; the
> > >    space is * cleared to zero.
> > >    * Returns CSOUND_SUCCESS on success,
> CSOUND_ERROR in
> > >    case of invalid * parameters (zero nbytes, invalid or
> > >    already used name), or * CSOUND_MEMORY if there is
> > >    not enough memory. */
> > >   PUBLIC int csoundCreateGlobalVariable(void *csound,
> > >                                         const char *name
> > > , size_t nbytes);
> > >   /**
> > >    * Get pointer to space allocated with the name
> > >    "name". * Returns NULL if the specified name is not
> > >    defined. */
> > >   PUBLIC void *csoundQueryGlobalVariable(void *csound,
> > > const char *name);
> > >   /**
> > >    * This function is the same as
> > >    csoundQueryGlobalVariable(), except the * variable is
> > >    assumed to exist and no error checking is done. *
> > Faster, but may crash or return an invalid pointer if
> > >    'name' is * not defined.
> > >    */
> > >   PUBLIC void *csoundQueryGlobalVariableNoCheck(void
> > > *csound, const char *name);
> > >   /**
> > >    * Free memory allocated for "name" and remove
> "name"
> > >    from the database. * Return value is
> CSOUND_SUCCESS
> > >    on success, or CSOUND_ERROR if the name is * not
> > >    defined. */
> > >   PUBLIC int csoundDestroyGlobalVariable(void *csound,
> > const char *name);
> >
> >
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products
> > from real users. Discover which products truly live up to
> > the hype. Start reading now.
> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=
> click
> > _______________________________________________
> > Csound-devel mailing list
> > Csound-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-28 16:32
FromIstvan Varga
SubjectRe: [Cs-dev] pvsdemix in MacCsound (and other plugins)
Steven Yi wrote:

> So how do the following sound to everyone: 
> 
> void csoundAuxAlloc(ENVIRON * csound, long nbytes, AUXCH * auxchp) 
> FUNC * csoundFtFind(ENVIRON * csound, MYFLT * arg)
> MYFLT * csoundGetTable(ENVIRON * csound, int tableNum)

The following function pointers are now in ENVIRON:

   void  (*AuxAlloc)(void *csound, long nbytes, AUXCH *auxchp);
   FUNC  *(*FTFind)(void *csound, MYFLT *argp);
   MYFLT *(*GetTable)(void *csound_, int tableNum, int *tableLength);
   void  *(*Malloc)(void *csound, size_t nbytes);
   void  *(*Calloc)(void *csound, size_t nbytes);
   void  *(*ReAlloc)(void *csound, void *oldp, size_t nbytes);
   void  (*Free)(void *csound, void *ptr);

The corresponding internal functions are:

   csound->AuxAlloc:  csoundAuxAlloc
   csound->FTFind:    csoundFTFind
   csound->GetTable:  csoundGetTable
   csound->Malloc:    mmalloc
   csound->Calloc:    mcalloc
   csound->ReAlloc:   mrealloc
   csound->Free:      mfree

The sources (including all opcodes) have been modified for these changes.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-03-28 16:35
FromDavid Akbari
SubjectRe: [Cs-dev] pvsdemix in MacCsound (and other plugins)
Thanks a ton Istvan!

-David

On Mar 28, 2005, at 10:32 AM, Istvan Varga wrote:

> Steven Yi wrote:
>
>> So how do the following sound to everyone: void 
>> csoundAuxAlloc(ENVIRON * csound, long nbytes, AUXCH * auxchp) FUNC * 
>> csoundFtFind(ENVIRON * csound, MYFLT * arg)
>> MYFLT * csoundGetTable(ENVIRON * csound, int tableNum)
>
> The following function pointers are now in ENVIRON:
>
>   void  (*AuxAlloc)(void *csound, long nbytes, AUXCH *auxchp);
>   FUNC  *(*FTFind)(void *csound, MYFLT *argp);
>   MYFLT *(*GetTable)(void *csound_, int tableNum, int *tableLength);
>   void  *(*Malloc)(void *csound, size_t nbytes);
>   void  *(*Calloc)(void *csound, size_t nbytes);
>   void  *(*ReAlloc)(void *csound, void *oldp, size_t nbytes);
>   void  (*Free)(void *csound, void *ptr);
>
> The corresponding internal functions are:
>
>   csound->AuxAlloc:  csoundAuxAlloc
>   csound->FTFind:    csoundFTFind
>   csound->GetTable:  csoundGetTable
>   csound->Malloc:    mmalloc
>   csound->Calloc:    mcalloc
>   csound->ReAlloc:   mrealloc
>   csound->Free:      mfree
>
> The sources (including all opcodes) have been modified for these 
> changes.
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real 
> users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net