Since my goal is the same i simply hijack this thread...
Though the basics are clear to me i can't get my head around a drawing problem.
I want to draw a wave which is available as array. Its address get passed into the IControl by the SetWav function. I can see the wave shortly drawn (only once everytime i start Reaper) and directly jumping back to all zero. Seems as if the mWav pointer is instantly deleted after a first call or something else?
What am i doing wrong? Thanks for helping...
Code:
class DrawWave : public IControl
{
private:
const double *mWav;
int b,h,mStep;
IRECT mR;
public:
DrawWave(IPlugBase* pPlug, IRECT pR)
: IControl(pPlug, pR){
b = mRECT.R - mRECT.L;
h = mRECT.B - mRECT.T;
mR = pR;
}
void SetWav(const double *wav, int a_size){
mWav = wav;
mStep = a_size/b;
}
bool Draw(IGraphics* pGraphics){
for (int i=0; i<b; i++){
pGraphics->DrawPoint(&COLOR_RED, i+mRECT.L, mRECT.T + (mWav[i*mStep])* h, 0, false);
}
return true;
}
bool IsDirty() { return true;}
};