[Cs-dev] Signal flow graph opcodes
Date | 2013-11-27 18:10 |
From | Michael Gogins |
Subject | [Cs-dev] Signal flow graph opcodes |
Attachments | None None |
I would like to move the signal flow graph opcodes, which are implemented in C++ using the standard C++ library collections, into static linkage and into core Csound. Does anybody object? A number of people find these opcodes useful, and they make it vary simple to create self-contained instruments that can be swapped in and out of Csound orchestras in a very modular way.
I'm not aware of any platforms that we build for at this time that lack the required compiler or library support. Regards, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com |
Date | 2013-12-01 04:52 |
From | Steven Yi |
Subject | Re: [Cs-dev] Signal flow graph opcodes |
I'd rather we kept everything within the libcsound as C and not C++. Could you rewrite alwayson to C? On Wed, Nov 27, 2013 at 1:10 PM, Michael Gogins |
Date | 2013-12-01 20:48 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Signal flow graph opcodes |
Attachments | None None |
What exactly are the reasons why you prefer not to use C++ in libcsound? Based on what I know, and I have considerable experience with both C and C++, I see no reason to rewrite the code in C. It works just fine the way it is, and rewriting it would simply be an unnecessary duplication of effort.
I am aware that the "core" of Csound has remained in C, but I do not see why. As far as I know, every platform on which Csound is currently supported has an adequate C++ compiler, and this particular set of opcodes does not use anything outside of the standard C++ library, except for OpenMP.
The code should still build "out of the box" on OS X (though it would not then support multi-threading). But I would be quite willing to rewrite the code to use plain pthreads and not OpenMP.
That said, although the opcodes were designed as a suite to enable the writing of completely self-contained instruments that work in a purely "plug and play" sort of way, it would be possible to move alwayson and ftgenonce to C because global variables could be used in place of the inlet, outlet, and connect opdoes as a means of routing signals between self-contained instrument definitions, even though that would be somewhat more awkward for the musician. In other words, just above each self-contained insdef, global global inlet and outlet opcodes, perhaps even arrays, would be defined using some sort of naming convention. Then a separate alwayson instrument, at the end of the orchestra, would take care of routing signals between these global variables.
So, if you are completely unwilling to admit even a particle of C++ into libcsound, I will rewrite ftgenonce and alwayson in C and we will still be able to get completely self-contained instrument definitions going for everybody.
Best, Mike -----------------------------------------------------
Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Sat, Nov 30, 2013 at 11:52 PM, Steven Yi <stevenyi@gmail.com> wrote: I'd rather we kept everything within the libcsound as C and not C++. |
Date | 2013-12-02 05:00 |
From | Steven Yi |
Subject | Re: [Cs-dev] Signal flow graph opcodes |
IMO, using C++ in the core isn't necessary. It adds a compile time dependency (C++ compiler) to the core, and adds further code knowledge requirements (C++) to the base. Also, programming in C++ has its own mindset and approaches that don't necessarily map directly to C practices. I would rather we just worked in a single language and simplify things as much as possible for the core of csound. I also don't think ftgenonce, alwayson, and the inlet/outlet opcodes are going to solve the problem of self contained instruments. Requiring a naming convention sounds problematic too. But this is a separate issue from C++ in the core of csound and I think we should address the two separately. I do think we need a solution for self-contained instruments; I've already had one for a while in Blue, but it leverages the program to handle ensuring encapsulation of all resources and dependent UDO's, and it generates the mixer for the user. I don't think alwayson is necessary since one can just call event_i or schedule. ftgenonce is handy but problematic, as there's no guarantee that the user won't modify the shared table that is returned, thus causing problems elsewhere. (Of course one shouldn't, but that's not guaranteed). inlet/outlet/connect I've criticized before as it is working with definitions of instruments, rather than instances of instruments. Thus one can not define Reverb instrument and use multiple instances of it with the inlet/outlet/connect opcodes. In a system like SuperCollider, one might instantiate multiple Synth instances of SynthDefs but tell them which channels of the bus to read from/write to, and that's done at the instance level, not the definition. steven On Sun, Dec 1, 2013 at 3:48 PM, Michael Gogins |
Date | 2013-12-02 07:18 |
From | Francois PINOT |
Subject | Re: [Cs-dev] Signal flow graph opcodes |
Attachments | None None |
One reason not to use C++ in libcsound is that it is usually easier to write wrappers for an API written in C than for an API written in C++. FFI for most languages allow seamless binding with C libraries, not with C++ libraries. For example, I'm actually writing a wrapper of libcsound for the google go language. cgo, the FFI tool for go, allows binding for C functions. I had to write a C interface to add in my wrapper a binding for CsoundPerformanceThread (which is not part of libcsound). Regards2013/12/1 Michael Gogins <michael.gogins@gmail.com>
|
Date | 2013-12-02 08:07 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Signal flow graph opcodes |
Attachments | None None |
This discussion has nothing to do with external interfaces with Csound. It is about whether to allow opcodes in libcsound to be written in c++. Regards, On Dec 2, 2013 8:18 AM, "Francois PINOT" <fggpinot@gmail.com> wrote:
|
Date | 2013-12-02 09:36 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Signal flow graph opcodes |
Attachments | None None |
The C compiler is also the C++ compiler, so there is no compile time dependency for C++. About the design of the signal flow graph opcodes, there is a need for a facility to route signals between definitions, which these opcodes meet. So doing this is not at all a design flaw. There is also a need to route between instances, which these opcodes do not meet. It would be nice to have something that does both.
I understand that the core Csound developers do not like C++. I am not going to repeat my arguments in favor of C++ here. I will keep my C++ stuff in plugins.
Therefore, what I am going to do is take the OpenMP code out of the signal flow graph opcodes so that they will build without problems on OS X. I will use pthreads for synchronizing instead.
Best, Mike -----------------------------------------------------
Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Mon, Dec 2, 2013 at 12:00 AM, Steven Yi <stevenyi@gmail.com> wrote: IMO, using C++ in the core isn't necessary. It adds a compile time |