/* EXPORT->LOpen: Load transcription in fname and return it */ Transcription *LOpen(MemHeap *x, char * fname, FileFormat fmt) { FILE *f; Source source; char buf[MAXSTRLEN]; Transcription *t; Boolean isMLF; int i; if (fmt == UNDEFF){ if (GetConfStr(cParm,numParm,"SOURCELABEL",buf)) fmt = Str2Format(buf); else fmt = HTK; } if ((f=OpenLabFile(fname, &isMLF)) == NULL) HError(6510,"LOpen: Unable to open label file %s",fname); AttachSource(f,&source); strcpy(source.name,fname); t = CreateTranscription(x); switch (fmt) { case TIMIT: LoadTIMITLabels(x,t,&source); break; case HTK: LoadHTKLabels(x,t,&source); break; case SCRIBE: LoadSCRIBELabels(x,t,&source); break; case ESPS: LoadESPSLabels(x,t,&source); break; default: HError(6572,"LOpen: Illegal label file format [%d]",fmt); } if (!isMLF) i=fclose(f); if (transLev > 0) FilterLevel(t,transLev-1); return t; }
// Initialise grammar from given file void AGram::InitFromFile(const char * gramFN) { FILE *nf; char gFN[512]; Source src; GramSubN *sub; Boolean ok; if (trace&T_LOAD) printf("Loading HTK SLF %s\n",gramFN); // Open the grammar file and attach to a source strcpy(gFN,gramFN); ok = ( (nf = fopen(gFN,"r")) != NULL)?TRUE:FALSE; if (!ok){ if (gFN[0]=='/') { gFN[0] = gFN[1]; gFN[1]=':'; ok = ((nf = fopen(gFN,"r")) != NULL)?TRUE:FALSE; } } if (!ok){ HRError(10710,"AGram: Cannot open Word Net file %s",gramFN); throw ATK_Error(10710); } AttachSource(nf,&src); // read the network defs sub = NewSubN(&src); if (sub==NULL){ HRError(10710,"AGram: Nothing in file %s",gramFN); throw ATK_Error(10710); } while (sub !=NULL && sub->name != "!!MAIN!!") { sub = NewSubN(&src); } main = sub; if (sub != NULL) main->name = rname+":main"; // close source file fclose(nf); if (trace&T_SHOW) Show(); }
void COpenGLShaderProgram::CreateStandShader(E_STAND_SHADER standShader) { switch (standShader) { case mx::render::ESS_SHADER_IDENTITY: AttachSource(szIdentityShaderVP, ST_VERTEX); AttachSource(szIdentityShaderFP, ST_FRAGMENT); BindAttributeLocation(1, VAL_POSITION); break; case mx::render::ESS_SHADER_FLAT: AttachSource(szFlatShaderVP, ST_VERTEX); AttachSource(szFlatShaderFP, ST_FRAGMENT); BindAttributeLocation(1, VAL_POSITION); break; case mx::render::ESS_SHADER_SHADED: AttachSource(szShadedVP, ST_VERTEX); AttachSource(szShadedFP, ST_FRAGMENT); BindAttributeLocation(2, VAL_POSITION, VAL_COLOR); break; case mx::render::ESS_SHADER_DEFAULT_LIGHT: AttachSource(szDefaultLightVP, ST_VERTEX); AttachSource(szDefaultLightFP, ST_FRAGMENT); BindAttributeLocation(2, VAL_POSITION, VAL_NORMAL); break; case mx::render::ESS_SHADER_POINT_LIGHT_DIFF: AttachSource(szPointLightDiffVP, ST_VERTEX); AttachSource(szPointLightDiffFP, ST_FRAGMENT); BindAttributeLocation(2, VAL_POSITION, VAL_NORMAL); break; case mx::render::ESS_SHADER_TEXTURE_REPLACE: AttachSource(szTextureReplaceVP, ST_VERTEX); AttachSource(szTextureReplaceFP, ST_FRAGMENT); BindAttributeLocation(2, VAL_POSITION, VAL_TEXTURE0); break; case mx::render::ESS_SHADER_TEXTURE_MODULATE: AttachSource(szTextureModulateVP, ST_VERTEX); AttachSource(szTextureModulateFP, ST_FRAGMENT); BindAttributeLocation(2, VAL_POSITION, VAL_TEXTURE0); break; case mx::render::ESS_SHADER_TEXTURE_POINT_LIGHT_DIFF: AttachSource(szTexturePointLightDiffVP, ST_VERTEX); AttachSource(szTexturePointLightDiffFP, ST_FRAGMENT); BindAttributeLocation(3, VAL_POSITION, VAL_NORMAL, VAL_TEXTURE0); break; case mx::render::ESS_SHADER_TEXTURE_RECT_REPLACE: AttachSource(szTextureRectReplaceVP, ST_VERTEX); AttachSource(szTextureRectReplaceFP, ST_FRAGMENT); BindAttributeLocation(2, VAL_POSITION, VAL_TEXTURE0); break; default: break; } Link(); }
CDisplaySpectrumSource::CDisplaySpectrumSource(CSignal* in_pSignal) { AttachSource(in_pSignal); InitSource(); }