static void run (LV2_Handle instance, uint32_t n_samples) { B3O* b3o = (B3O*)instance; const float* const input = b3o->input; float* const output = b3o->output; SETPARAM (fctl_biased, bias); SETPARAM (fctl_biased_fb, feedback); SETPARAM (fctl_sagtoBias, sagtobias); SETPARAM (fctl_biased_fb2, postfeed); SETPARAM (fctl_biased_gfb, globfeed); SETPARAM (fsetInputGain, gainin); SETPARAM (fsetOutputGain, gainout); overdrive (b3o->pa, input, output, n_samples); }
void parseShaderParam(char *buffer, char *rest) { char name[256]; char name2[256]; ShaderParam_t *param; ShaderStage_t *stage = l_SHDData.stage; int bufferpos=0,restpos=0; if (l_SHDData.shader->numTotalParams == VID_MAX_SHADERPARAMS){ bprintf("ERROR shdload: too many shader parameters, maximum is %d\n",VID_MAX_SHADERPARAMS); return; } param = reszalloc(sizeof(ShaderParam_t)); memset(param,0,sizeof(ShaderParam_t)); lxListNode_init(param); param->vector[3] = 1.0f; param->vectorp = param->vector; param->totalid = l_SHDData.shader->numTotalParams; l_SHDData.shader->numTotalParams++; lxStrReadInQuotes(rest, name, 255); while (rest[restpos]!=0 && rest[restpos]!=';') buffer[bufferpos++]=rest[restpos++]; buffer[bufferpos]=0; resnewstrcpy(param->name,name); name[0] = 0; sscanf(buffer,"%s %d %s (%f,%f,%f,%f) %d %d",name2,¶m->id,name,¶m->vector[0],¶m->vector[1],¶m->vector[2],¶m->vector[3],¶m->upvalue,¶m->upvalue2); #define SETPARAM(str,value) \ if (strcmp(name,str)==0) \ param->type = value; SETPARAM("VID_VALUE",SHADER_PARAM_VALUE); SETPARAM("VID_ARRAY",SHADER_PARAM_ARRAY); SETPARAM("VID_CAMPOS",SHADER_PARAM_CAMPOS); SETPARAM("VID_CAMDIR",SHADER_PARAM_CAMDIR); SETPARAM("VID_CAMUP",SHADER_PARAM_CAMUP); SETPARAM("VID_TIME",SHADER_PARAM_TIME); SETPARAM("VID_RANDOM",SHADER_PARAM_RANDOM); SETPARAM("VID_TEXCONST",SHADER_PARAM_TEXCONST); SETPARAM("VID_LIGHTCOLOR",SHADER_PARAM_LIGHTCOLOR); SETPARAM("VID_LIGHTAMBIENT",SHADER_PARAM_LIGHTAMBIENT); SETPARAM("VID_LIGHTPOS",SHADER_PARAM_LIGHTPOS); SETPARAM("VID_LIGHTRANGE",SHADER_PARAM_LIGHTRANGE); SETPARAM("VID_LIGHTDIR",SHADER_PARAM_LIGHTDIR); SETPARAM("VID_TEXSIZEINV",SHADER_PARAM_TEXSIZEINV); SETPARAM("VID_TEXSIZE",SHADER_PARAM_TEXSIZE); SETPARAM("VID_TEXLMSCALE",SHADER_PARAM_TEXLMSCALE); SETPARAM("VID_TEXGEN0",SHADER_PARAM_TEXGEN0); SETPARAM("VID_TEXGEN1",SHADER_PARAM_TEXGEN1); SETPARAM("VID_TEXGEN2",SHADER_PARAM_TEXGEN2); SETPARAM("VID_TEXGEN3",SHADER_PARAM_TEXGEN3); SETPARAM("VID_TEXMAT0",SHADER_PARAM_TEXMAT0); SETPARAM("VID_TEXMAT1",SHADER_PARAM_TEXMAT1); SETPARAM("VID_TEXMAT2",SHADER_PARAM_TEXMAT2); SETPARAM("VID_TEXMAT3",SHADER_PARAM_TEXMAT3); #undef SETPARAM lxListNode_addLast(stage->paramListHead,param); if (param->type == SHADER_PARAM_ARRAY){ param->upvalue = LUX_MAX(param->upvalue,1); if (param->upvalue > 1){ int i; param->vectorp = reszalloc(sizeof(lxVector4)*param->upvalue); for(i=0; i < param->upvalue; i++) memcpy(¶m->vectorp[i*4],param->vector,sizeof(lxVector4)); } else{ param->vectorp = param->vector; } stage->numArrayParams++; } else stage->numVectorParams++; }