[Cs-dev] Help with using api functions in opcodes
Date | 2005-09-11 03:10 |
From | Iain Duncan |
Subject | [Cs-dev] Help with using api functions in opcodes |
Attachments | mytab.c |
Perhaps I'm going about this all wrong. I'm trying to make a custom table reading opcode, so I'm under the impression that where possible I should just use api functions within my opcode. My dummy table reading wrapper compiles ok, but when I try to run a test, csound says: WARNING: could not open library 'libmytab.so' and then gives me a no legal opcode message. The above works fine if I take out the csoundTableGet() call. Attached is the C source. Thanks iain |
Date | 2005-09-11 11:21 |
From | Istvan Varga |
Subject | Re: [Cs-dev] Help with using api functions in opcodes |
Iain Duncan wrote: > Perhaps I'm going about this all wrong. I'm trying to make a custom > table reading opcode, so I'm under the impression that where possible I > should just use api functions within my opcode. My dummy table reading > wrapper compiles ok, but when I try to run a test, csound says: > > WARNING: could not open library 'libmytab.so' > > and then gives me a no legal opcode message. > > The above works fine if I take out the csoundTableGet() call. > Attached is the C source. In plugin libraries, you should use the function pointers in the CSOUND structure instead of calling the functions directly, for example call csound->TableLength() instead of csoundTableLength(). Note that this interface has more public functions than the host API. By the way, there is a csound->GetTable() function that returns a pointer to the table data, as well as the length of the table, allowing for more efficient table access than having a separate TableGet/TableSet call for every single table location. > #include "csdl.h" > #include "csound.h" You only need to #include csdl.h, and not csound.h. > //MYFLT result = *(op->in) * (MYFLT)2; > //MYFLT result = *(op->in2) * (MYFLT)8; When writing a plugin, the FL() macro can be used for casting values to MYFLT with less typing, for example FL(2) or FL(8). ------------------------------------------------------- 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 |
Date | 2005-09-11 21:42 |
From | Iain Duncan |
Subject | Re: [Cs-dev] Help with using api functions in opcodes |
Thanks for the tips guys! Iain Istvan Varga wrote: > Iain Duncan wrote: > >> Perhaps I'm going about this all wrong. I'm trying to make a custom >> table reading opcode, so I'm under the impression that where possible >> I should just use api functions within my opcode. My dummy table >> reading wrapper compiles ok, but when I try to run a test, csound says: >> >> WARNING: could not open library 'libmytab.so' >> >> and then gives me a no legal opcode message. >> >> The above works fine if I take out the csoundTableGet() call. >> Attached is the C source. > > > In plugin libraries, you should use the function pointers in the > CSOUND structure instead of calling the functions directly, for example > call csound->TableLength() instead of csoundTableLength(). > Note that this interface has more public functions than the host API. > > By the way, there is a csound->GetTable() function that returns a > pointer to the table data, as well as the length of the table, > allowing for more efficient table access than having a separate > TableGet/TableSet call for every single table location. > >> #include "csdl.h" >> #include "csound.h" > > > You only need to #include csdl.h, and not csound.h. > >> //MYFLT result = *(op->in) * (MYFLT)2; >> //MYFLT result = *(op->in2) * (MYFLT)8; > > > When writing a plugin, the FL() macro can be used for casting values > to MYFLT with less typing, for example FL(2) or FL(8). > > > ------------------------------------------------------- > 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 |