Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:3559] Re: Reset in Csound5

Date2003-11-27 01:17
From"Michael Gogins"
Subject[CSOUND-DEV:3559] Re: Reset in Csound5
Yes, I was assuming that the Csound structure would be private.

However, the csoundXXX functions would NOT be implemented using the
interface functions - the interface functions have to have a real
implementation somewhere, and that is what the csoundXXX functions are for.

If there were a 1 to 1 correspondence between interface functions and
private internal Csound functions, the csoundXXX functions could be dropped,
and the only library functions would be csoundCreate and csoundDestroy; all
others would be interface functions.

============================================
Michael Gogins
gogins at pipeline period com
Irreducible Productions
CsoundVST, an extended version of Csound for programming music and sound
Available at http://sourceforge.net/projects/csound/
============================================


----- Original Message ----- 
From: "Matt J. Ingalls" 
To: "Csound Developers Discussion List" 
Sent: Wednesday, November 26, 2003 5:07 PM
Subject: [CSOUND-DEV:3557] Re: Reset in Csound5


>
> > plugins can use another function pointer interface. Something like this?
> >
> > typedef struct HostInterface {
> > void (function1*)();
> > void (function2*)();
> > ...
> > Csound_ *csound;
> > };
>
> except then you need the definition of Csound_ to compile a
> host, and you are letting hosts see the Csound_ struct.  so can we have a
> 'private' and a 'public' definition for HostInterface, as mentioned
> previously?
>
> /*defined in cs.h or somewhere NOT in csound.h*/
> typdef struct HostInterface {
> void (function1*)();
> void (function2*)();
> ...
> Csound_ *csound;
> };
>
> /* defined in csound.h */
> typdef struct CsoundLib { /*or someother name */
> void (function1*)();
> void (function2*)();
> ...
> };
>
> then implementation of api functions would look like:
>
> CsoundLib *csoundCreate(void *hostData)
> {
>    Csound_ *cs = NewCsoundInstance() ; /* or however we do it */
>    cs->hostdata = hostData;
>    return (CsoundLib *)cs->hostInterface;
> }
>
> int csoundGetNchnls(CsoundLib *cs)
>     {
>         return ((HostInterface *)cs)->csound.nchnls;
>     }
>
>
>
> dont know if you need this for the plugin api too?  also i guess
> 'hostData' could be included in the function-pointer (what i called
> CsoundLib) struct instead of the globals Csound_ struct..
>
> -m
>

Date2003-11-27 07:04
From"Matt J. Ingalls"
Subject[CSOUND-DEV:3561] Re: Reset in Csound5
> Yes, I was assuming that the Csound structure would be private.

> However, the csoundXXX functions would NOT be implemented using the
> interface functions - the interface functions have to have a real
> implementation somewhere, and that is what the csoundXXX functions are for.

huh?

>
> If there were a 1 to 1 correspondence between interface functions and
> private internal Csound functions, the csoundXXX functions could be dropped,
> and the only library functions would be csoundCreate and csoundDestroy; all
> others would be interface functions.
>
> ============================================
> Michael Gogins
> gogins at pipeline period com
> Irreducible Productions
> CsoundVST, an extended version of Csound for programming music and sound
> Available at http://sourceforge.net/projects/csound/
> ============================================
>
>
> ----- Original Message -----
> From: "Matt J. Ingalls" 
> To: "Csound Developers Discussion List" 
> Sent: Wednesday, November 26, 2003 5:07 PM
> Subject: [CSOUND-DEV:3557] Re: Reset in Csound5
>
>
> >
> > > plugins can use another function pointer interface. Something like this?
> > >
> > > typedef struct HostInterface {
> > > void (function1*)();
> > > void (function2*)();
> > > ...
> > > Csound_ *csound;
> > > };
> >
> > except then you need the definition of Csound_ to compile a
> > host, and you are letting hosts see the Csound_ struct.  so can we have a
> > 'private' and a 'public' definition for HostInterface, as mentioned
> > previously?
> >
> > /*defined in cs.h or somewhere NOT in csound.h*/
> > typdef struct HostInterface {
> > void (function1*)();
> > void (function2*)();
> > ...
> > Csound_ *csound;
> > };
> >
> > /* defined in csound.h */
> > typdef struct CsoundLib { /*or someother name */
> > void (function1*)();
> > void (function2*)();
> > ...
> > };
> >
> > then implementation of api functions would look like:
> >
> > CsoundLib *csoundCreate(void *hostData)
> > {
> >    Csound_ *cs = NewCsoundInstance() ; /* or however we do it */
> >    cs->hostdata = hostData;
> >    return (CsoundLib *)cs->hostInterface;
> > }
> >
> > int csoundGetNchnls(CsoundLib *cs)
> >     {
> >         return ((HostInterface *)cs)->csound.nchnls;
> >     }
> >
> >
> >
> > dont know if you need this for the plugin api too?  also i guess
> > 'hostData' could be included in the function-pointer (what i called
> > CsoundLib) struct instead of the globals Csound_ struct..
> >
> > -m
> >
>
>