[Cs-dev] Extending Csound
Date | 2014-02-08 17:56 |
From | James Hearon |
Subject | [Cs-dev] Extending Csound |
Attachments | None None |
Hi, Just a question re: extending csound or opcode building Trying a simple tweaking of pluck.c to see if I can figure out how opcode building is done in cs6. Mine seemed to build but doesn't show up in the list (-z flag) or play ("unexpected new token"). I added the .c under set(stdopcod_SRCS) in CMakeLists.txt since that is where pluck is also located based on #include "stdopcod.h" in the pluck.c file, before configuring and generating make with cmake gui. Wondering where I might be going wrong or what else I need to do. Are there any current docs on extending cs? Seems the existing one is no longer in the manual and things have changed a bit since that one was in use. Thanks, Jim |
Date | 2014-02-08 18:32 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Extending Csound |
Attachments | None None |
Yes, things have changed. I don't know what happened to the manual page on extending Csound. Look at the plugin opcodes for examples.
You won't need to modify CMakeLists.txt if you don't want to. You can simply create a batch file to run the C compiler. There is no reason to have more than one .c file in a plugin opcode, so this will work fine. You can also create your own project file in whatever way is easiest for you (SConstruct, CMake, plain old makefile, CodeBlocks, whatever) because just building a plugin opcode normally only needs the Csound headers and to link with the Csound library. You will need to pass "-DUSE_DOUBLE" to the compiler, or not, depending on your target version of Csound.
To get an idea of how to build a plugin opcode .c or .cpp file, run "make VERBOSE=1", and copy the compiler commands from the screen and paste it into a .sh script. Then edit the commands to match your own file. That's it.
If you are comfortable with C++, you can use CsoundOpcode.hpp as a template for easily making new plugin opcodes with a number of convenience features. See Opcodes/chua/ChuaOscillator.cpp for a complete functional example.
A major difference between Csound 5 and Csound 6 is sample accurate scheduling. For this the audio generating routine in the opcode has to track any offsets from the beginning and end of the ksmps block. The ChuaOscillator.cpp code does this.
The Release Notes in the current manual also provide a sketchy reference on building opcodes the new way, also with an example of sample accurate scheduling. Hope this helps,
Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Sat, Feb 8, 2014 at 12:56 PM, James Hearon <j_hearon@hotmail.com> wrote:
|
Date | 2014-02-08 18:38 |
From | Steven Yi |
Subject | Re: [Cs-dev] Extending Csound |
This reminds me, we should update the pluginSDK folder with a CMake file instead of an SConstruct one, and add documentation there. On Sat, Feb 8, 2014 at 1:32 PM, Michael Gogins |