csoundGetTableArgs() question...
Date | 2016-06-18 09:25 |
From | Rory Walsh |
Subject | csoundGetTableArgs() question... |
I need to check if I'm working with a named gen routine, or a regular one. I have something like this:
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 here
MYFLT* argsPtr; csoundGetTableArgs(csound->GetCsound(), &argsPtr, tableNum); What's the best way to check if argsPtr[0] is a string? |
Date | 2016-06-18 21:45 |
From | Guillermo Senna |
Subject | Re: csoundGetTableArgs() question... |
I'm going to add something. If you build a new plugin for function tables you use a string for calling it. From what I've seen in Opcodes/fareygen.c, you must reset p4 to a negative number to avoid rescaling. This may inevitably lead to confusion if you try to do what Rory's trying to do. So, the questions I have are: * Inside a function table plugin, how can I avoid rescaling if p4 is a string a not a number? * How can we check for that name with csoundGetTableArgs? * Should we just continue the GEN number's sequence for resetting p4 inside plugins? * Should we use an offset like, for example, "pick a number above 100" for plugins? Cheers. On 18/06/16 05:25, Rory Walsh wrote: > I need to check if I'm working with a named gen routine, or a regular one. > I have something like this: > > MYFLT* argsPtr; > csoundGetTableArgs(csound->GetCsound(), &argsPtr, tableNum); > > What's the best way to check if argsPtr[0] is a string? > > 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 here > 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 here |
Date | 2016-06-18 22:01 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
Inside Csound, we would check for a NaN, and there is function to do this. I am not quite sure whether p4 would still be a NaN by the time you access the struct via the API. If that is the case, we just need to export the function that checks for it. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-06-18 22:22 |
From | Guillermo Senna |
Subject | Re: csoundGetTableArgs() question... |
Hi Victor, So what you're saying is that I should reset p4 to -1 in my plugin to avoid rescaling and then (after that function you mention is made available) Rory can still retrieve the original string used inside the .csd as the p4 argument. Is that correct? On 18/06/16 18:01, Victor Lazzarini wrote: > Inside Csound, we would check for a NaN, and there is function to do this. I am not quite sure whether p4 would still be a NaN by the time you access the struct via the API. If that is the case, we just need to export the function that checks for it. > > Victor Lazzarini > Dean of Arts, Celtic Studies, and Philosophy > Maynooth University > Ireland > >> On 18 Jun 2016, at 09:25, Rory Walsh |
Date | 2016-06-18 22:33 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
No, with named GENs there is no way to implicitly turnoff rescaling. GENs need to use an extra parameter for that. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 18 Jun 2016, at 22:22, Guillermo Senna |
Date | 2016-06-18 22:42 |
From | Guillermo Senna |
Subject | Re: csoundGetTableArgs() question... |
My named GEN can't function with rescaling. I've seen that fareygen is similar and so it does "ff->e.p[4] = -1;" If I do that, can Rory retrieve the string used to call the named GEN inside the .csd somehow and not the -1? On 18/06/16 18:33, Victor Lazzarini wrote: > No, with named GENs there is no way to implicitly turnoff rescaling. GENs need to use an extra parameter for that. > > Victor Lazzarini > Dean of Arts, Celtic Studies, and Philosophy > Maynooth University > Ireland > >> On 18 Jun 2016, at 22:22, Guillermo Senna |
Date | 2016-06-18 22:54 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
Not sure. I'd need to look at the Csound code to check (not at the computer now). Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 18 Jun 2016, at 22:42, Guillermo Senna |
Date | 2016-06-18 22:57 |
From | Guillermo Senna |
Subject | Re: csoundGetTableArgs() question... |
Of course, Victor. Whenever you have a spare moment. Thank you very much for replying! Cheers. On 18/06/16 18:54, Victor Lazzarini wrote: > Not sure. I'd need to look at the Csound code to check (not at the computer now). > > Victor Lazzarini > Dean of Arts, Celtic Studies, and Philosophy > Maynooth University > Ireland > >> On 18 Jun 2016, at 22:42, Guillermo Senna |
Date | 2016-06-20 11:14 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
I had a look at this. 1. Currently the way a named plugin GEN can avoid rescaling is to replace its p4 by a negative number (-1) 2. Doing the above will replace the NaN with -1. So the check for string will not work. 3. Unless we provide another means to do it, we need to use p4. 4. I think the cleanest thing to do is to provide an interface to a. disable rescaling (in CSOUND) b. retrieve a GEN name/number as a string (in csound.h) ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 18 Jun 2016, at 21:45, Guillermo Senna |
Date | 2016-06-20 11:56 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
added 2 API functions: /** * Checks if a given GEN number num is a named GEN * if so, it returns the string length (excluding terminating NULL char) * Otherwise it returns 0. */ PUBLIC int csoundIsNamedGEN(CSOUND *csound, int num); /** * Gets the GEN name from a number num, if this is a named GEN * The final parameter is the max len of the string (excluding termination) */ PUBLIC void csoundGetNamedGEN(CSOUND *csound, int num, char *name, int len); The named gen will be assigned a number by Csound. So if you want to prevent rescaling, just multiply p4 by -1 (see the latest ftest.c code for an example) in git. Not tested. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 20 Jun 2016, at 11:14, Victor Lazzarini |
Date | 2016-06-20 12:22 |
From | Rory Walsh |
Subject | Re: csoundGetTableArgs() question... |
How will the end-user specify scaling or not with a named gen? On 20 June 2016 at 11:56, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: added 2 API functions: |
Date | 2016-06-20 13:33 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
In the same way as before. Where this is relevant, there is an extra parameter, that can be made optional. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-06-20 13:57 |
From | Rory Walsh |
Subject | Re: csoundGetTableArgs() question... |
Using a negative p4? So something like this will be possible? f 2 0 8192 "-tanh" -100 100 0 Or am I missing something?
|
Date | 2016-06-20 14:03 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
No, using an extra parameter, p8 in the case of tanh. This has not changed. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-06-20 14:05 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
p7 for tanh, p8 for sone. Sorry, I misread the code. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-06-20 14:08 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
See the manual page, anyway. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-06-20 15:36 |
From | Rory Walsh |
Subject | Re: csoundGetTableArgs() question... |
Ok. Got it. On 20 June 2016 at 14:08, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2016-06-20 18:28 |
From | Guillermo Senna |
Subject | Re: csoundGetTableArgs() question... |
It seems to work well. Thank you very much for implementing this Victor! I have a question though. Did you not abs(num) for a particular reason in csoundIsNamedGEN()? The plugin we are thinking of with Rory is for creating quadratic Bézier curves (with multiple segments). I'll post it to the list if we manage to get it going, in case anyone is interested. People building widgets and working with interactive interfaces may find it useful. Thank you again! On 20/06/16 07:56, Victor Lazzarini wrote: > added 2 API functions: > > /** > * Checks if a given GEN number num is a named GEN > * if so, it returns the string length (excluding terminating NULL char) > * Otherwise it returns 0. > */ > PUBLIC int csoundIsNamedGEN(CSOUND *csound, int num); > > /** > * Gets the GEN name from a number num, if this is a named GEN > * The final parameter is the max len of the string (excluding termination) > */ > PUBLIC void csoundGetNamedGEN(CSOUND *csound, int num, char *name, int len); > > The named gen will be assigned a number by Csound. So if you want to prevent rescaling, > just multiply p4 by -1 (see the latest ftest.c code for an example) > > in git. Not tested. > ======================== > Dr Victor Lazzarini > Dean of Arts, Celtic Studies and Philosophy, > Maynooth University, > Maynooth, Co Kildare, Ireland > Tel: 00 353 7086936 > Fax: 00 353 1 7086952 > >> On 20 Jun 2016, at 11:14, Victor Lazzarini |
Date | 2016-06-20 19:12 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
I forgot to do the abs(). Will fix it. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 20 Jun 2016, at 18:28, Guillermo Senna |
Date | 2016-06-20 19:28 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
Fixed it. Also fixed ftgen to work with the new system. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 20 Jun 2016, at 19:12, Victor Lazzarini |
Date | 2016-06-20 20:18 |
From | Michael Gogins |
Subject | Re: csoundGetTableArgs() question... |
Did you also fix ftgenonce to work with the new system? If not could you please do that? Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Mon, Jun 20, 2016 at 2:28 PM, Victor Lazzarini |
Date | 2016-06-20 20:19 |
From | Victor Lazzarini |
Subject | Re: csoundGetTableArgs() question... |
Will look into it. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 20 Jun 2016, at 20:18, Michael Gogins |