Csound Csound-dev Csound-tekno Search About

Re: [Csnd] [EXTERNAL] Re: [Csnd] Naive question about the API

Date2023-01-11 17:05
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] Re: [Csnd] Naive question about the API
Those API functions are not used to set Csound global variables, they are used to set C variables/memory in the Csound object. Csound code does not have access to them.

As Giovanni said, the only way to set global variables is via compilation, or through Csound
events (using pfields to instruments), or try chnexport 


You can also use function tables to pass data from and to a host.

Prof. Victor Lazzarini
Maynooth University
Ireland

On 11 Jan 2023, at 14:25, Dave Seidel <dave.seidel@gmail.com> wrote:



*Warning*

This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

Any thoughts about the performance difference of using globals vs channels, if any?

On Wed, Jan 11, 2023 at 9:19 AM Dave Seidel <dave.seidel@gmail.com> wrote:
Thanks Hlöðver, that looks like exactly what I'd need.

On Wed, Jan 11, 2023 at 9:02 AM Hlöðver Sigurðsson <hlolli@gmail.com> wrote:
You could use either of these two functions
https://github.com/csound/csound/blob/master/include/csound.h#L2420-L2431

csoundQueryGlobalVariable and csoundQueryGlobalVariableNoCheck
I assume you can just set a new float to the pointer returned.

On Wed, 11 Jan 2023 at 14:59, Giovanni Bedetti <giovanni.bedetti@gmail.com> wrote:
I think you can use csoundCompileOrc to create globals (or add instruments, gens) on the fly.
But other instruments that use those globals should be created later otherwise you will have a runtime error.

Il giorno mer 11 gen 2023 alle ore 13:51 Dave Seidel <dave.seidel@gmail.com> ha scritto:
Rationale: I just ported one of my Nebulae customer instruments to work with docB's excellent VCV Rack Csound module. It occurred to me that the Rack module could be a great way to prototype/debug Nebulae code, because it's difficult to do this in the Nebulae environment. The Rack modules uses channels cor controls/inputs vs Nebulae which uses globals. It wou;d be cool to be able to write the same (or more similar) code for both environments.

On Wed, Jan 11, 2023 at 8:39 AM Dave Seidel <dave.seidel@gmail.com> wrote:
Is it possible to set global variables from the API as an alternative to channels? And if so, how do these methods compare in terms of performance?

- Dave

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here