Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] adding plugin opcodes

Date2005-09-03 17:04
FromVictor Lazzarini
SubjectRe: [Cs-dev] adding plugin opcodes
I was waiting until the changes in the opcode development
API stabilised and then I would update the text. I think
both the scons and the command-line ways of building
a plugin should be mentioned. The scons is actually
mentioned
in the manual section about extending csound.

Victor

>
> Well, in terms of a tutorial, I think it's worth knowing
> what LINKAGE is doing, but also there needs to be mention
> of the fact that there's two ways of doing opcode
> libraries:
>
> 1)Doing what LINKAGE does
> 2)Use csoundModuleInit
>
> Method 2 was introduced by Istvan after method 1and offers
> a more versatile method of building opcode libraries (i.e.
> you could have 32bit and 64bit functions in the same
> library).
>
> steven
>
> On 9/2/05, Iain Duncan  wrote:
> > Thanks guys, it worked! The tech support around here is
> > second to none. ; )
> > So, I guess adding the entry to SConstruct replaces the
> > need to compile the .so seperately as indicated in
> > Victor's Paper? I guess the linkage macro should get
> > mentioned in there too.
> > Iain
> >
> > Istvan Varga wrote:
> > > Just add LINKAGE at the end of the file:
> > >
> > > // stuff to register opcode
> > > static OENTRY localops[] =
> > > { "myop", sizeof(myop), 3, "k", "k", (SUBR)myop_init,
> > > (SUBR)myop_process_k, NULL };
> > >
> > > LINKAGE
> > >
> > > Of course, there are more advanced things that can be
> > > done, but that should be enough to get started.
> > >
> > > Iain Duncan wrote:
> > >
> > >> Can you point me to an example of this? or show me
> > what it should look >> like?
> > >>
> > >> I suggest that info be added to Victor's paper too. =
> > ) >>
> > >> Iain
> > >>
> > >> Steven Yi wrote:
> > >>
> > >>> Hi Iain,
> > >>> It doesn't look like you have the code to actually
> > register with >>> Csound your opcodes in the library.
> > The simple way to do that is to >>> add the LINKAGE
> > macro after the OENTRY localops[] line. (LINKAGE is >>>
> > defined in csdl.h) >
> > >
> > >
> > >
> > >
> > >
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software
> > > Conference & EXPO September 19-22, 2005 * San
> > > Francisco, CA * Development Lifecycle Practices Agile
> & Plan-Driven Development * Managing Projects & Teams *
> > > Testing & QA Security * Process Improvement &
> > > Measurement * http://www.sqe.com/bsce5sf
> > > _______________________________________________
> > > Csound-devel mailing list
> > > Csound-devel@lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> > >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software
> > Conference & EXPO September 19-22, 2005 * San Francisco,
> > CA * Development Lifecycle Practices Agile & Plan-Driven
> > Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement *
> > http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Csound-devel mailing list
> > Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software
> Conference & EXPO September 19-22, 2005 * San Francisco,
> CA * Development Lifecycle Practices Agile & Plan-Driven
> Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement *
> http://www.sqe.com/bsce5sf
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-09-03 18:06
FromIain Duncan
SubjectRe: [Cs-dev] adding plugin opcodes
Great to hear Victor. That paper is so well done it really should be the 
basis for the users guide to adding opcodes! Thanks again. = )

I'm going to experiment with adding one using mingw at work. Perhaps the 
results of that should be added as well. I think for windows, it would 
be good to have a guide to adding an opcode using free tools *without* 
having to recompile csound ( an arduous process on windoze! )

Iain

