View Full Version : Grayout Control Problem
RRokkenAudio
01-22-2010, 12:13 PM
Using this:
GetGUI()->GrayOutControl(kHPfreqSel,gray);
Throws the error:
'gray' - undelcared identifier
The control is a knob.
~Rob.
I believe it should be:
GetGUI()->GrayOutControl(kHPfreqSel,true);
RRokkenAudio
01-22-2010, 07:05 PM
oh, thats just embarrassing right there, thank you lol.
RRokkenAudio
01-22-2010, 10:10 PM
Ok, Here's another. I have a caption control that I need to update with values from a case.
pGraphics->AttachControl(new IKnobMultiControl(this, 184 , 96, ksomething, &bitmap));
pGraphics->AttachControl(new ICaptionControl(this, &IRECT(185, 32, 185, 32), ksomething , &IText(&COLOR_WHITE), true));
That shows the value of the control 0-3. But down in the code I actually have a Switch/Case.
How do i put the switch/case values into the caption control. If I use:
GetGUI()->SetControlFromPlug(HPfreqSel, ksomething );
it changes the position of the knob. I've had it also start showing the case NUMBERS 0-3 instead of the values of the variable HPfreqSel that is assigned in the cases.
argghhh
~Rob.
Jeffos
01-23-2010, 07:20 AM
hey rob! not sure I 100% understood, but hth! first, your caption's IRECT has 0 width, 0 height! also, this thread may help: http://forum.cockos.com/showthread.php?t=33893.
If you don't observe/attach params together, then, I guess your code should look like (pseudo-code + didn't test):
controls creation:
pGraphics->AttachControl(new IKnobMultiControl(ksomething));
m_idx = pGraphics->AttachControl(new ICaptionControl(ksomething));
where m_idx is an int that should be stored (eg member attribute)
then, when needed, in order to refresh the caption:
GetGUI()->SetControlFromPlug(m_idx, normalizedValue);
RRokkenAudio
01-23-2010, 11:18 AM
All I'm trying to do BTW is have a caption control that displays a value from inside the process loop, say DB level. Has nothing to do with a knob control at all.
So i did:
double FreqSelection = 0;
int myfreqlabel = pGraphics->AttachControl(new ICaptionControl(this, &IRECT(275, 32, 275, 32), FreqSelection, &IText(&COLOR_WHITE), true));
At the top, and down at the bottom I put:
GetGUI()->SetControlFromPlug(myfreqlabel, 200); //Put 200 for testing
That did not update the caption control. so I tried:
GetGUI()->SetControlFromPlug(FreqSelection, 200);
That did not work either. What should I be initializing FreqSelection too, I am initializing it to 0, think thats the prob in there.
~Rob.
RRokkenAudio
01-23-2010, 09:22 PM
Can an icaption control even show a value that isn't hooked to a control, say just show the values of *in ?
Jeffos
01-24-2010, 04:32 AM
double FreqSelection = 0;
int myfreqlabel = pGraphics->AttachControl(new ICaptionControl(this, &IRECT(275, 32, 275, 32), FreqSelection, &IText(&COLOR_WHITE), true));
At the top, and down at the bottom I put:
GetGUI()->SetControlFromPlug(myfreqlabel, 200); //Put 200 for testing
I'm a bit lost here.. several things are wrong in the code:
- as I said in my previous post, "myfreqlabel" should be a member attribute, not a local var.
- consequence: you're calling SetControlFromPlug() "down at the "bottom" of the constructor. But, refreshing such a monitoring control (not tied to a FX param) should be done when needed, for ex, in ProcessDoubleReplacing(): see vu-meters in schwa's example.
- local var "FreqSelection" used to instanciate the control: it should either be as FX prm idx, or, for monitoring controls not tied to FX prms, a negative value -but- that doesn't really make sense for ICaptionControl (=> ITextControl)
- SetControlFromPlug called with un-normalized value 200 (should be in [0..1])
- 0*0 IRECT
Can an icaption control even show a value that isn't hooked to a control, say just show the values of *in ?
That's also why I didn't understand.. I suspect you don't need ICaptionControl / SetControlFromPlug() but rather a ITextControl and its SetTextFromPlug(), but I repeat, I'm a bit lost here..
rob, it seems lot of your Q's have the same origin, you might save some time this way: when I talked about a "member attribute" in my previous post, or (about gfx primitives), when I and Xenakios (with much more details) were replying "inherit IControl and just overrride the Draw() method", do those wordings "attribute", "override",.. talk to you? if not, you should dig a bit into the ++ part of C because that's the way to go with IPlug! ;)
RRokkenAudio
01-24-2010, 11:25 AM
Well, I didn't use Itextcotrol because I see:
pGraphics->AttachControl(new ITextControl(this, &IRECT(10, 120, 10 + 128, 120 + 32), &lFont1, "mystring"));
Doesn't take a variable in there, to update.
BTW: you nailed it with the "dig into the ++ side" lol, I have a hard time looking at the classes and being able to understand what they mean, Iplug*text, Iplug * p etc lol (those are prob not even really in there, but you get the idea).
~Rob.
If you used an ITextControl you can set the text string to display directly. You have to keep a pointer to the ITextControl when you create it (the example you gave above creates and attaches the ITextControl without keeping a pointer to it), something like:
pT = new ITextControl(....
pGraphics->AttachControl(pT);
Then inside your audio loop you can do:
char *text = "whatever";
pT->SetTextFromPlug(text);
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.