[Csnd] Opcodes with no outargs in c++ plugin framework
Date | 2019-09-17 20:53 |
From | Richard Knight |
Subject | [Csnd] Opcodes with no outargs in c++ plugin framework |
The code below returns the following when it would be expected to show 1: 1.000 , 2: 2.00 etc. With outargs set it works ok, and also the inverse (outargs but no inargs) works OK. Is there a problem with my code or is it possibly a bug?
struct testopcode : csnd::Plugin<0, 4> {
... 1: 2.000000 |
Date | 2019-09-17 21:39 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Opcodes with no outargs in c++ plugin framework |
yep, using 0 for outargs is problematic. A solution, which might sound confusing, but should work is to set outargs to 1 and use outargs[0] as your first input. You'll
also reduce the number of inargs by 1 as well.
Or, set zero input args and use the outargs array as your inputs.
I might make a separate class template for zero outputs to make it less confusing, but
for now, one of the above should work.
Prof. Victor Lazzarini
Maynooth University
Ireland
|
Date | 2019-09-17 23:13 |
From | Richard Knight |
Subject | Re: [Csnd] Opcodes with no outargs in c++ plugin framework |
Ah ok, thanks! I will go with your second suggestion and basically switch round in/out. On Tue, 17 Sep 2019 20:39:27 +0000, Victor Lazzarini wrote: yep, using 0 for outargs is problematic. A solution, which might sound confusing, but should work is to set outargs to 1 and use outargs[0] as your first input. You'll -- http://rk.1bpm.net/ |
Date | 2019-09-18 15:56 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Opcodes with no outargs in c++ plugin framework |
I’ve added the class InPlug |
Date | 2019-09-20 00:25 |
From | Richard Knight |
Subject | Re: [Csnd] Opcodes with no outargs in c++ plugin framework |
Great, thank you. I have tried it, and it works :) On Wed, 18 Sep 2019 14:56:35 +0000, Victor Lazzarini wrote: I’ve added the class InPlug for the case where there are no outputs. It’s in GIT, not sure if you can try it. ======================== Prof. Victor Lazzarini Maynooth University IrelandOn 17 Sep 2019, at 23:13, Richard Knight <richard@1BPM.NET> wrote: Ah ok, thanks! I will go with your second suggestion and basically switch round in/out. On Tue, 17 Sep 2019 20:39:27 +0000, Victor Lazzarini wrote:Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted hereyep, using 0 for outargs is problematic. A solution, which might sound confusing, but should work is to set outargs to 1 and use outargs[0] as your first input. You'll also reduce the number of inargs by 1 as well. Or, set zero input args and use the outargs array as your inputs. I might make a separate class template for zero outputs to make it less confusing, but for now, one of the above should work. Prof. Victor Lazzarini Maynooth University Ireland On 17 Sep 2019, at 20:53, Richard Knight <richard@1bpm.net> wrote:-- http://rk.1bpm.net/ Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted hereThe code below returns the following when it would be expected to show 1: 1.000 , 2: 2.00 etc. With outargs set it works ok, and also the inverse (outargs but no inargs) works OK. Is there a problem with my code or is it possibly a bug? struct testopcode : csnd::Plugin<0, 4> { static constexpr char const *otypes = ""; static constexpr char const *itypes = "iiii"; int init() { for (int i = 0; i < 4 ; i++) { std::string info = std::to_string(i+1) + ": " + std::to_string(inargs[i]); csound->message(info); } return OK; } }; ... testopcode 1, 2, 3, 4 ... 1: 2.000000 2: 3.000000 3: 4.000000 csound command: Segmentation fault Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted hereCsound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here -- http://rk.1bpm.net/ |
Date | 2019-09-27 13:22 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Opcodes with no outargs in c++ plugin framework |
Good. I made a small change of var name
inargs to just args, since this can also be used
with unlimited outputs, which does not work
with the original template.
Prof. Victor Lazzarini
Maynooth University
Ireland
|