Fix Lua Mixer Scripts source naming (#842)

* getSourceString() return a correct string for lcdcolor when the source
es a LUA script

* getSourceString() return a formated string with instanceName or
scriptName and outputName

Co-authored-by: Runsys16 <rene.negre@orange.com>
This commit is contained in:
runsys
2021-10-05 21:30:20 +11:00
committed by GitHub
co-authored by Runsys16
parent adf514fe16
commit f970ab1e66
+17 -2
View File
@@ -443,8 +443,23 @@ char * getSourceString(char * dest, mixsrc_t idx)
div_t qr = div(idx-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
if (qr.quot < MAX_SCRIPTS && qr.rem < scriptInputsOutputs[qr.quot].outputsCount) {
*dest++ = CHAR_LUA;
// *dest++ = '1'+qr.quot;
strcpy(dest, scriptInputsOutputs[qr.quot].outputs[qr.rem].name);
// temporary string
#define MAX_CHAR 16
char temp[MAX_CHAR];
strncpy( temp, g_model.scriptsData[qr.quot].name, MAX_CHAR );
// instance Name is empty : dest = n-ScriptFileName/OutputName
if ( temp[0]== 0) {
snprintf( temp, MAX_CHAR, "%d-%s/%s", qr.quot+1,
g_model.scriptsData[qr.quot].file,
scriptInputsOutputs[qr.quot].outputs[qr.rem].name );
// instance Name is not empty : dest = InstanceName/OutputName
} else {
snprintf( temp, MAX_CHAR, "%s/%s", g_model.scriptsData[qr.quot].name,
scriptInputsOutputs[qr.quot].outputs[qr.rem].name );
}
strcpy( dest, temp);
}
#else
strcpy(dest, "N/A");