PDA

View Full Version : TrackFX_*() functions


yhertogh
10-19-2009, 07:13 AM
Hi,

Am i missing something or is there no way to control the FX parameters knobs on the TCP/MCP natively from the SDK ?

The TrackFX_*() functions seems to relate to the individual plugins inserted onto the track and can be used to control every parameter of every plugin.
But what i like to do is just control the FX parameter that are visible on the TCP/MCP. There are actions i could use to do this (actions id 950 to 965), but they say 'CC only', and i'd like to call them from my control surface code, so not sure if this actually will work.

Thanks

Yves

Klinke
10-19-2009, 07:32 AM
In the worst case you can send MIDI-CCs and assign them to the actions in the action window. Of course this is just a workaround, because each user of your plugin must first do the assignments too.

Jeffos
10-19-2009, 07:41 AM
Sorry Yves, I don't have the answer. I hope I'll not hijack, but since you're talking about TrackFX_*() functions, I post a question here too.
I've faced a strange thing about that: say I have an int fx param [0..n], in the following code, how comes valFormatted is "0" if the fx value displayed in the GUI is 0 and 1 (!!??)


double v = TrackFX_GetParam(tr, j, 0, &min, &max);
char valFormatted[128];
TrackFX_FormatParamValue(tr, j, 0, v, valFormatted, 128);


Sorry in advance, if it's a big noob error!

Other: I don't want to polluate other threads like this one, and the "How do I..." thread is now too long !!! I've many other questions. How can we do ?

yhertogh
10-19-2009, 07:42 AM
In the worst case you can send MIDI-CCs and assign them to the actions in the action window. Of course this is just a workaround, because each user of your plugin must first do the assignments too.

How would you send MIDI CC's ? Create a midi packet , send it out to a midi loopback cable and then loop them back in ? Sounds ultra-nasty ;-)

I think the KBD_OnMainAction function might work sending 'CC-like' messages towards the actions.

Yves

Jeffos
10-19-2009, 07:44 AM
How would you send MIDI CC's ? Create a midi packet , send it out to a midi loopback cable and then loop them back in ? Sounds ultra-nasty ;-)
Yves

Yves, you can use kbd_OnMidiEvent() for that

yhertogh
10-19-2009, 07:45 AM
Sorry Yves, I don't have the answer. I hope I'll not hijack, but since you're talking about TrackFX_*() functions, I post a question here too.
I've faced a strange thing about that: say I have an int fx param [0..n], in the following code, how comes valFormatted is "0" if the fx value displayed in the GUI is 0 and 1 (!!??)


double v = TrackFX_GetParam(tr, j, 0, &min, &max);
char valFormatted[128];
TrackFX_FormatParamValue(tr, j, 0, v, valFormatted, 128);


Sorry in advance, if it's a big noob error!

No idea (yet) Jeffos, as this is my first journey into FX-plugin-SDK land ;-)

Other: I don't want to polluate other threads like this one, and the "How do I..." thread is now too long !!! I've many other questions. How can we do ?

I always open up another thread , as i think the 'how do i' thread is a bit polluted.

Yves

yhertogh
10-19-2009, 07:46 AM
Yves, you can use kbd_OnMidiEvent() for that

ah ok, thanks for that..but that still means people would have to manually map those CC;s to one of those 16 actions. I was hoping not having to do that.

Yves

Jeffos
10-19-2009, 07:55 AM
I always open up another thread , as i think the 'how do i' thread is a bit polluted.

Yes, I've seen that, but it's gonna make lot of threads...
(I hpoe i'm not too responsible for this "how do i" pollution!)

ah ok, thanks for that..but that still means people would have to manually map those CC;s to one of those 16 actions. I was hoping not having to do that.
Yves

sure, your OP idea (been able to get FX knobs) would be great...

Klinke
10-19-2009, 08:04 AM
Sorry Yves, I don't have the answer. I hope I'll not hijack, but since you're talking about TrackFX_*() functions, I post a question here too.
I've faced a strange thing about that: say I have an int fx param [0..n], in the following code, how comes valFormatted is "0" if the fx value displayed in the GUI is 0 and 1 (!!??)


double v = TrackFX_GetParam(tr, j, 0, &min, &max);
char valFormatted[128];
TrackFX_FormatParamValue(tr, j, 0, v, valFormatted, 128);


Sorry in advance, if it's a big noob error!

Other: I don't want to polluate other threads like this one, and the "How do I..." thread is now too long !!! I've many other questions. How can we do ?

I'm not sure if i understood your question, but maybe the answer is, that FormatParamValue is only supported by few plugins at the moment, mainly for the JS-Scripts and the Reaper-Plugins. So you must check the return value of TrackFX_FormatParamValue(). If it's not supported, i just use the double value in the display. I still hope the Cockos will improve the implementation or add a new feature, because a lot of VST plugins support a vst opcode that returns the actual parameter as a string, but this isn't supported from the API at the current time :-(

yhertogh
10-19-2009, 08:39 AM
I think the KBD_OnMainAction function might work sending 'CC-like' messages towards the actions.

Yves

KBD_OnMainActionEx is indeed the way to go :-) Quite simple actually:


