PDA

View Full Version : Help with freeframe example plugin


topherz
4th December 2004, 04:50 PM
To the freeframe experts,

Always been wanting to write some freeframe plugins, finally have a little time!

Everything is pretty clear with the standard, and im working from the included CPlugin example. (building with visualcplusplus 6) And testing with the included "plugin tester.exe"

Its working, and i have a plugin that works in other hosts, except... i cannot add a fourth parameter to the existing three parameters in the sample. And I am stumped as to what i am doing wrong.

The Symptoms:

When i try the plugin in the "plugin tester", the effect seems to load ok, I see four parametes with all the correct names, but the effect is not applied to the video. Ive gone through the 17 steps one by one, and i get no error messages till i click on button 17, "Deinit and DeInstance". Then I get a popup error message from windows:
"debug error: DAMAGE after normal block ...." (see attached jpeg)


The Code:

To isolate what was causing the problem, i started fresh with the suplied CPlugin code. It complied and worked perfectly.
Then I made the following three code changes to FreeFrameSample.cpp, the minimum I figured to get 4 parameters.

1.


#define NUM_PARAMS 4
#define NUM_INPUTS 1


2.


DWORD initialise()
{
// populate the parameters constants structs
paramConstants[0].defaultValue = 0.5f;
paramConstants[1].defaultValue = 0.5f;
paramConstants[2].defaultValue = 0.5f;
paramConstants[3].defaultValue = 0.5f;

char tempName1[17] = "red";
char tempName2[17] = "green";
char tempName3[17] = "blue";
char tempName4[17] = "blue";

memcpy(paramConstants[0].name, tempName1, 16);
memcpy(paramConstants[1].name, tempName2, 16);
memcpy(paramConstants[2].name, tempName3, 16);
memcpy(paramConstants[3].name, tempName4, 16);

return FF_SUCCESS;
}



3. (In instantiate)

pPlugObj->paramDynamicData[0].value = 0.5f;
pPlugObj->paramDynamicData[1].value = 0.5f;
pPlugObj->paramDynamicData[2].value = 0.5f;
pPlugObj->paramDynamicData[3].value = 0.5f;


That is it.
*******************************

Anyone have an idea what the problem could be?

Thanks for any suggestions!

-topher

petewarden
5th December 2004, 11:52 PM
Hey Topher,
I believe this happens because there's one place in FreeframeSample.h you need to change, on line 182:
ParamDynamicDataStruct paramDynamicData[3];
If you change that to [4] at the end, you should avoid the error. This is something we need to fix in the example code, there's already a comment discussing a change in the code.

Hope that helps. By the way, thanks for taking the time to describe your problem in detail, that made it a lot easier to figure out what was happening.

thanks,
Pete

syzygy
6th December 2004, 12:10 AM
I'll make some time next week to update the sample plugin code.

Dan.

topherz
7th December 2004, 09:55 AM
Ahhh, that must be it!
Thanks a lot, will check that out in the h file.

-topher