COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 10-29-2009, 05:03 AM   #1
asiohead
Human being with feelings
 
Join Date: Oct 2009
Posts: 8
Default IBitmapOverlayControl index and state

Hi, I’ve just started developing VST’s with WDL/iPlug. I like it a lot !
I’m working with the example included in the iplug framework. And I’m slowly getting there.


My actual question is about the IBitmapOverlayControl.

I made a 16x16 matrix of these handy ‘toggle’ buttons. Yes for a step seq

I want to Dynamicaly create 16x16 of these, and access their value/state and position ( instance index ) so I know whitch one I pushed and store it’s value/state in an array.

Can anyone explain to me how you do that please ?
How do I access the index of one of these controls, since there is no extra parameter in the IBitmapOverlayControl to store an index.

I created a MatrixControl that inherits from the IBitmapOverlayControl and added this extra (int) parameter, and stored a counter value in there from within the loop that creates these matrix buttons.
But I don’t know If I’m doing it right, I still can’t access these buttons value/index.

I got the feeling there must be a simpler more logical way.

Can anyone help me on my way with this please ? I’d really appreciate it


Thanx !
asiohead is offline   Reply With Quote
Old 10-30-2009, 02:17 AM   #2
cc_
Human being with feelings
 
Join Date: Mar 2009
Posts: 256
Default

Maybe I've misunderstood what you are trying to do, it sounds to me like you just need an array, something like:

Code:
IControl *seq_array[16][16];
for (int i=0;i<16;i++) {
 for (int j=0;j<16;j++) {
    seq_array[i][j] = new IBitmapOverlayControl( ....
cc_ is offline   Reply With Quote
Old 10-30-2009, 05:45 PM   #3
asiohead
Human being with feelings
 
Join Date: Oct 2009
Posts: 8
Default

Hey, thanx. I had created/populated the matrix (screen) with IBitmapOverlayControls already without the use of an array. And show/hiding them by clicking on them works. Maybe the use of an array to put them in first could be useful to address them easier indeed.
(sorry if my post was a bit confusing)

But what I can't figure out is, once I have this matrix full of IBitmapOverlayControls. How can I set or read their on/off state.

For example; the goal is to set each individual button to on or off, based on another (preset/memory) array that consist of true/false values when I am populating the button matrix.

And when I click in the grid to activate a button, I want to write it's state to that (preset/memory) array. (Can't I attach an event handler to the IBitmapOverlayControl to do that btw? Sorry, I'm coming from c# and still learning c++ )


so basically; how do I set and read the IBitmapOverlayControl button state ?

thanx !
asiohead is offline   Reply With Quote
Old 10-31-2009, 12:27 AM   #4
cc_
Human being with feelings
 
Join Date: Mar 2009
Posts: 256
Default

You can set the value by calling the control's SetValueFromUserInput() function, and get the value by calling GetValue(). That's why you'll need to keep pointers to the controls.

I don't think you IBitmapOverlayControl is best for this though - I think it is meant mostly for a popup overlay with some help or credits etc.

For your use an ISwitchControl would probably be better.
cc_ is offline   Reply With Quote
Old 11-02-2009, 08:46 AM   #5
asiohead
Human being with feelings
 
Join Date: Oct 2009
Posts: 8
Default

thank you !

Got it working.
asiohead is offline   Reply With Quote
Old 11-10-2009, 02:37 PM   #6
asiohead
Human being with feelings
 
Join Date: Oct 2009
Posts: 8
Default

.. well, not quite actually

I made a ScanMatrix function that ‘scans’/reads the states of all the buttons (in btnArray) and writes the values in a new SeqArray which is then passed by pointer to the Sequencer object. So I can further manipulate it there

that part works but ...

I haven't really made it efficient to be honest, to constantly iterate thru 256 buttons to read their state, just to see if anything has changed. And this ScanMatrix function has to be triggered anyway. And I haven’t got a clue where I should do that. At the moment it does it once on the OnGUIOpen()method. But when I try to define an onMouseDown method on the main plugin class and have that trigger the ScanMatrix function the plugin hangs.

So that’s why I want to make the button itself call a function to update the SeqArray only with it’s value when it is pressed. But how do I do that ?
I have the main vst class/program, and a separate class, my customButton that inherits from … ISwitchControl. How can I call or trigger the ScanMatrix function that is in the main vst class from here ?

You mentioned by using a pointer, do you mean a function pointer ? can you please explain how that works. Do you perhaps have an example available, where a button triggers a function.
asiohead is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.