Csound Csound-dev Csound-tekno Search About

[Cs-dev] Storing global opcode data

Date2013-09-18 21:57
FromAlex Weiss
Subject[Cs-dev] Storing global opcode data
AttachmentsNone  None  
Hi list,

Does the csound API provide a way for opcodes to store and retrieve global data (i.e. data that is shared across multiple instances of the same opcode, even in different instruments)? It seems that most opcodes that do so just add fields to the CSOUND struct. That makes sense for "core" csound opcodes, but doesn't work for opcode plug-ins that should be loaded dynamically.

If there is no such mechanism, I guess another solution would be to have a static dictionary that maps a CSOUND* struct to the necessary data. 

Thanks,
Alex

Date2013-09-18 22:41
FromVictor Lazzarini
SubjectRe: [Cs-dev] Storing global opcode data
yes, there is a csound global variable mechanism for this. From opcodes you can call

 csound->CreateGlobalVariable(CSOUND *csound,
                                      const char *name, size_t nbytes)

to create it and

void *csound->QueryGlobalVariable(CSOUND *csound, const char *name)

to retrieve a pointer for it.

csound->DestroyGlobalVariable(CSOUND *csound, const char *name)

to destroy the variable.

On 18 Sep 2013, at 21:57, Alex Weiss wrote:

> Hi list,
> 
> Does the csound API provide a way for opcodes to store and retrieve global data (i.e. data that is shared across multiple instances of the same opcode, even in different instruments)? It seems that most opcodes that do so just add fields to the CSOUND struct. That makes sense for "core" csound opcodes, but doesn't work for opcode plug-ins that should be loaded dynamically.
> 
> If there is no such mechanism, I guess another solution would be to have a static dictionary that maps a CSOUND* struct to the necessary data. 
> 
> Thanks,
> Alex
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk_______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-09-18 23:27
FromMichael Gogins
SubjectRe: [Cs-dev] Storing global opcode data
AttachmentsNone  None  

This facility already exists in the Csound API.

Regards,
Mike

On Sep 18, 2013 4:57 PM, "Alex Weiss" <alexweiss86@gmail.com> wrote:
Hi list,

Does the csound API provide a way for opcodes to store and retrieve global data (i.e. data that is shared across multiple instances of the same opcode, even in different instruments)? It seems that most opcodes that do so just add fields to the CSOUND struct. That makes sense for "core" csound opcodes, but doesn't work for opcode plug-ins that should be loaded dynamically.

If there is no such mechanism, I guess another solution would be to have a static dictionary that maps a CSOUND* struct to the necessary data. 

Thanks,
Alex

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-09-18 23:37
FromAlex Weiss
SubjectRe: [Cs-dev] Storing global opcode data
AttachmentsNone  None  
Great, that's exactly what I was looking for. Thanks!

Alex


On Wed, Sep 18, 2013 at 2:41 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
yes, there is a csound global variable mechanism for this. From opcodes you can call

 csound->CreateGlobalVariable(CSOUND *csound,
                                      const char *name, size_t nbytes)

to create it and

void *csound->QueryGlobalVariable(CSOUND *csound, const char *name)

to retrieve a pointer for it.

csound->DestroyGlobalVariable(CSOUND *csound, const char *name)

to destroy the variable.

On 18 Sep 2013, at 21:57, Alex Weiss wrote:

> Hi list,
>
> Does the csound API provide a way for opcodes to store and retrieve global data (i.e. data that is shared across multiple instances of the same opcode, even in different instruments)? It seems that most opcodes that do so just add fields to the CSOUND struct. That makes sense for "core" csound opcodes, but doesn't work for opcode plug-ins that should be loaded dynamically.
>
> If there is no such mechanism, I guess another solution would be to have a static dictionary that maps a CSOUND* struct to the necessary data.
>
> Thanks,
> Alex
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk_______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel