PDA

View Full Version : SetControlFromPlug


bozmillar
11-04-2010, 11:39 AM
So from SetControlFromPlug() I can update a value that will be drawn to the screen. it accepts an ID and a value. But let's say I wanted to make a spectrum analyzer and need to update a lot of values often.

At first look my guess is to make a new class that extends IGraphics with a function that accepts and ID and a pointer. That way I could just fill a buffer and send it to whatever function will draw the frequency curve.

My other thought would be to just call SetControlFromPlug() a million times every once my buffer is full, but that just seems like a bad idea.

Is there some other way that I'm not thinking of to update a large number of points on the screen to be drawn?

junioreq
11-04-2010, 12:08 PM
I know nothing about this, would like to do it eventually. But don't you get the magnitude(or whatever you need) for the audio, and interpolate and draw one line somehow via looping inside the draw?

EDIT: After reading your post, I think you were actually hitting on this.

~Rob.

bozmillar
11-04-2010, 12:36 PM
yeah, I can do all that inside the Draw function, I'm just looking for an efficient way to get 512 or 1024 values into the Draw function.

bozmillar
11-04-2010, 01:02 PM
nevermind. Got it. I can just pass a pointer into the Draw function.

olilarkin
11-04-2010, 04:15 PM
I wonder if you'll need to do any locking since your memory will be being written/read in different threads.

bozmillar
11-04-2010, 04:33 PM
I wonder if you'll need to do any locking since your memory will be being written/read in different threads.

hmm. good point. Does this cause the potential to crash or just show incorrect values?