KBD_OnMainActionEx(950+tid-1,KnobMovement,-1,1,0,0);


KnobMovement is 127 or 1 (depending on the direction i twist my rotary encoders), tid is the encoder id, 950 is the first action that allows to set the FX parameter, -1 is telling it that the value is between 1 and 127, and the 1 means that it's relative mode 1. The two 0s denote the main window and current project.

Cool stuff :)

Yves

Jeffos
10-19-2009, 08:59 AM
great tip Yves, thanks.

I'm not sure if i understood your question, but maybe the answer is, that FormatParamValue is only supported by few plugins at the moment, mainly for the JS-Scripts and the Reaper-Plugins. So you must check the return value of TrackFX_FormatParamValue(). If it's not supported, i just use the double value in the display. I still hope the Cockos will improve the implementation or add a new feature, because a lot of VST plugins support a vst opcode that returns the actual parameter as a string, but this isn't supported from the API at the current time :-(

Thanks Klinke.
In my case TrackFX_FormatParamValue() is supported and always returns correct values for param values included in [1..n] (i.e. the values displayed in the FX GUI). The issue is that it returns ["0".."n-1"] for [1..n], so when I use it for 0 or 1 it returns "0" in both cases (I hope it's clear).

Klinke
10-19-2009, 03:45 PM
Can you tell me for which plugin and parameter you call TrackFX_FormatParamValue()?

And i still don't understand your problem. When the param value range is [1...n], why to you call FormatParamValue for a param value of 0? You should only call FormatParamValues for values between min and max of TrackFX_GetParam().

Jeffos
10-20-2009, 12:00 AM
thanks for you help, Klinke.
Can you tell me for which plugin and parameter you call TrackFX_FormatParamValue()?

an iplug instance (e.g. 1st param of SendReaControl, see main forum)


And i still don't understand your problem. When the param value range is [1...n], why to you call FormatParamValue for a param value of 0? You should only call FormatParamValues for values between min and max of TrackFX_GetParam().

this is not what i said: i said "returns correct values for param values included in [1..n]" bu tthe definition range is indeed [0..n] and min, max values are set according to that...
of course, I've workarounded that but I'd like to understand.

[EDIT] ... but it should be a noob misunderstanding like that, HUGE bug otherwise !

dizzib
10-22-2009, 03:23 AM
Hi Yves,

If I understand you correctly I think we'd need something along the lines of the following...


// get # fx-params on a given track
REAPER_PLUGIN_DECLARE_APIFUNCS int (*TrackFXParam_GetCount)(MediaTrack *tr);

// get fx-param name
REAPER_PLUGIN_DECLARE_APIFUNCS bool (*TrackFXParam_GetName)(MediaTrack *tr, int fxparam, char *buf, int buflen);

// get fx-param value
REAPER_PLUGIN_DECLARE_APIFUNCS double (*TrackFXParam_GetValue)(MediaTrack *tr, int fxparam, double *minval, double *maxval);

// set fx-param value
REAPER_PLUGIN_DECLARE_APIFUNCS bool (*TrackFXParam_SetValue)(MediaTrack *tr, int fxparam, double val);


Ideally there'd also be some change notification events from Reaper.

Cheers,
Andy.

yhertogh
10-22-2009, 03:28 AM
Hi Yves,

If I understand you correctly I think we'd need something along the lines of the following...


// get # fx-params on a given track
REAPER_PLUGIN_DECLARE_APIFUNCS int (*TrackFXParam_GetCount)(MediaTrack *tr);

// get fx-param name
REAPER_PLUGIN_DECLARE_APIFUNCS bool (*TrackFXParam_GetName)(MediaTrack *tr, int fxparam, char *buf, int buflen);

// get fx-param value
REAPER_PLUGIN_DECLARE_APIFUNCS double (*TrackFXParam_GetValue)(MediaTrack *tr, int fxparam, double *minval, double *maxval);

// set fx-param value
REAPER_PLUGIN_DECLARE_APIFUNCS bool (*TrackFXParam_SetValue)(MediaTrack *tr, int fxparam, double val);


Ideally there'd also be some change notification events from Reaper.

Cheers,
Andy.
Edited: initially i though you copied/pasted the current APIs ;-)

