I have a class (WavPlayer) with a member function fillBuffer().
returnedData = wavReader.CreateBuffer();
You can see here that fillBuffer() calls CreateBuffer() from an instance of my WavReader class. When CreateBuffer() is called a chain of other functions are called, basically it calls GetOpenFileName() and passes the file name and path to mmioOpen(). Then using the other mmio functions I fill the struct returnedData.
I would like to call this function from another class (WavPlayerEditor), my GUI class. I call it here:
void WavPlayerEditor::valueChanged(CControl* pControl)
float value = pControl->getValue ();
switch (pControl->getTag ())
effect->setParameterAutomated (pControl->getTag (), pControl->getValue ());
All this does is check if the "Open" button's value has changed. If so, do something. In this case I want to call the fillBuffer() function from the prior class (WavPlayer).
The problem is CreateBuffer() appears to be getting called twice. Once from the WavPlayerEditor class and then again in the WavPlayer class.
Is there a way around this. I was thinking of creating another function in my WavPlayer class that would simply set the value of a bool variable. Then check if set to true, call fillBuffer().
Hmmmm.... I think I'll try that, but I doubt it will work.