Victor Lazzarini wrote:
> I was waiting until the changes in the opcode development
> API stabilised and then I would update the text. I think
> both the scons and the command-line ways of building
> a plugin should be mentioned. The scons is actually
> mentioned
> in the manual section about extending csound.
> 
> Victor
> 
> 
>>Well, in terms of a tutorial, I think it's worth knowing
>>what LINKAGE is doing, but also there needs to be mention
>>of the fact that there's two ways of doing opcode
>>libraries:
>>
>>1)Doing what LINKAGE does
>>2)Use csoundModuleInit
>>
>>Method 2 was introduced by Istvan after method 1and offers
>>a more versatile method of building opcode libraries (i.e.
>>you could have 32bit and 64bit functions in the same
>>library).
>>
>>steven
>>
>>On 9/2/05, Iain Duncan  wrote:
>>
>>>Thanks guys, it worked! The tech support around here is
>>>second to none. ; )
>>>So, I guess adding the entry to SConstruct replaces the
>>>need to compile the .so seperately as indicated in
>>>Victor's Paper? I guess the linkage macro should get
>>>mentioned in there too.
>>>Iain
>>>
>>>Istvan Varga wrote:
>>>
>>>>Just add LINKAGE at the end of the file:
>>>>
>>>>// stuff to register opcode
>>>>static OENTRY localops[] =
>>>>{ "myop", sizeof(myop), 3, "k", "k", (SUBR)myop_init,
>>>>(SUBR)myop_process_k, NULL };
>>>>
>>>>LINKAGE
>>>>
>>>>Of course, there are more advanced things that can be
>>>>done, but that should be enough to get started.
>>>>
>>>>Iain Duncan wrote:
>>>>
>>>>
>>>>>Can you point me to an example of this? or show me
>>>
>>>what it should look >> like?
>>>
>>>>>I suggest that info be added to Victor's paper too. =
>>>
>>>) >>
>>>
>>>>>Iain
>>>>>
>>>>>Steven Yi wrote:
>>>>>
>>>>>
>>>>>>Hi Iain,
>>>>>>It doesn't look like you have the code to actually
>>>
>>>register with >>> Csound your opcodes in the library.
>>>The simple way to do that is to >>> add the LINKAGE
>>>macro after the OENTRY localops[] line. (LINKAGE is >>>
>>>defined in csdl.h) >
>>>
>>>>
>>>>
>>>>
>>>>
>>-------------------------------------------------------
>>SF.Net email is Sponsored by the Better Software
>>
>>>>Conference & EXPO September 19-22, 2005 * San
>>>>Francisco, CA * Development Lifecycle Practices Agile
>>
>>& Plan-Driven Development * Managing Projects & Teams *
>>
>>>>Testing & QA Security * Process Improvement &
>>>>Measurement * http://www.sqe.com/bsce5sf
>>>>_______________________________________________
>>>>Csound-devel mailing list
>>>>Csound-devel@lists.sourceforge.net
>>>
>>https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>>-------------------------------------------------------
>>>SF.Net email is Sponsored by the Better Software
>>>Conference & EXPO September 19-22, 2005 * San Francisco,
>>>CA * Development Lifecycle Practices Agile & Plan-Driven
>>>Development * Managing Projects & Teams * Testing & QA
>>
>>Security * Process Improvement & Measurement *
>>
>>>http://www.sqe.com/bsce5sf
>>>_______________________________________________
>>>Csound-devel mailing list
>>>Csound-devel@lists.sourceforge.net
>>
>>https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>-------------------------------------------------------
>>SF.Net email is Sponsored by the Better Software
>>Conference & EXPO September 19-22, 2005 * San Francisco,
>>CA * Development Lifecycle Practices Agile & Plan-Driven
>>Development * Managing Projects & Teams * Testing & QA
>>Security * Process Improvement & Measurement *
>>http://www.sqe.com/bsce5sf
>>_______________________________________________
>>Csound-devel mailing list
>>Csound-devel@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-09-03 18:29
FromIstvan Varga
SubjectRe: [Cs-dev] adding plugin opcodes
Attachmentsmyop.c  
Iain Duncan wrote:

> Great to hear Victor. That paper is so well done it really should be the 
> basis for the users guide to adding opcodes! Thanks again. = )
> 
> I'm going to experiment with adding one using mingw at work. Perhaps the 
> results of that should be added as well. I think for windows, it would 
> be good to have a guide to adding an opcode using free tools *without* 
> having to recompile csound ( an arduous process on windoze! )

You can use the Csound 5 packages at http://csound.sourceforge.net/.
While these are not as up to date as CVS sources, but allow building
plugins or even host applications with MinGW without having to compile
Csound or any of the dependencies yourself.
For example, if you download and unpack csound5-2005-08-27.zip in C:\,
and cd to the top-level 'csound5' directory, then you can build and test
the attached simple plugin with the following commands:

   set OPCODEDIR=C:\csound5\lib
   set OPCODEDIR=C:\csound5\lib64

   gcc -shared -Wall -O2 -I./src/H -o ./lib/myop.dll myop.c
     or, for double precision
   gcc -shared -Wall -O2 -I./src/H -DUSE_DOUBLE -o ./lib64/myop.dll myop.c

   .\bin\csound32.exe -z
     or, for double precision
   .\bin\csound.exe -z

should list the new opcode.

To build a host application, include csound.h instead of csdl.h, and
link against bin/csound32.dll (or bin/csound64.dll if you want to use
double precision; do not forget -DUSE_DOUBLE then), and any other required
libraries (see src/Makefile-win32). -shared is not needed when linking
a host.

Date2005-09-03 18:31
FromIstvan Varga
SubjectRe: [Cs-dev] adding plugin opcodes
Victor Lazzarini wrote:

> I was waiting until the changes in the opcode development
> API stabilised and then I would update the text. I think
> both the scons and the command-line ways of building
> a plugin should be mentioned. The scons is actually
> mentioned
> in the manual section about extending csound.

Well, it may be time to update the text now, unless someone
suggests some major API changes to be done. I can offer some
help in providing information on the various API functions.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-09-03 19:43
FromIstvan Varga
SubjectRe: [Cs-dev] adding plugin opcodes
Istvan Varga wrote:

>   set OPCODEDIR=C:\csound5\lib
>   set OPCODEDIR=C:\csound5\lib64

