Do string parameters work in FFGL Plugins?

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
User avatar
elio
Is taking Resolume on a second date
Posts: 15
Joined: Thu Sep 29, 2011 20:58

Do string parameters work in FFGL Plugins?

Post by elio »

Do String parameters from FFGL Plugins work in Resolume?
I've been trying FF_TYPE_TEXT but just the definition (without even getting or setting parameter values) makes Resolume crash.

SetParamInfo(FFPARAM_Bridge, "SharedMemoryName", FF_TYPE_TEXT, "xxxx");

Thanks for helping me! Elio
Realitäten Revue - http://www.r-revue.de

bangnoise
Met Resolume in a bar the other day
Posts: 8
Joined: Fri Jun 25, 2010 01:46

Re: Do string parameters work in FFGL Plugins?

Post by bangnoise »

Yep they work - we use them for the Syphon plugins (now redundant in Resolume, but still functional). We don't use the FFGL SDK, but code is at http://code.google.com/p/syphon-impleme ... FFreeFrame

User avatar
elio
Is taking Resolume on a second date
Posts: 15
Joined: Thu Sep 29, 2011 20:58

Re: Do string parameters work in FFGL Plugins?

Post by elio »

Hey thanks for this. I'll have a look on it.
Just realized that the FFGL SDK seems to have a bug regarding strings.
I'm just about to create a fix.
Realitäten Revue - http://www.r-revue.de

User avatar
elio
Is taking Resolume on a second date
Posts: 15
Joined: Thu Sep 29, 2011 20:58

Re: Do string parameters work in FFGL Plugins?

Post by elio »

FFGL.cpp seems to be buggy for String parameters (Version 1.5 - but Freeframe.cpp of Version 1.6 seems to be coded the same way)
In the documentation it says that strings are passed by memory location. But in FFGL.cpp getParameterDefault and instantiateGL treat them as values.
Here's a fix for FFGL.cpp of Freeframe 1.5:

Code: Select all

@@ -145,11 +145,16 @@ DWORD getParameterDefault(DWORD index)
 		if (dwRet == FF_FAIL) return FF_FAIL;
 	}
 
+	DWORD dwType = s_pPrototype->GetParamType(DWORD(index));
 	void* pValue = s_pPrototype->GetParamDefault(index);
 	if (pValue == NULL) return FF_FAIL;
 	else {
 		DWORD dwRet;
-		memcpy(&dwRet, pValue, 4);
+		if ( dwType == FF_TYPE_TEXT ) {
+			dwRet = (DWORD) pValue;
+		} else {
+			memcpy(&dwRet, pValue, 4);
+		}
 		return dwRet;
 	}
 }
@@ -253,11 +258,15 @@ DWORD instantiateGL(const FFGLViewportStruct *pGLViewport)
 	// Initializing instance with default values
 	for (int i = 0; i < s_pPrototype->GetNumParams(); ++i)
   {
-		//DWORD dwType = s_pPrototype->GetParamType(DWORD(i));
+		DWORD dwType = s_pPrototype->GetParamType(DWORD(i));
 		void* pValue = s_pPrototype->GetParamDefault(DWORD(i));
 		SetParameterStruct ParamStruct;
 		ParamStruct.ParameterNumber = DWORD(i);
-		memcpy(&ParamStruct.NewParameterValue, pValue, 4);
+		if ( dwType == FF_TYPE_TEXT ) {
+			ParamStruct.NewParameterValue = (DWORD) pValue;
+		} else {
+			memcpy(&ParamStruct.NewParameterValue, pValue, 4);
+		}
 		dwRet = pInstance->SetParameter(&ParamStruct);
 		if (dwRet == FF_FAIL)
     {
Realitäten Revue - http://www.r-revue.de

Post Reply