Skip to content

Commit

Permalink
fixed opcode registration in CPOF
Browse files Browse the repository at this point in the history
  • Loading branch information
vlazzarini committed Jul 28, 2019
1 parent c3f1042 commit 8eca5dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 3 additions & 5 deletions Opcodes/pvsops.cpp
Expand Up @@ -30,7 +30,6 @@ struct PVTrace : csnd::FPlugin<1, 2> {
int init() {
if (inargs.fsig_data(0).isSliding())
return csound->init_error("sliding not supported");

if (inargs.fsig_data(0).fsig_format() != csnd::fsig_format::pvs &&
inargs.fsig_data(0).fsig_format() != csnd::fsig_format::polar)
return csound->init_error("fsig format not supported");
Expand All @@ -45,7 +44,6 @@ struct PVTrace : csnd::FPlugin<1, 2> {
int kperf() {
csnd::pv_frame &fin = inargs.fsig_data(0);
csnd::pv_frame &fout = outargs.fsig_data(0);

if (framecount < fin.count()) {
int n = fin.len() - (int)inargs[1];
float thrsh;
Expand Down Expand Up @@ -78,7 +76,7 @@ struct PVTrace2 : csnd::FPlugin<2, 3> {
csnd::Vector<MYFLT> &bins = outargs.vector_data<MYFLT>(1);
if (inargs.fsig_data(0).isSliding())
return csound->init_error("sliding not supported");

if (inargs.fsig_data(0).fsig_format() != csnd::fsig_format::pvs &&
inargs.fsig_data(0).fsig_format() != csnd::fsig_format::polar)
return csound->init_error("fsig format not supported");
Expand All @@ -99,7 +97,7 @@ struct PVTrace2 : csnd::FPlugin<2, 3> {
csnd::pv_frame &fout = outargs.fsig_data(0);
csnd::Vector<MYFLT> &bins = outargs.vector_data<MYFLT>(1);
csnd::AuxMem<binamp> &mbins = binlist;

if (framecount < fin.count()) {
int n = fin.len() - (int)inargs[1];
float thrsh;
Expand Down Expand Up @@ -374,7 +372,7 @@ struct TPrint : csnd::Plugin<0, 1> {

#include <modload.h>
void csnd::on_load(Csound *csound) {
csnd::plugin<PVTrace>(csound, "pvstrace", csnd::thread::ik);
csnd::plugin<PVTrace>(csound, "pvstrace", csnd::thread::ik);
csnd::plugin<PVTrace2>(csound, "pvstrace", csnd::thread::ik);
csnd::plugin<TVConv>(csound, "tvconv", "a", "aaxxii", csnd::thread::ia);
}
9 changes: 5 additions & 4 deletions include/plugin.h
Expand Up @@ -42,7 +42,7 @@ const double twopi = TWOPI;

/** opcode threads: i-time, k-perf and/or a-perf
*/
enum thread { i = 1, k = 2, ik = 3, a = 2, ia = 3 /*, ika = 3*/ };
enum thread { i = 1, k = 2, ik = 3, a = 4, ia = 5 /*, ika = 3*/ };

/** fsig formats: phase vocoder, stft polar, stft complex, or
sinusoidal tracks
Expand Down Expand Up @@ -1026,11 +1026,12 @@ template <typename T>
int plugin(Csound *csound, const char *name, uint32_t thr,
uint32_t flags = 0) {
CSOUND *cs = (CSOUND *)csound;
if(thr == thread::ia || thr == thread::a)

if(thr == thread::ia || thr == thread::a)
return cs->AppendOpcode(cs, (char *)name, sizeof(T), flags, thr,
(char *)T::otypes, (char *)T::itypes, (SUBR)init<T>,
(SUBR)aperf<T>, NULL);
else
(SUBR)aperf<T>, NULL);
else
return cs->AppendOpcode(cs, (char *)name, sizeof(T), flags, thr,
(char *)T::otypes, (char *)T::itypes, (SUBR)init<T>,
(SUBR)kperf<T>, NULL);
Expand Down

0 comments on commit 8eca5dd

Please sign in to comment.