|
01-15-2010, 08:31 PM
|
#1
|
Human being with feelings
Join Date: Dec 2009
Posts: 73
|
Parameters Private
How is it possible to make parameters private or non-automatable? By that I mean invisible to the host.
thanks for any ideas on this
Andy
|
|
|
01-16-2010, 01:18 AM
|
#2
|
Human being with feelings
Join Date: Jun 2007
Posts: 125
|
One possible way would be to tell the host the plug has less params than it does. Then you would have to arrange the controls such that the ones you want to hide are outside the range of what was reported to the host. IPlug might abstract that for you so it might require some digging.
|
|
|
01-16-2010, 01:21 AM
|
#3
|
Human being with feelings
Join Date: Mar 2009
Posts: 256
|
Or just make a variable of type IParam:
Code:
pParam = new IParam();
|
|
|
01-16-2010, 03:23 AM
|
#4
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
Or simply declare your "hidden" params after kNumParams:
Code:
enum EParams
{
kMode=0,
kChannelSw,
kMsgTypeSw,
kNumParams,
// hidden params:
kPRIVATE1,
kPRIVATE2
};
|
|
|
01-16-2010, 02:07 PM
|
#5
|
Human being with feelings
Join Date: Dec 2009
Posts: 73
|
Thankyou all, I'll try these suggestions out
The one problem I can perhaps foresee for declaring after the kNumParams is that these wouldn't be picked up by OnParamChange would they?
I come from an SE background and I'm used to the ability to set as private.
thanks again
Andy
|
|
|
01-17-2010, 03:54 AM
|
#6
|
Human being with feelings
Join Date: Jun 2007
Posts: 125
|
As a note to the OP, all three suggestions accomplish the same thing, putting params at indices beyond what the host knows about. I have never used SE, but being familiar with the VST plugin API it is easy to imagine it does the exact same thing.
|
|
|
01-17-2010, 08:09 AM
|
#7
|
Human being with feelings
Join Date: Dec 2009
Posts: 73
|
Not having any luck so far, adding values beyond kNumParams causes an unhandled exception upon loading. Also, using a separate enum list (beginning at kNumParams+1) and just adding the control causes an exception when the control is clicked.
I can't understand how creating an IParam variable would work, so I haven't tried that yet.
I suppose that I will just have to adapt my thinking to having no private parameters.
The other aspect that I might find hard to live without is global parameters that do not change with a program change (which I also use in SE).
Thanks for all the suggestions, I really do like IPlug so far.
|
|
|
01-17-2010, 10:42 AM
|
#8
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
SideBar: What does OnParamChange do?
~Rob.
|
|
|
01-17-2010, 02:12 PM
|
#9
|
Human being with feelings
Join Date: Dec 2009
Posts: 73
|
onparamchange receives a message every time a parameter changes so you can then do processing. For example:
IParam* val = GetParam(paramIdx); // get the current value
switch (paramIdx)
{
case comb01:
{
// do something with value
rev.set_comb(val->Value(), paramIdx - comb01);
} break;
}
With the synthedit SDK this section was a more efficient place to do parameter based changes, and so I am used to using it. SE would only report the first and last changes as opposed to every change when for example moving a slider, although I think in here it seems to report all changes, or at least most. I've wondered whether it is occuring at block rate, ie; outside of the actual sample process loop, would be nice if someone could clarify that?
But the main thing that makes this function useful is that if you are doing the same thing in the main process, it will run on every process at samplerate, whereas in this function it will only run when a parameter changes, so potentially saving a huge amount of real time processing.
One thing to bear in mind if using one shot buttonsnthat return to zero on mouse release, is that you have to filter out one of the 2 states so that the process only occurs once, in the relevant button switch case:
if (val->Value() < 0.99)
return;
hope that makes sense!
|
|
|
01-17-2010, 02:19 PM
|
#10
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Totally sorry to sidetrack this, How are you guys learning about Iplug and how to use it, make your own controls and know what all this is doing!?! its not documented anywhere!!
BTW: I only see onparamchange in the .h file and really theres nothing in it!
~Rob
|
|
|
01-17-2010, 02:35 PM
|
#11
|
Human being with feelings
Join Date: Dec 2009
Posts: 73
|
Well, I am still getting to grips with IPlug, but I have been programming modules for SE for 3-4 years and so I understand all the concepts, just having to transplant them. I would suggest getting a good C++ book and learning about functions, classes etc... it is invaluable to have some grounding and you will understand a lot more. Most importantly just keep messing around and stick at it, it will unfold slowly and I found that rewarding as things become clearer
For controls, read up on class inheritance and then have a look at IControl.h & .c and look at the existing controls. When a class has something like : public classname it means that the class can use all of the functions in the classname class, but more importantly you can override them to do your own processing. Sorry I find this hard to explain, but the best advice is to try copying an existing class, rename it and start experimenting, you will get there.
If you are adding controls though you will have to remove the static library, add all the IPlug files to your project, otherwise you would have to re-compile the library everytime to see the changes. To remove the static library it will be in your projects settings, in the libraries section.
|
|
|
04-05-2010, 11:58 PM
|
#12
|
Human being with feelings
Join Date: Nov 2008
Posts: 35
|
Did you find a way to hide the parameter fom the Host?
__________________
ojoj...
|
|
|
04-06-2010, 07:49 AM
|
#13
|
Human being with feelings
Join Date: Dec 2009
Posts: 73
|
Well I did start using GUI controls with false ids, but found that in the AU they didn't work, so I went back to using params. The problem was that they didn't trigger OnParamChange() which makes them pretty much useless for my purposes.
BUT, without having a look, perhaps using the chunk storage method, any external params used there are invisible. I'm planning on using that method for ints too, as I realised that if you are using the enum type and later on you want to add to a list, it would break backward compatibility. I'll report back an let you know if they are invisible or not.
I haven't tried the text storage method in an AU yet, I hope that works..
|
|
|
08-06-2011, 10:09 AM
|
#14
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Been trying to to hide things after knumparams, just gives me a reaper scan error during load CC_ might have something..but I'm not totally sure what is meant by that..
Last edited by RRokkenAudio; 08-06-2011 at 10:27 AM.
|
|
|
08-06-2011, 01:22 PM
|
#15
|
Human being with feelings
Join Date: Feb 2009
Posts: 60
|
Here is what I ended up doing .. modifying IPlugBase to have an explicit distinction between public and private params. Private params are created when the plugin calls AddPrivateParams(numPrivates). By default the plug does not have any private params (so default WDL/IPlug behavior is preserved). Updates to private params get directed to OnParamChange() just like public params. I also changed the serialize functions so that private params are not serialized. This worked best for me but I could imagine scenarios where it would be convenient to have them automatically persisted too, maybe have 2 types of private params, persistent private params and non-persistent. Needs thought. Anyway, here are the changes that worked for me:
in IPlugBase.h
- add data member mNumPublicParams to tell the number of public params
- add methods to interrogate num public, num private
- add method to create private parameters
Code:
public:
int NParamsPrivate() { return mParams.GetSize() - mNumParamsPublic; }
int NParamsPublic() { return mNumParamsPublic; }
bool IsPublicParam(int paramIdx) { return paramIdx >= 0 && paramIdx < mNumParamsPublic; }
bool IsPrivateParam(int paramIdx) { return paramIdx >= mNumParamsPublic; }
bool IsActiveParam(int paramIdx) { return paramIdx >= 0 && paramIdx < mParams.GetSize(); }
void AddPrivateParams(int nPrivate)
{
for (int i = 0; i < nPrivate; i++)
{
mParams.Add(new IParam);
}
}
Code:
private:
int mNumParamsPublic;
in IPlugParams.cpp
- init mNumPublicParams to nParams in the constructor
Code:
IPlugBase::IPlugBase(int nParams, ....)
: mUniqueID(uniqueID), .....,
mNumParamsPublic(nParams)
{
...
}
- serialize only the public parameters
Code:
bool IPlugBase::SerializeParams(ByteChunk* pChunk)
{
TRACE;
WDL_MutexLock lock(&mMutex);
bool savedOK = true;
// int i, n = mParams.GetSize();
int i, n = mNumParamsPublic;
for (i = 0; i < n && savedOK; ++i) {
IParam* pParam = mParams.Get(i);
double v = pParam->Value();
savedOK &= (pChunk->Put(&v) > 0);
}
return savedOK;
}
int IPlugBase::UnserializeParams(ByteChunk* pChunk, int startPos)
{
TRACE;
WDL_MutexLock lock(&mMutex);
//int i, n = mParams.GetSize(), pos = startPos;
int i, n = mNumParamsPublic, pos = startPos;
for (i = 0; i < n && pos >= 0; ++i) {
IParam* pParam = mParams.Get(i);
double v = 0.0;
Trace(TRACELOC, "%d %s", i, pParam->GetNameForHost());
pos = pChunk->Get(&v, pos);
pParam->Set(v);
}
OnParamReset();
return pos;
}
Finally, in the Plugin code, create markers in the plugin id enumeration to separate the public and private plugins, and call the AddPrivateParams() method during construction to create the private params.
Code:
enum EParams {
kPlayMode = 0,
kTimeDivision,
...
kNumParamsPublic,
// ---- PRIVATE parameters
kSequencerLock = kNumParamsPublic, // keep the list contiguous
kSequencerReverse,
kNumParams,
kNumParamsPrivate = kNumParams - kNumParamsPublic
};
Code:
MyPlugin::MyPlugin(IPlugInstanceInfo instanceInfo)
: IPLUG_CTOR(kNumParamsPublic, 6, instanceInfo)
{
TRACE;
AddPrivateParams(kNumParamsPrivate);
...
}
|
|
|
08-06-2011, 03:40 PM
|
#16
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
hmm... This should be stock in Iplug. Gonna give this a shot. Thanks man.
~RR.
|
|
|
11-20-2017, 04:41 AM
|
#17
|
Human being with feelings
Join Date: Mar 2016
Posts: 234
|
Quote:
Originally Posted by tonecarver
Here is what I ended up doing ..
|
Very nice approach! Thanks to share it.
I've simply copy/pasted part of your code, because in fact I need to serialize all data, even the private ones, and store changes on preset. 5 minutes, and the feature "hidden control to DAW" is ready! Nice, thanks again!
The only think which don't work (in FL, at least) is that once I change a "private" param (from GUI, for example), and than I close DAW, Host won't ask to me "would you like to save your work?". It seems that InformHostOfParamChange is being called, but FL ignore params that are not "listed" as public? Any one else noticed this? I'm developing VST.
Not sure how I could fix it. DirtyParameters();?
Thanks
|
|
|
04-30-2020, 02:02 AM
|
#18
|
Human being with feelings
Join Date: Aug 2013
Posts: 236
|
Quote:
Originally Posted by tonecarver
Here is what I ended up doing .. modifying IPlugBase to have an explicit distinction between public and private params. Private params are created when the plugin calls AddPrivateParams(numPrivates). By default the plug does not have any private params (so default WDL/IPlug behavior is preserved). Updates to private params get directed to OnParamChange() just like public params. I also changed the serialize functions so that private params are not serialized. This worked best for me but I could imagine scenarios where it would be convenient to have them automatically persisted too, maybe have 2 types of private params, persistent private params and non-persistent. Needs thought. Anyway, here are the changes that worked for me:
in IPlugBase.h
- add data member mNumPublicParams to tell the number of public params
- add methods to interrogate num public, num private
- add method to create private parameters
Code:
public:
int NParamsPrivate() { return mParams.GetSize() - mNumParamsPublic; }
int NParamsPublic() { return mNumParamsPublic; }
bool IsPublicParam(int paramIdx) { return paramIdx >= 0 && paramIdx < mNumParamsPublic; }
bool IsPrivateParam(int paramIdx) { return paramIdx >= mNumParamsPublic; }
bool IsActiveParam(int paramIdx) { return paramIdx >= 0 && paramIdx < mParams.GetSize(); }
void AddPrivateParams(int nPrivate)
{
for (int i = 0; i < nPrivate; i++)
{
mParams.Add(new IParam);
}
}
Code:
private:
int mNumParamsPublic;
in IPlugParams.cpp
- init mNumPublicParams to nParams in the constructor
Code:
IPlugBase::IPlugBase(int nParams, ....)
: mUniqueID(uniqueID), .....,
mNumParamsPublic(nParams)
{
...
}
- serialize only the public parameters
Code:
bool IPlugBase::SerializeParams(ByteChunk* pChunk)
{
TRACE;
WDL_MutexLock lock(&mMutex);
bool savedOK = true;
// int i, n = mParams.GetSize();
int i, n = mNumParamsPublic;
for (i = 0; i < n && savedOK; ++i) {
IParam* pParam = mParams.Get(i);
double v = pParam->Value();
savedOK &= (pChunk->Put(&v) > 0);
}
return savedOK;
}
int IPlugBase::UnserializeParams(ByteChunk* pChunk, int startPos)
{
TRACE;
WDL_MutexLock lock(&mMutex);
//int i, n = mParams.GetSize(), pos = startPos;
int i, n = mNumParamsPublic, pos = startPos;
for (i = 0; i < n && pos >= 0; ++i) {
IParam* pParam = mParams.Get(i);
double v = 0.0;
Trace(TRACELOC, "%d %s", i, pParam->GetNameForHost());
pos = pChunk->Get(&v, pos);
pParam->Set(v);
}
OnParamReset();
return pos;
}
Finally, in the Plugin code, create markers in the plugin id enumeration to separate the public and private plugins, and call the AddPrivateParams() method during construction to create the private params.
Code:
enum EParams {
kPlayMode = 0,
kTimeDivision,
...
kNumParamsPublic,
// ---- PRIVATE parameters
kSequencerLock = kNumParamsPublic, // keep the list contiguous
kSequencerReverse,
kNumParams,
kNumParamsPrivate = kNumParams - kNumParamsPublic
};
Code:
MyPlugin::MyPlugin(IPlugInstanceInfo instanceInfo)
: IPLUG_CTOR(kNumParamsPublic, 6, instanceInfo)
{
TRACE;
AddPrivateParams(kNumParamsPrivate);
...
}
|
Has anyone used the procedure successfully? I have problems with the presets, it does not restore the presets correctly after saving the project in daw and reopening.
|
|
|
04-30-2020, 04:32 AM
|
#19
|
Human being with feelings
Join Date: Aug 2013
Posts: 236
|
The problem is on SerializeParams / UnserializeParams , must serialize all params. So mParams.GetSize() not only mNumParamsPublic
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:16 PM.
|