gogins / csound-extended

Extensions for Csound including algorithmic composition, Android app, and WebAssembly.
GNU Lesser General Public License v2.1
40 stars 1 forks source link

Plugin opcodes as instruments #183

Closed gogins closed 3 years ago

gogins commented 3 years ago

Investigate a framework for writing Csound instruments in C++, either from Faust .dsp files, or using some C++ DSP library such as Gamma or AuLib.

It would have been nice to add to Csound the ability to define "plugin instrs" but since I no longer wish to get involved in core Csound development, the closest I can come is a generic interface to a family of opcodes.

It is not quite possible to have the opcode infer the entire signature, both input parameters and output parameters, from the instr context. It is necessary explicitly declare the output parameters; this is most flexibly done as an a-rate array variable. As for the input parameters, the pfields are available in an OpcodeBase instance from the opds.insdshead pointer.

There can then be an array of J variables (as with the STKAdapter), and also the opcode can try to find named global variables, and if they are not found, define and export them.

instr MyKlanger
a_out[] init nchnls
a_out my_klanger
outletv "output", a_out
endin
gogins commented 3 years ago

Not doing this one, as just using the Clang opcodes and a kind of boilerplate instr definition does the job.