Yes, that would be great, but its quite elegant with the KBD_OnMainActionEx API as described above. There is no need to get a value to set it, as my knobs are sending out 'relative' messages i.e. a 1 or a 127. I can even send these right into this function without modification.

As the knobs (in my case) have no visualization of the actual value (they are endless rotary knobs) i dont need events from reaper. The only thing which i loose is the ability to Undo apparently.

Yves

dizzib
10-22-2009, 05:38 AM
Ah right, I see what you're doing now and I can appreciate the simplicity of your solution. Unfortunately I'm coding for the Mackie C4 which would need formatted FXParam values to be returned in a similar way to the existing TrackFX functions.

Cheers!

Padre_PC
10-22-2009, 08:26 AM
I'm coding for the Mackie C4 which would need formatted FXParam values to be returned in a similar way to the existing TrackFX functions.

Same here for my Novation Automap plugin: I added a KBD_OnMainActionEx() implementation after reading this topic but I would definitely enjoy it with the actual names and formatted values of the FX Parameters under control.

yhertogh
10-27-2009, 08:19 AM
I've created a real FR (http://forum.cockos.com/project.php?issueid=1406) for this.

Please vote like mad :)

Yves

Jeffos
10-28-2009, 03:06 AM
voted !
@klinke, for what we talked about elsewhere, I'll have a look this week end...

yhertogh
11-10-2009, 07:22 AM
We're not getting a lot of love on this issue. There really needs to be a way to

1. control the fx params without using the built in actions
2. a way to find out which fx the fx param knob belongs to.


actually if we'd have 2 above, we can use the existing functions to do most of the stuff.

As a side note: is there a way to open up the FX window for an individual plugin either with an action, or with a function ?

Yves

Padre_PC
11-10-2009, 09:40 AM
We're not getting a lot of love on this issue.

I've posted another support message for this FR in the Automap CSurf thread + still have it in my signature. Maybe the description is too dev oriented, no? I think a lot of people won't understand what it is about.

Klinke
11-10-2009, 10:00 AM
As a side note: is there a way to open up the FX window for an individual plugin either with an action, or with a function ?

No, AFAIK only an action exist for opening the Track FX window, but you can't select a single plugin in this window or open a single plugin GUI directly :-(

dizzib
01-31-2010, 10:17 AM
No, AFAIK only an action exist for opening the Track FX window, but you can't select a single plugin in this window or open a single plugin GUI directly :-(

Hi, does anyone know if there's a pending FR for this? Currently I have to use the mouse to select the plugin I'm tweaking on the controller.

Cheers.

Jeffos
01-31-2010, 12:20 PM
You can do both by patching the related track's chunk thanks to GetSetObjectState(MediaTrack*).
To popup the chain FX window: patch the row "SHOW i" under "<FXCHAIN" (where i=0 means closed wnd, show window for FX n°i otherwise). To select an FX: patch "LASTSEL i" (where i is 0-based).
Both rows are a bit tied, in other words to show the FX chain with 3rd FX shown/selected:

<TRACK '{FBF959A2-F11A-47C9-9369-D89F50438F0C}'
[...]
<FXCHAIN
[...]
SHOW 3
LASTSEL 2

I know it works.

@klinke! Hey, quite sure my issue above was due to the min, max that I was totally ignoring until that other recent thread! Thanks!

dizzib
01-31-2010, 12:53 PM
Great stuff Jeffos, I'll have to look into this GetSetObjectState() method since I've never used it before. Thanks!

Jeffos
01-31-2010, 02:34 PM
dizzib, yeah! this one deserve a close look ;)

.. I forgot: after digging a bit more in the API, I now also see a way to reply to the OP:
Am i missing something or is there no way to control the FX parameters knobs on the TCP/MCP natively from the SDK ?

There really needs to be a way to

1. control the fx params without using the built in actions
2. a way to find out which fx the fx param knob belongs to.


yves, rather controling the knob, it's the related parameter that should be updated (TrackFX_SetParam() => indirectly updates the knob) and, in the related track's chunk, you can read that info: which knobs are defined and to which prms they're tied. for each FX, if at least one knob is defined, you'll find a row "PARM_TCP a b c [...]" where a, b, c, etc.. are the param indexes (0-based).

humm.. but! that remember me a FR ;) perharps that's also why FX knobs cannot be ordered by the user but are automatically ordered by FX (i.e. moving a FX in the chain changes the knob order): I think chunks and the model are closed things, if not the same.. and chunks are very handy.. the only pb with that, I think, is that, if the model changes..