One minor correction: the second environment variable should be OPCODEDIR64.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-09-03 20:51
FromIain Duncan
SubjectRe: [Cs-dev] adding plugin opcodes
Thanks, I'll give this a whirl at work tonight on the mingw system and 
report how it goes.

Iain

Istvan Varga wrote:
> Iain Duncan wrote:
> 
>> Great to hear Victor. That paper is so well done it really should be 
>> the basis for the users guide to adding opcodes! Thanks again. = )
>>
>> I'm going to experiment with adding one using mingw at work. Perhaps 
>> the results of that should be added as well. I think for windows, it 
>> would be good to have a guide to adding an opcode using free tools 
>> *without* having to recompile csound ( an arduous process on windoze! )
> 
> 
> You can use the Csound 5 packages at http://csound.sourceforge.net/.
> While these are not as up to date as CVS sources, but allow building
> plugins or even host applications with MinGW without having to compile
> Csound or any of the dependencies yourself.
> For example, if you download and unpack csound5-2005-08-27.zip in C:\,
> and cd to the top-level 'csound5' directory, then you can build and test
> the attached simple plugin with the following commands:
> 
>   set OPCODEDIR=C:\csound5\lib
>   set OPCODEDIR=C:\csound5\lib64
> 
>   gcc -shared -Wall -O2 -I./src/H -o ./lib/myop.dll myop.c
>     or, for double precision
>   gcc -shared -Wall -O2 -I./src/H -DUSE_DOUBLE -o ./lib64/myop.dll myop.c
> 
>   .\bin\csound32.exe -z
>     or, for double precision
>   .\bin\csound.exe -z
> 
> should list the new opcode.
> 
> To build a host application, include csound.h instead of csdl.h, and
> link against bin/csound32.dll (or bin/csound64.dll if you want to use
> double precision; do not forget -DUSE_DOUBLE then), and any other required
> libraries (see src/Makefile-win32). -shared is not needed when linking
> a host.
> 
> 
> ------------------------------------------------------------------------
> 
> // attempt at my first opcode
> // doubles an input signal ( just to make it do something )
> 
> #include "csdl.h"
> 
> // structure definition for my opcode
> typedef struct _myop {
> 	OPDS	h;
> 	MYFLT	*in;
> 	MYFLT	*out;
> 	MYFLT	var;
> 	
> } myop;	
> 
> // init function for my opcode, initialize internal vars here
> int myop_init ( CSOUND *csound, myop *op )
> {
> 	// initialize my internal variables here
> 	op->var = 2;
> 
> 	// opcode initialization is expected to return OK 
> 	return OK;
> }
> 
> // a krate process needs to return just one sample
> int myop_process_k ( CSOUND *csound, myop *op )
> {
> 	// make our output variable
> 	MYFLT result = *(op->in) * op->var;
> 	*(op->out) = result;
> 
> 	return OK;
> }
> 
> 
> // stuff to register opcode
> static OENTRY localops[] = {
> { "myop", sizeof(myop), 3, "k", "k", (SUBR)myop_init, (SUBR)myop_process_k, NULL }
> };
> 
> LINKAGE
> 


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-09-03 23:59
FromDavid Akbari
SubjectRe: [Cs-dev] adding plugin opcodes
On Sep 3, 2005, at 1:29 PM, Istvan Varga wrote:
>
> You can use the Csound 5 packages at http://csound.sourceforge.net/.
>

It is also potentially worth noting that this release of Csound5 is 
also posted on cSounds.com. (First news headline)

Also, what source file do the new loop opcodes live in?

IMHO they almost make the previously common use of using reinit / goto 
deprecated...


-David



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-09-04 11:23
FromIstvan Varga
SubjectRe: [Cs-dev] adding plugin opcodes
David Akbari wrote:

> Also, what source file do the new loop opcodes live in?

csound5/src/Engine/entry2.c  (opcode entries)
csound5/src/H/insert.h       (opcode data structure declaration)
csound5/src/OOps/goto_ops.c  (the actual implementation)


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-25 15:42
FromDavid Akbari
Subject[Cs-dev] Csound5 & dyne:bolic Linux
Hi Iain, all,

Recently I have gotten into using the AGNULA and dyne:bolic Live CD's 
on PC. While AGNULA is a very nice synthesis distro, it lacks a C 
compiler. dyne:bolic has the compiler, Python, CVS binary, scons etc so 
it is possible to get and successfully build Csound5.

Why I write this email is because 1) I know Iain has a say in how 
Csound appears in the distro and 2) to make a suggestion:

I feel that the dyne:bolic is a great distro and would be even better 
if you could convince the project admins to include Steve Harris's 
LIBLO headers / library as part of the default distribution. Using this 
technique, we can take several PC's, boot them up with teh Live CD's 
and use a standard ethernet router instead of a MIDI interface.

Currently Csound5 builds great as does Pure Data and others but I think 
it would be really neat to be able to build the OSC opcodes in Csound5 
as well. At present you can get the LIBLO from CVS, but you cannot 
install the library to link against because it cannot alter 
/usr/include (headers) or /usr/local/bin.


-David



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net