int main( int argc, char** argv ) try { parseArguments( argc, argv ); } catch( const std::exception& ex ) { auto programName = getProgramName( argv[0] ); std::cerr << programName << ": " << ex.what() << "\n"; }
INT32 iPmdDMNChildProc::init( ossSHMKey shmKey ) { INT32 rc = SDB_OK; UINT32 len = 0; #if defined (_WINDOWS) UINT32 keyLen = 0; #endif ossMemset( _execName, 0, sizeof( _execName) ); rc = ossGetEWD( _execName, OSS_MAX_PATHSIZE ); PD_RC_CHECK( rc, PDERROR, "failed to get working directory(rc=%d)", rc ); len = ossStrlen( _execName ); len = len + 1 + ossStrlen( getProgramName() ); #if defined (_WINDOWS) len += ossStrlen(".exe"); keyLen = ossStrlen( shmKey ); SAFE_OSS_FREE( _shmKey ); _shmKey = (CHAR *)SDB_OSS_MALLOC( keyLen + 1 ); if ( _shmKey ) { ossStrcpy( _shmKey, shmKey ); } #elif defined ( _LINUX ) _shmKey = shmKey; #endif PD_CHECK( len <= OSS_MAX_PATHSIZE, SDB_INVALIDARG, error, PDERROR, "length of working directory is longer than expected!" ); ossStrncat( _execName, OSS_FILE_SEP, 1 ); ossStrncat( _execName, getProgramName(), ossStrlen( getProgramName() ) ); #if defined (_WINDOWS) ossStrncat( _execName, ".exe", ossStrlen(".exe") ); #endif done: return rc; error: goto done; }
void NetworkSocket::showInfo() const { qDebug() << "-------------------[ SOCKET ]---------------------"; qDebug() << " Protocol type . . : " << getProtocolType(); qDebug() << " ReceiveQ. . . . . : " << getReceiveQ()<< " bytes"; qDebug() << " SendQ . . . . . . : " << getSendQ() << " bytes"; qDebug() << " Local Address . . : " << getLocalAddress() << " bytes"; qDebug() << " Foreign Address . : " << getForeignAddress(); qDebug() << " State . . . . . . : " << getState(); qDebug() << " PID . . . . . . . : " << getPID(); qDebug() << " Program Name. . . : " << getProgramName(); qDebug() << "--------------------------------------------------"; }
CDInterface() : scd(NULL), cdda(NULL), image(NULL) { // based on the program name, decide what order to return the // track info. programName = getProgramName(); if ( (programName == "epsxe") || (programName == "pcsx") || (programName == "pcsx2") ) tdtnformat = fsmint; else tdtnformat = msfbcd; }
static void findUtf8OrDie(void) { char *old_locale, *localeRes; old_locale = setlocale(LC_ALL, ""); localeRes = strstr(old_locale, "UTF"); if (localeRes == NULL) { utf8Errmsg(getProgramName(), old_locale); exit(1); } else { char *collation = setlocale(LC_COLLATE, ""); setCollation(collation); } }
QString CTrackList::getChannelProgramName(int chan) { if(chan<0 || chan>= static_cast<int>(arraySize(m_midiFirstPatchChannels))) { assert(true); return QString(); } int program = m_midiFirstPatchChannels[chan]; if (chan==10-1) return QObject::tr("Drums"); QString name = getProgramName(program +1); // Skip if (name.isEmpty()) name = QObject::tr("Unknown"); return name; }
void initHeading(void) { char tbuf[MAXSCREENWIDTH]; if (wprgname == NULL ) { wprgname = mbstowcs_alloc(getProgramName() ) ; } if ((labelline==NULL) || (databaseline == NULL )) { strcpy(tbuf,"Label Directory: ") ; /* 17 */ labelline = mbstowcs_alloc(tbuf ) ; strcpy(tbuf,"Database Name: ") ; /* 17 */ databaseline = mbstowcs_alloc(tbuf ) ; } db_dir = wcs_dbdir() ; db_fullname = wcs_dbfullname() ; }
//------------------------------------------------------------------------------------------------------- VstIntPtr AudioEffect::dispatcher (VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt) { VstIntPtr v = 0; switch (opcode) { case effOpen: open (); break; case effClose: close (); break; case effSetProgram: if (value < numPrograms) setProgram ((VstInt32)value); break; case effGetProgram: v = getProgram (); break; case effSetProgramName: setProgramName ((char*)ptr); break; case effGetProgramName: getProgramName ((char*)ptr); break; case effGetParamLabel: getParameterLabel (index, (char*)ptr); break; case effGetParamDisplay: getParameterDisplay (index, (char*)ptr); break; case effGetParamName: getParameterName (index, (char*)ptr); break; case effSetSampleRate: setSampleRate (opt); break; case effSetBlockSize: setBlockSize ((VstInt32)value); break; case effMainsChanged: if (!value) suspend (); else resume (); break; #if !VST_FORCE_DEPRECATED case effGetVu: v = (VstIntPtr)(getVu () * 32767.); break; #endif //---Editor------------ case effEditGetRect: if (editor) v = editor->getRect ((ERect**)ptr) ? 1 : 0; break; case effEditOpen: if (editor) v = editor->open (ptr) ? 1 : 0; break; case effEditClose: if (editor) editor->close (); break; case effEditIdle: if (editor) editor->idle (); break; #if (TARGET_API_MAC_CARBON && !VST_FORCE_DEPRECATED) case effEditDraw: if (editor) editor->draw ((ERect*)ptr); break; case effEditMouse: if (editor) v = editor->mouse (index, value); break; case effEditKey: if (editor) v = editor->key (value); break; case effEditTop: if (editor) editor->top (); break; case effEditSleep: if (editor) editor->sleep (); break; #endif case DECLARE_VST_DEPRECATED (effIdentify): v = CCONST ('N', 'v', 'E', 'f'); break; //---Persistence------- case effGetChunk: v = getChunk ((void**)ptr, index ? true : false); break; case effSetChunk: v = setChunk (ptr, (VstInt32)value, index ? true : false); break; } return v; }
//----------------------------------------------------------------------------- long AudioEffect::dispatcher(long opCode, long index, long value, void *ptr, float opt) { long v = 0; switch(opCode) { case effOpen: open(); break; case effClose: close(); break; case effSetProgram: if(value < numPrograms) setProgram(value); break; case effGetProgram: v = getProgram(); break; case effSetProgramName: setProgramName((char *)ptr); break; case effGetProgramName: getProgramName((char *)ptr); break; case effGetParamLabel: getParameterLabel(index, (char *)ptr); break; case effGetParamDisplay: getParameterDisplay(index, (char *)ptr); break; case effGetParamName: getParameterName(index, (char *)ptr); break; case effSetSampleRate: setSampleRate(opt); break; case effSetBlockSize: setBlockSize(value); break; case effMainsChanged: if(!value) suspend(); else resume(); break; case effGetVu: v = (long)(getVu() * 32767.); break; // editor case effEditGetRect: if(editor) v = editor->getRect((ERect **)ptr); break; case effEditOpen: if(editor) v = editor->open(ptr); break; case effEditClose: if(editor) editor->close(); break; case effEditIdle: if(editor) editor->idle(); break; #if MAC case effEditDraw: if(editor) editor->draw((ERect *)ptr); break; case effEditMouse: if(editor) v = editor->mouse(index, value); break; case effEditKey: if(editor) v = editor->key(value); break; case effEditTop: if(editor) editor->top(); break; case effEditSleep: if(editor) editor->sleep(); break; #endif // new case effIdentify: v = 'NvEf'; break; case effGetChunk: v = getChunk((void**)ptr, index ? true : false); break; case effSetChunk: v = setChunk(ptr, value, index ? true : false); break; } return v; }
int PV_Arguments::printState() const { pvInfo().printf("%s", getProgramName()); if (requireReturnFlag) { pvInfo().printf(" --require-return"); } if (outputPath) { pvInfo().printf(" -o %s", outputPath); } if (paramsFile) { pvInfo().printf(" -p %s", paramsFile); } if (logFile) { pvInfo().printf(" -l %s", logFile); } if (gpuDevices) { pvInfo().printf(" -d %s", gpuDevices); } if (randomSeed) { pvInfo().printf(" -s %u", randomSeed); } if (workingDir) { pvInfo().printf(" -w %s", workingDir); } pvAssert(!(restartFlag && checkpointReadDir)); if (restartFlag) { pvInfo().printf(" -r"); } if (checkpointReadDir) { pvInfo().printf(" -c %s", checkpointReadDir); } if (numThreads>=0) { pvInfo().printf(" -t %d", numThreads); } if (numRows) { pvInfo().printf(" -rows %d", numRows); } if (numColumns) { pvInfo().printf(" -columns %d", numColumns); } if (batchWidth) { pvInfo().printf(" -batchwidth %d", batchWidth); } pvInfo().printf("\n"); return PV_SUCCESS; }
int PV_Arguments::setStateFromCmdLineArgs(bool allowUnrecognizedArguments) { pvAssert(numArgs>0); bool * usedArgArray = (bool *) calloc((size_t) numArgs, sizeof(bool)); if (usedArgArray==NULL) { pvError().printf("PV_Arguments::setStateFromCmdLineArgs unable to allocate memory for usedArgArray: %s\n", strerror(errno)); } usedArgArray[0] = true; // Always use the program name int restart = (int) restartFlag; int dryrun = (int) dryRunFlag; int status = parse_options(numArgs, args, usedArgArray, &requireReturnFlag, &outputPath, ¶msFile, &logFile, &gpuDevices, &randomSeed, &workingDir, &restart, &checkpointReadDir, &useDefaultNumThreads, &numThreads, &numRows, &numColumns, &batchWidth, &dryrun); restartFlag = restart!=0; dryRunFlag = dryrun!=0; // Error out if both -r and -c are used if (restartFlag && checkpointReadDir) { pvError().printf("PV_Arguments: cannot set both the restart flag and the checkpoint read directory.\n"); } if (!allowUnrecognizedArguments) { bool anyUnusedArgs = false; for (int a=0; a<numArgs; a++) { if(!usedArgArray[a]) { pvErrorNoExit().printf("%s: argument %d, \"%s\", is not recognized.\n", getProgramName(), a, args[a]); anyUnusedArgs = true; } } if (anyUnusedArgs) { exit(EXIT_FAILURE); } } free(usedArgArray); return PV_SUCCESS; }
void ModelRenderProcessor::doStep(const StepData& stepData) { auto sGConnector = graphics.lock(); if(!sGConnector) throw WeakPtrException(EXCEPTION_INFO); for(auto& i : idToObject) { View& object = i.second; object.doAnimationStep(stepData.stepMSec); mat4 mvpMatrix = stepData.perspectiveView * object.getTransform(); auto model = loader->getModelBy(object.getPath()); vector<Mesh3d>& meshes = model->getMeshes(); for(auto& s : meshes) { auto material = model->getMaterialBy(s); auto programName = material.getProgramName(); auto programContext = nameToProgramContext.at(programName); std::vector<IGraphicsConnector::ProgramParam> params; IGraphicsConnector::ProgramParam mvp; mvp.id = programContext->getLoc(programContext->getMvpBinding()); mvp.mat4 = std::make_shared<glm::mat4>(mvpMatrix); params.push_back(mvp); auto bonesData = prepareAnimationStep(object, s); string meshName = model->getUniqueMeshName(s); auto& buffer = meshToBuffer.at(meshName); sGConnector->draw(buffer, programContext, params, bonesData); } } StepData step = stepData; step.extraData = &idToObject; __super::doStep(step); }
static void usage () { error ("Usage: %s run1 run2 [qrels]\n", getProgramName()); }
/* This functions looks at the given message and checks if it matches the * provided filter condition. */ static rsRetVal shouldProcessThisMessage(rule_t *pRule, msg_t *pMsg, int *bProcessMsg) { DEFiRet; unsigned short pbMustBeFreed; uchar *pszPropVal; int bRet = 0; size_t propLen; vm_t *pVM = NULL; var_t *pResult = NULL; ISOBJ_TYPE_assert(pRule, rule); assert(pMsg != NULL); /* we first have a look at the global, BSD-style block filters (for tag * and host). Only if they match, we evaluate the actual filter. * rgerhards, 2005-10-18 */ if(pRule->eHostnameCmpMode == HN_NO_COMP) { /* EMPTY BY INTENSION - we check this value first, because * it is the one most often used, so this saves us time! */ } else if(pRule->eHostnameCmpMode == HN_COMP_MATCH) { if(rsCStrSzStrCmp(pRule->pCSHostnameComp, (uchar*) getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) { /* not equal, so we are already done... */ dbgprintf("hostname filter '+%s' does not match '%s'\n", rsCStrGetSzStrNoNULL(pRule->pCSHostnameComp), getHOSTNAME(pMsg)); FINALIZE; } } else { /* must be -hostname */ if(!rsCStrSzStrCmp(pRule->pCSHostnameComp, (uchar*) getHOSTNAME(pMsg), getHOSTNAMELen(pMsg))) { /* not equal, so we are already done... */ dbgprintf("hostname filter '-%s' does not match '%s'\n", rsCStrGetSzStrNoNULL(pRule->pCSHostnameComp), getHOSTNAME(pMsg)); FINALIZE; } } if(pRule->pCSProgNameComp != NULL) { int bInv = 0, bEqv = 0, offset = 0; if(*(rsCStrGetSzStrNoNULL(pRule->pCSProgNameComp)) == '-') { if(*(rsCStrGetSzStrNoNULL(pRule->pCSProgNameComp) + 1) == '-') offset = 1; else { bInv = 1; offset = 1; } } if(!rsCStrOffsetSzStrCmp(pRule->pCSProgNameComp, offset, (uchar*) getProgramName(pMsg, LOCK_MUTEX), getProgramNameLen(pMsg, LOCK_MUTEX))) bEqv = 1; if((!bEqv && !bInv) || (bEqv && bInv)) { /* not equal or inverted selection, so we are already done... */ DBGPRINTF("programname filter '%s' does not match '%s'\n", rsCStrGetSzStrNoNULL(pRule->pCSProgNameComp), getProgramName(pMsg, LOCK_MUTEX)); FINALIZE; } } /* done with the BSD-style block filters */ if(pRule->f_filter_type == FILTER_PRI) { /* skip messages that are incorrect priority */ dbgprintf("testing filter, f_pmask %d\n", pRule->f_filterData.f_pmask[pMsg->iFacility]); if ( (pRule->f_filterData.f_pmask[pMsg->iFacility] == TABLE_NOPRI) || \ ((pRule->f_filterData.f_pmask[pMsg->iFacility] & (1<<pMsg->iSeverity)) == 0) ) bRet = 0; else bRet = 1; } else if(pRule->f_filter_type == FILTER_EXPR) { CHKiRet(vm.Construct(&pVM)); CHKiRet(vm.ConstructFinalize(pVM)); CHKiRet(vm.SetMsg(pVM, pMsg)); CHKiRet(vm.ExecProg(pVM, pRule->f_filterData.f_expr->pVmprg)); CHKiRet(vm.PopBoolFromStack(pVM, &pResult)); dbgprintf("result of expression evaluation: %lld\n", pResult->val.num); /* VM is destructed on function exit */ bRet = (pResult->val.num) ? 1 : 0; } else { assert(pRule->f_filter_type == FILTER_PROP); /* assert() just in case... */ pszPropVal = MsgGetProp(pMsg, NULL, pRule->f_filterData.prop.propID, &propLen, &pbMustBeFreed); /* Now do the compares (short list currently ;)) */ switch(pRule->f_filterData.prop.operation ) { case FIOP_CONTAINS: if(rsCStrLocateInSzStr(pRule->f_filterData.prop.pCSCompValue, (uchar*) pszPropVal) != -1) bRet = 1; break; case FIOP_ISEQUAL: if(rsCStrSzStrCmp(pRule->f_filterData.prop.pCSCompValue, pszPropVal, ustrlen(pszPropVal)) == 0) bRet = 1; /* process message! */ break; case FIOP_STARTSWITH: if(rsCStrSzStrStartsWithCStr(pRule->f_filterData.prop.pCSCompValue, pszPropVal, ustrlen(pszPropVal)) == 0) bRet = 1; /* process message! */ break; case FIOP_REGEX: if(rsCStrSzStrMatchRegex(pRule->f_filterData.prop.pCSCompValue, (unsigned char*) pszPropVal, 0, &pRule->f_filterData.prop.regex_cache) == RS_RET_OK) bRet = 1; break; case FIOP_EREREGEX: if(rsCStrSzStrMatchRegex(pRule->f_filterData.prop.pCSCompValue, (unsigned char*) pszPropVal, 1, &pRule->f_filterData.prop.regex_cache) == RS_RET_OK) bRet = 1; break; default: /* here, it handles NOP (for performance reasons) */ assert(pRule->f_filterData.prop.operation == FIOP_NOP); bRet = 1; /* as good as any other default ;) */ break; } /* now check if the value must be negated */ if(pRule->f_filterData.prop.isNegated) bRet = (bRet == 1) ? 0 : 1; if(Debug) { dbgprintf("Filter: check for property '%s' (value '%s') ", propIDToName(pRule->f_filterData.prop.propID), pszPropVal); if(pRule->f_filterData.prop.isNegated) dbgprintf("NOT "); dbgprintf("%s '%s': %s\n", getFIOPName(pRule->f_filterData.prop.operation), rsCStrGetSzStrNoNULL(pRule->f_filterData.prop.pCSCompValue), bRet ? "TRUE" : "FALSE"); } /* cleanup */ if(pbMustBeFreed) free(pszPropVal); } finalize_it: /* destruct in any case, not just on error, but it makes error handling much easier */ if(pVM != NULL) vm.Destruct(&pVM); if(pResult != NULL) var.Destruct(&pResult); *bProcessMsg = bRet; RETiRet; }
int PolishBam::execute(int argc, char ** argv) { static struct option getopt_long_options[] = { // Input options { "fasta", required_argument, NULL, 'f'}, { "in", required_argument, NULL, 'i'}, { "out", required_argument, NULL, 'o'}, { "verbose", no_argument, NULL, 'v'}, { "log", required_argument, NULL, 'l'}, { "clear", no_argument, NULL, 0}, { "AS", required_argument, NULL, 0}, { "UR", required_argument, NULL, 0}, { "SP", required_argument, NULL, 0}, { "HD", required_argument, NULL, 0}, { "RG", required_argument, NULL, 0}, { "PG", required_argument, NULL, 0}, { "CO", required_argument, NULL, 0}, { "checkSQ", no_argument, NULL, 0}, { "noPhoneHome", no_argument, NULL, 'p'}, { "nophonehome", no_argument, NULL, 'P'}, { "phoneHomeThinning", required_argument, NULL, 't'}, { "phonehomethinning", required_argument, NULL, 'T'}, { NULL, 0, NULL, 0 }, }; // Shift arguments due to format being ./bam polishBam and then the args. ++argv; --argc; int n_option_index = 0, c; std::string sAS, sUR, sSP, sFasta, sInFile, sOutFile, sLogFile; bool bClear, bCheckSQ, bVerbose; std::vector<std::string> vsHDHeaders, vsRGHeaders, vsPGHeaders, vsCOHeaders; bool noPhoneHome = false; bCheckSQ = bVerbose = false; bClear = true; while ( (c = getopt_long(argc, argv, "vf:i:o:l:", getopt_long_options, &n_option_index)) != -1 ) { // std::cout << getopt_long_options[n_option_index].name << "\t" << optarg << std::endl; if ( c == 'f' ) { sFasta = optarg; } else if ( c == 'i' ) { sInFile = optarg; } else if ( c == 'o' ) { sOutFile = optarg; } else if ( c == 'v' ) { bVerbose = true; } else if ( c == 'l' ) { sLogFile = optarg; } else if (( c == 'p' )||( c == 'P' )) { noPhoneHome = true; } else if (( c == 't' )||( c == 'T' )) { PhoneHome::allThinning = atoi(optarg); } else if ( strcmp(getopt_long_options[n_option_index].name,"AS") == 0 ) { sAS = optarg; } else if ( strcmp(getopt_long_options[n_option_index].name,"UR") == 0 ) { sUR = optarg; } else if ( strcmp(getopt_long_options[n_option_index].name,"SP") == 0 ) { sSP = optarg; } else if ( strcmp(getopt_long_options[n_option_index].name,"HD") == 0 ) { vsHDHeaders.push_back(optarg); } else if ( strcmp(getopt_long_options[n_option_index].name,"RG") == 0 ) { vsRGHeaders.push_back(optarg); } else if ( strcmp(getopt_long_options[n_option_index].name,"PG") == 0 ) { vsPGHeaders.push_back(optarg); } else if ( strcmp(getopt_long_options[n_option_index].name,"CO") == 0 ) { vsCOHeaders.push_back(optarg); } else if ( strcmp(getopt_long_options[n_option_index].name,"checkSQ") == 0 ) { bCheckSQ = true; } else { std::cerr << "Error: Unrecognized option " << getopt_long_options[n_option_index].name << std::endl; return(-1); } } if(!noPhoneHome) { PhoneHome::checkVersion(getProgramName(), VERSION); } if ((sLogFile.compare("__NONE__") == 0) || sLogFile.empty()) { if(sOutFile.empty()) { sLogFile = "-"; } else { sLogFile = (sOutFile + ".log"); } } Logger::gLogger = new Logger(sLogFile.c_str(), bVerbose); if ( optind < argc ) { printUsage(std::cerr); Logger::gLogger->error("non-option argument %s exist ",argv[optind]); } if ( sInFile.empty() || sOutFile.empty() ) { printUsage(std::cerr); Logger::gLogger->error("Input and output files are required"); } if ( ( bCheckSQ ) && ( sFasta.empty() ) ) { printUsage(std::cerr); Logger::gLogger->error("--checkSQ option must be used with --fasta option"); } // check whether each header line starts with a correct tag checkHeaderStarts(vsHDHeaders, "@HD\t"); checkHeaderStarts(vsRGHeaders, "@RG\t"); checkHeaderStarts(vsPGHeaders, "@PG\t"); checkOrAddStarts(vsCOHeaders, "@CO\t"); Logger::gLogger->writeLog("Arguments in effect:"); Logger::gLogger->writeLog("\t--in [%s]",sInFile.c_str()); Logger::gLogger->writeLog("\t--out [%s]",sOutFile.c_str()); Logger::gLogger->writeLog("\t--log [%s]",sLogFile.c_str()); Logger::gLogger->writeLog("\t--fasta [%s]",sFasta.c_str()); Logger::gLogger->writeLog("\t--AS [%s]",sAS.c_str()); Logger::gLogger->writeLog("\t--UR [%s]",sUR.c_str()); Logger::gLogger->writeLog("\t--SP [%s]",sSP.c_str()); Logger::gLogger->writeLog("\t--checkSQ [%s]",bClear ? "ON" : "OFF" ); if ( vsHDHeaders.empty() ) { Logger::gLogger->writeLog("\t--HD []"); } else { Logger::gLogger->writeLog("\t--HD [%s]",vsHDHeaders[0].c_str()); } if ( vsRGHeaders.empty() ) { Logger::gLogger->writeLog("\t--RG []"); } else { Logger::gLogger->writeLog("\t--RG [%s]",vsRGHeaders[0].c_str()); } if ( vsPGHeaders.empty() ) { Logger::gLogger->writeLog("\t--PG []"); } else { for(uint32_t i=0; i < vsPGHeaders.size(); ++i) { Logger::gLogger->writeLog("\t--PG [%s]",vsPGHeaders[i].c_str()); } } if ( vsCOHeaders.empty() ) { Logger::gLogger->writeLog("\t--CO []"); } else { for(uint32_t i=0; i < vsCOHeaders.size(); ++i) { Logger::gLogger->writeLog("\t--CO [%s]",vsCOHeaders[i].c_str()); } } if ( (vsHDHeaders.empty() ) && ( vsRGHeaders.empty() ) && ( vsPGHeaders.empty() ) && ( vsCOHeaders.empty() ) && ( !bClear ) && ( sFasta.empty() ) ) { Logger::gLogger->warning("No option is in effect for modifying BAM files. The input and output files will be identical"); } if ( ( vsHDHeaders.size() > 1 ) || ( vsRGHeaders.size() > 1 ) ) { Logger::gLogger->error("HD and RG headers cannot be multiple"); } FastaFile fastaFile; if ( ! sFasta.empty() ) { if ( fastaFile.open(sFasta.c_str()) ) { Logger::gLogger->writeLog("Reading the reference file %s",sFasta.c_str()); fastaFile.readThru(); fastaFile.close(); Logger::gLogger->writeLog("Finished reading the reference file %s",sFasta.c_str()); } else { Logger::gLogger->error("Failed to open reference file %s",sFasta.c_str()); } } SamFile samIn; SamFile samOut; if ( ! samIn.OpenForRead(sInFile.c_str()) ) { Logger::gLogger->error("Cannot open BAM file %s for reading - %s",sInFile.c_str(), SamStatus::getStatusString(samIn.GetStatus()) ); } if ( ! samOut.OpenForWrite(sOutFile.c_str()) ) { Logger::gLogger->error("Cannot open BAM file %s for writing - %s",sOutFile.c_str(), SamStatus::getStatusString(samOut.GetStatus()) ); } SamFileHeader samHeader; SamHeaderRecord* pSamHeaderRecord; samIn.ReadHeader(samHeader); // check the sanity of SQ file // make sure the SN and LN matches, with the same order if ( bCheckSQ ) { unsigned int numSQ = 0; while( (pSamHeaderRecord = samHeader.getNextHeaderRecord()) != NULL ) { if ( pSamHeaderRecord->getType() == SamHeaderRecord::SQ ) { ++numSQ; } } if ( numSQ != fastaFile.vsSequenceNames.size() ) { Logger::gLogger->error("# of @SQ tags are different from the original BAM and the reference file"); } // iterator over all @SQ objects for(unsigned int i=0; i < numSQ; ++i) { pSamHeaderRecord = samHeader.getSQ(fastaFile.vsSequenceNames[i].c_str()); if ( fastaFile.vsSequenceNames[i].compare(pSamHeaderRecord->getTagValue("SN")) != 0 ) { Logger::gLogger->error("SequenceName is not identical between fasta and input BAM file"); } else if ( static_cast<int>(fastaFile.vnSequenceLengths[i]) != atoi(pSamHeaderRecord->getTagValue("LN")) ) { Logger::gLogger->error("SequenceLength is not identical between fasta and input BAM file"); } else { if ( !sAS.empty() ) samHeader.setSQTag("AS",sAS.c_str(),fastaFile.vsSequenceNames[i].c_str()); samHeader.setSQTag("M5",fastaFile.vsMD5sums[i].c_str(),fastaFile.vsSequenceNames[i].c_str()); if ( !sUR.empty() ) samHeader.setSQTag("UR",sUR.c_str(),fastaFile.vsSequenceNames[i].c_str()); if ( !sSP.empty() ) samHeader.setSQTag("SP",sSP.c_str(),fastaFile.vsSequenceNames[i].c_str()); } } Logger::gLogger->writeLog("Finished checking the consistency of SQ tags"); } else { Logger::gLogger->writeLog("Skipped checking the consistency of SQ tags"); } // go over the headers again, // assuming order of HD, SQ, RG, PG, CO, and put proper tags at the end of the original tags Logger::gLogger->writeLog("Creating the header of new output file"); //SamFileHeader outHeader; samHeader.resetHeaderRecordIter(); Logger::gLogger->writeLog("Adding %d HD, %d RG, %d PG, and %d CO headers",vsHDHeaders.size(), vsRGHeaders.size(), vsPGHeaders.size(), vsCOHeaders.size()); int numHdSuccess = 0; for(unsigned int i=0; i < vsHDHeaders.size(); ++i) { if(samHeader.addHeaderLine(vsHDHeaders[i].c_str())) { ++numHdSuccess; } } /* for(int i=0; i < fastaFile.vsSequenceNames.size(); ++i) { std::string s("@SQ\tSN:"); char buf[1024]; s += fastaFile.vsSequenceNames[i]; sprintf(buf,"\tLN:%d",fastaFile.vnSequenceLengths[i]); s += buf; if ( !sAS.empty() ) { sprintf(buf,"\tAS:%s",sAS.c_str()); s += buf; } if ( !sUR.empty() ) { sprintf(buf,"\tUR:%s",sUR.c_str()); s += buf; } sprintf(buf,"\tM5:%s",fastaFile.vsMD5sums[i].c_str()); s += buf; if ( !sSP.empty() ) { sprintf(buf,"\tSP:%s",sSP.c_str()); s += buf; } outHeader.addHeaderLine(s.c_str()); }*/ int numRgSuccess = 0; for(unsigned int i=0; i < vsRGHeaders.size(); ++i) { if(samHeader.addHeaderLine(vsRGHeaders[i].c_str())) { ++numRgSuccess; } } int numPgSuccess = 0; for(unsigned int i=0; i < vsPGHeaders.size(); ++i) { if(samHeader.addHeaderLine(vsPGHeaders[i].c_str())) { ++numPgSuccess; } } int numCoSuccess = 0; for(unsigned int i=0; i < vsCOHeaders.size(); ++i) { if(samHeader.addHeaderLine(vsCOHeaders[i].c_str())) { ++numCoSuccess; } } samOut.WriteHeader(samHeader); Logger::gLogger->writeLog("Successfully added %d HD, %d RG, %d PG, and %d CO headers",numHdSuccess, numRgSuccess, numPgSuccess, numCoSuccess); Logger::gLogger->writeLog("Finished writing output headers"); // parse RG tag and get RG ID to append std::string sRGID; if ( ! vsRGHeaders.empty() ) { std::vector<std::string> tokens; FastaFile::tokenizeString( vsRGHeaders[0].c_str(), tokens ); for(unsigned int i=0; i < tokens.size(); ++i) { if ( tokens[i].find("ID:") == 0 ) { sRGID = tokens[i].substr(3); } } } Logger::gLogger->writeLog("Writing output BAM file"); SamRecord samRecord; while (samIn.ReadRecord(samHeader, samRecord) == true) { if ( !sRGID.empty() ) { if ( samRecord.addTag("RG",'Z',sRGID.c_str()) == false ) { Logger::gLogger->error("Failed to add a RG tag %s",sRGID.c_str()); } // temporary code added if ( strncmp(samRecord.getReadName(),"seqcore_",8) == 0 ) { char buf[1024]; sprintf(buf,"UM%s",samRecord.getReadName()+8); samRecord.setReadName(buf); } } samOut.WriteRecord(samHeader, samRecord); //if ( samIn.GetCurrentRecordCount() == 1000 ) break; } samOut.Close(); Logger::gLogger->writeLog("Successfully written %d records",samIn.GetCurrentRecordCount()); delete Logger::gLogger; return 0; }
char *BPatch_image::programNameInt(char *name, unsigned int len) { return getProgramName(name, len); }
// main function int TrimBam::execute(int argc, char ** argv) { SamFile samIn; SamFile samOut; int numTrimBaseL = 0; int numTrimBaseR = 0; bool noeof = false; bool ignoreStrand = false; bool noPhoneHome = false; std::string inName = ""; std::string outName = ""; if ( argc < 5 ) { usage(); std::cerr << "ERROR: Incorrect number of parameters specified\n"; return(-1); } inName = argv[2]; outName = argv[3]; static struct option getopt_long_options[] = { // Input options { "left", required_argument, NULL, 'L'}, { "right", required_argument, NULL, 'R'}, { "ignoreStrand", no_argument, NULL, 'i'}, { "noeof", no_argument, NULL, 'n'}, { "noPhoneHome", no_argument, NULL, 'p'}, { "nophonehome", no_argument, NULL, 'P'}, { "phoneHomeThinning", required_argument, NULL, 't'}, { "phonehomethinning", required_argument, NULL, 'T'}, { NULL, 0, NULL, 0 }, }; int argIndex = 4; if(argv[argIndex][0] != '-') { // This is the number of bases to trim off both sides // so convert to a number. numTrimBaseL = atoi(argv[argIndex]); numTrimBaseR = numTrimBaseL; ++argIndex; } int c = 0; int n_option_index = 0; // Process any additional parameters while ( ( c = getopt_long(argc, argv, "L:R:in", getopt_long_options, &n_option_index) ) != -1 ) { switch(c) { case 'L': numTrimBaseL = atoi(optarg); break; case 'R': numTrimBaseR = atoi(optarg); break; case 'i': ignoreStrand = true; break; case 'n': noeof = true; break; case 'p': case 'P': noPhoneHome = true; break; case 't': case 'T': PhoneHome::allThinning = atoi(optarg); break; default: fprintf(stderr,"ERROR: Unrecognized option %s\n", getopt_long_options[n_option_index].name); return(-1); } } if(!noPhoneHome) { PhoneHome::checkVersion(getProgramName(), VERSION); } if(noeof) { // Set that the eof block is not required. BgzfFileType::setRequireEofBlock(false); } if ( ! samIn.OpenForRead(inName.c_str()) ) { fprintf(stderr, "***Problem opening %s\n",inName.c_str()); return(-1); } if(!samOut.OpenForWrite(outName.c_str())) { fprintf(stderr, "%s\n", samOut.GetStatusMessage()); return(samOut.GetStatus()); } fprintf(stderr,"Arguments in effect: \n"); fprintf(stderr,"\tInput file : %s\n",inName.c_str()); fprintf(stderr,"\tOutput file : %s\n",outName.c_str()); if(numTrimBaseL == numTrimBaseR) { fprintf(stderr,"\t#Bases to trim from each side : %d\n", numTrimBaseL); } else { fprintf(stderr,"\t#Bases to trim from the left of forward strands : %d\n", numTrimBaseL); fprintf(stderr,"\t#Bases to trim from the right of forward strands: %d\n", numTrimBaseR); if(!ignoreStrand) { // By default, reverse strands are treated the opposite. fprintf(stderr,"\t#Bases to trim from the left of reverse strands : %d\n", numTrimBaseR); fprintf(stderr,"\t#Bases to trim from the right of reverse strands : %d\n", numTrimBaseL); } else { // ignore strand, treating forward & reverse strands the same fprintf(stderr,"\t#Bases to trim from the left of reverse strands : %d\n", numTrimBaseL); fprintf(stderr,"\t#Bases to trim from the right of reverse strands : %d\n", numTrimBaseR); } } // Read the sam header. SamFileHeader samHeader; if(!samIn.ReadHeader(samHeader)) { fprintf(stderr, "%s\n", samIn.GetStatusMessage()); return(samIn.GetStatus()); } // Write the sam header. if(!samOut.WriteHeader(samHeader)) { fprintf(stderr, "%s\n", samOut.GetStatusMessage()); return(samOut.GetStatus()); } SamRecord samRecord; char seq[65536]; char qual[65536]; int i, len; // Keep reading records until ReadRecord returns false. while(samIn.ReadRecord(samHeader, samRecord)) { // Successfully read a record from the file, so write it. strcpy(seq,samRecord.getSequence()); strcpy(qual,samRecord.getQuality()); // Number of bases to trim from the left/right, // set based on ignoreStrand flag and strand info. int trimLeft = numTrimBaseL; int trimRight = numTrimBaseR; if(!ignoreStrand) { if(SamFlag::isReverse(samRecord.getFlag())) { // We are reversing the reverse reads, // so swap the left & right trim counts. trimRight = numTrimBaseL; trimLeft = numTrimBaseR; } } len = strlen(seq); // Do not trim if sequence is '*' if ( strcmp(seq, "*") != 0 ) { bool qualValue = true; if(strcmp(qual, "*") == 0) { qualValue = false; } int qualLen = strlen(qual); if ( (qualLen != len) && qualValue ) { fprintf(stderr,"ERROR: Sequence and Quality have different length\n"); return(-1); } if ( len < (trimLeft + trimRight) ) { // Read Length is less than the total number of bases to trim, // so trim the entire read. for(i=0; i < len; ++i) { seq[i] = 'N'; if ( qualValue ) { qual[i] = '!'; } } } else { // Read Length is larger than the total number of bases to trim, // so trim from the left, then from the right. for(i=0; i < trimLeft; ++i) { // Trim the bases from the left. seq[i] = 'N'; if ( qualValue ) { qual[i] = '!'; } } for(i = 0; i < trimRight; i++) { seq[len-i-1] = 'N'; if(qualValue) { qual[len-i-1] = '!'; } } } samRecord.setSequence(seq); samRecord.setQuality(qual); } if(!samOut.WriteRecord(samHeader, samRecord)) { // Failed to write a record. fprintf(stderr, "Failure in writing record %s\n", samOut.GetStatusMessage()); return(-1); } } if(samIn.GetStatus() != SamStatus::NO_MORE_RECS) { // Failed to read a record. fprintf(stderr, "%s\n", samIn.GetStatusMessage()); } std::cerr << std::endl << "Number of records read = " << samIn.GetCurrentRecordCount() << std::endl; std::cerr << "Number of records written = " << samOut.GetCurrentRecordCount() << std::endl; if(samIn.GetStatus() != SamStatus::NO_MORE_RECS) { // Failed reading a record. return(samIn.GetStatus()); } // Since the reads were successful, return the status based samIn.Close(); samOut.Close(); return 0; }
// main function int MergeBam::execute(int argc, char ** argv) { static struct option getopt_long_options[] = { // Input options { "list", required_argument, NULL, 'l'}, { "in", required_argument, NULL, 'i'}, { "out", required_argument, NULL, 'o'}, { "verbose", no_argument, NULL, 'v'}, { "log", required_argument, NULL, 'L'}, { "ignorePI", no_argument, NULL, 'I'}, { "noPhoneHome", no_argument, NULL, 'p'}, { "nophonehome", no_argument, NULL, 'P'}, { "phoneHomeThinning", required_argument, NULL, 't'}, { "phonehomethinning", required_argument, NULL, 'T'}, { NULL, 0, NULL, 0 }, }; // Adjust the arguments since it is called as ./bam mergeBam instead of // just mergeBam. --argc; ++argv; int n_option_index = 0; char c; bool b_verbose = false; bool ignorePI = false; bool noPhoneHome = false; vector<std::string> vs_in_bam_files; // input BAM files std::string s_list, s_out, s_logger; while ( ( c = getopt_long(argc, argv, "l:i:o:vIL:", getopt_long_options, &n_option_index) ) != -1 ) { switch(c) { case 'i': vs_in_bam_files.push_back(optarg); break; case 'l': s_list = optarg; break; case 'o': s_out = optarg; break; case 'v': b_verbose = true; break; case 'L': s_logger = optarg; break; case 'I': ignorePI = true; break; case 'p': case 'P': noPhoneHome = true; break; case 't': case 'T': PhoneHome::allThinning = atoi(optarg); break; default: fprintf(stderr,"Unrecognized option %s\n",getopt_long_options[n_option_index].name); return(-1); } } if(!noPhoneHome) { PhoneHome::checkVersion(getProgramName(), VERSION); } if ( s_logger.empty() ) { if(s_out.empty()) { s_logger = "-"; } else { s_logger = s_out + ".log"; } } // create a logger object, now possible to write logs/warnings/errors Logger::gLogger = new Logger(s_logger.c_str(), b_verbose); // every argument must correspond to an option if ( optind < argc ) { usage(); Logger::gLogger->error("non-option argument exist"); } // check the required arguments are nonempty if ( (vs_in_bam_files.empty() && s_list.empty()) || s_out.empty() ) { usage(); Logger::gLogger->error("At least one of the required argument is missing"); } if(!vs_in_bam_files.empty() && !s_list.empty()) { Logger::gLogger->error("Cannot specify both --in/-i and --list/-l"); } if(!s_list.empty()) { Logger::gLogger->writeLog("Input list file : %s",s_list.c_str()); } else { std::string bamList = ""; for(unsigned int i = 0; i < vs_in_bam_files.size(); i++) { if(i != 0) { bamList += ", "; } bamList += vs_in_bam_files[i]; } Logger::gLogger->writeLog("Input list file : %s", bamList.c_str()); } Logger::gLogger->writeLog("Output BAM file : %s",s_out.c_str()); Logger::gLogger->writeLog("Output log file : %s",s_logger.c_str()); Logger::gLogger->writeLog("Verbose mode : %s",b_verbose ? "On" : "Off"); vector<ReadGroup> v_readgroups; // readGroups corresponding to BAM file vector<ReadGroup> v_uniq_readgroups; // unique readGroups written to header // If the list file is being used instead of the individual bams, parse it. if(!s_list.empty()) { // parse the list file and fill the vectors above if ( parseListFile(s_list, vs_in_bam_files, v_readgroups, v_uniq_readgroups) == false ) { Logger::gLogger->error("Error in parsing the list file %s",s_list.c_str()); } if ( vs_in_bam_files.size() != v_readgroups.size() ) { Logger::gLogger->error("parseListFile gave different size for vs_in_bam_files, v_readgroups: %d, %d", vs_in_bam_files.size(), v_readgroups.size()); } } // sanity check uint32_t n_bams = vs_in_bam_files.size(); Logger::gLogger->writeLog("Total of %d BAM files are being merged",n_bams); if ( n_bams < 2 ) { Logger::gLogger->error("At least two BAM files must be specified for merging"); } // create SamFile and SamFileHeader object for each BAM file SamFile *p_in_bams = new SamFile[n_bams]; SamFileHeader *p_headers = new SamFileHeader[n_bams]; // read each BAM file and its header, // making sure that the headers are identical std::string firstHeaderNoRGPG = ""; std::string headerNoRGPG = ""; SamFileHeader newHeader; std::string firstHeaderString = ""; for(uint32_t i=0; i < n_bams; ++i) { if ( ! p_in_bams[i].OpenForRead(vs_in_bam_files[i].c_str()) ) { Logger::gLogger->error("Cannot open BAM file %s for reading",vs_in_bam_files[i].c_str()); } p_in_bams[i].setSortedValidation(SamFile::COORDINATE); p_in_bams[i].ReadHeader(p_headers[i]); // Extract the RGs from this header. if(i == 0) { // First header, so store it as the first header newHeader = p_headers[i]; // Determine the header without RG. parseOutRG(p_headers[i], firstHeaderNoRGPG, NULL, ignorePI); } else { parseOutRG(p_headers[i], headerNoRGPG, &newHeader, ignorePI); if(firstHeaderNoRGPG != headerNoRGPG) { Logger::gLogger->error("The headers are not identical at index %d",i); } if(newHeader.getReferenceInfo() != p_headers[i].getReferenceInfo()) { Logger::gLogger->error("The headers are not identical at index %d",i); } } } // first header will be the new header to be written to output // adding all possible readGroups to the new header for(uint32_t i=0; i < v_uniq_readgroups.size(); ++i) { addReadGroupToHeader(newHeader, v_uniq_readgroups[i]); } // Write an output file with new headers SamFile bam_out; if ( !bam_out.OpenForWrite(s_out.c_str()) ) { Logger::gLogger->error("Cannot open BAM file %s for writing",s_out.c_str()); } bam_out.setSortedValidation(SamFile::COORDINATE); bam_out.WriteHeader(newHeader); // create SamRecords and GenomicCoordinates for each input BAM file SamRecord* p_records = new SamRecord[n_bams]; uint64_t* p_gcoordinates = new uint64_t[n_bams]; // read the first record for every input BAM file for(uint32_t i=0; i < n_bams; ++i) { if ( p_in_bams[i].ReadRecord(p_headers[i],p_records[i]) ) { if ( p_records[i].isValid(p_headers[i]) ) { p_gcoordinates[i] = getGenomicCoordinate(p_records[i]); } else { Logger::gLogger->error("Invalid record found at the first line of file %u. Failure code is %d", i, static_cast<int>(p_in_bams[i].GetFailure())); } } else { if ( p_in_bams[i].GetFailure() == SamStatus::NO_MORE_RECS ) { // the BAM file has no record p_gcoordinates[i] = MAX_GENOMIC_COORDINATE; } else { Logger::gLogger->error("Invalid record found at the first line of file %u. Failure code is %d", i, static_cast<int>(p_in_bams[i].GetFailure())); } } } // Routine for writing output BAM file uint32_t nWrittenRecords = 0; // number of written BAM records while(true) { // scan the minimum index of genomic coordinate int min_idx = -1; uint64_t min_gcoordinate = MAX_GENOMIC_COORDINATE; for(uint32_t i=0; i < n_bams; ++i) { if ( min_gcoordinate > p_gcoordinates[i] ) { min_gcoordinate = p_gcoordinates[i]; min_idx = static_cast<int>(i); } } // If every file reached EOF, exit the loop if ( min_idx < 0 ) break; // If adding read groups, add the tag. if(!v_readgroups.empty()) { // add readGroup tag to the record to write and write to output BAM file //Logger::gLogger->writeLog("%d",min_idx); addReadGroupTag(p_records[min_idx], v_readgroups[min_idx]); } bam_out.WriteRecord(newHeader, p_records[min_idx]); ++nWrittenRecords; if ( nWrittenRecords % 1000000 == 0 ) { Logger::gLogger->writeLog("Writing %u records to the output file",nWrittenRecords); } // Read a record from the input BAM file if ( p_in_bams[min_idx].ReadRecord(p_headers[min_idx], p_records[min_idx]) ) { if ( p_records[min_idx].isValid(p_headers[min_idx]) ) { p_gcoordinates[min_idx] = getGenomicCoordinate(p_records[min_idx]); } else { // if invalid record found Logger::gLogger->error("Invalid record found at recordCount %d of file %d. Failure code is %d", p_in_bams[min_idx].GetCurrentRecordCount(), min_idx, static_cast<int>(p_in_bams[min_idx].GetFailure())); } } else { if ( p_in_bams[min_idx].GetFailure() == SamStatus::NO_MORE_RECS ) { p_gcoordinates[min_idx] = MAX_GENOMIC_COORDINATE; // Mark that all record has been read } else { Logger::gLogger->error("Cannot read record at recordCount %d of file %d. Failure code is %d", p_in_bams[min_idx].GetCurrentRecordCount(), min_idx, static_cast<int>(p_in_bams[min_idx].GetFailure())); } } } // close files and free allocated memory Logger::gLogger->writeLog("Finished writing %d records into the output BAM file",bam_out.GetCurrentRecordCount()); bam_out.Close(); for(uint32_t i=0; i < n_bams; ++i) { p_in_bams[i].Close(); } delete[] p_records; delete[] p_in_bams; delete[] p_headers; delete[] p_gcoordinates; delete Logger::gLogger; return 0; }
void usage() { printf("Sleep seconds.\n"); printf("Usage: %s <Seconds>\n", getProgramName(g_argv[0]).c_str()); }
const String DssiPlugin::getCurrentProgramName () { return getProgramName (currentPreset); }
void RemotePluginServer::dispatchControlEvents() { RemotePluginOpcode opcode = RemotePluginNoOpcode; static float *parameterBuffer = 0; tryRead(m_controlRequestFd, &opcode, sizeof(RemotePluginOpcode)); switch (opcode) { case RemotePluginGetVersion: writeFloat(m_controlResponseFd, getVersion()); break; case RemotePluginGetName: writeString(m_controlResponseFd, getName()); break; case RemotePluginGetMaker: writeString(m_controlResponseFd, getMaker()); break; case RemotePluginTerminate: terminate(); break; case RemotePluginGetInputCount: m_numInputs = getInputCount(); writeInt(m_controlResponseFd, m_numInputs); break; case RemotePluginGetOutputCount: m_numOutputs = getOutputCount(); writeInt(m_controlResponseFd, m_numOutputs); break; case RemotePluginGetParameterCount: writeInt(m_controlResponseFd, getParameterCount()); break; case RemotePluginGetParameterName: writeString(m_controlResponseFd, getParameterName(readInt(m_controlRequestFd))); break; case RemotePluginGetParameter: writeFloat(m_controlResponseFd, getParameter(readInt(m_controlRequestFd))); break; case RemotePluginGetParameterDefault: writeFloat(m_controlResponseFd, getParameterDefault(readInt(m_controlRequestFd))); break; case RemotePluginGetParameters: { if (!parameterBuffer) { parameterBuffer = new float[getParameterCount()]; } int p0 = readInt(m_controlRequestFd); int pn = readInt(m_controlRequestFd); getParameters(p0, pn, parameterBuffer); tryWrite(m_controlResponseFd, parameterBuffer, (pn - p0 + 1) * sizeof(float)); break; } case RemotePluginHasMIDIInput: { bool m = hasMIDIInput(); tryWrite(m_controlResponseFd, &m, sizeof(bool)); break; } case RemotePluginGetProgramCount: writeInt(m_controlResponseFd, getProgramCount()); break; case RemotePluginGetProgramName: writeString(m_controlResponseFd, getProgramName(readInt(m_controlRequestFd))); break; case RemotePluginIsReady: { if (!m_shm) sizeShm(); bool b(isReady()); std::cerr << "isReady: returning " << b << std::endl; tryWrite(m_controlResponseFd, &b, sizeof(bool)); } case RemotePluginSetDebugLevel: { RemotePluginDebugLevel newLevel = m_debugLevel; tryRead(m_controlRequestFd, &newLevel, sizeof(RemotePluginDebugLevel)); setDebugLevel(newLevel); m_debugLevel = newLevel; break; } case RemotePluginWarn: { bool b = warn(readString(m_controlRequestFd)); tryWrite(m_controlResponseFd, &b, sizeof(bool)); break; } case RemotePluginShowGUI: { showGUI(readString(m_controlRequestFd)); break; } case RemotePluginHideGUI: { hideGUI(); break; } //Deryabin Andrew: vst chunks support case RemotePluginGetVSTChunk: { std::vector<char> chunk = getVSTChunk(); writeRaw(m_controlResponseFd, chunk); break; } case RemotePluginSetVSTChunk: { std::vector<char> chunk = readRaw(m_controlRequestFd); setVSTChunk(chunk); break; } //Deryabin Andrew: vst chunks support: end code case RemotePluginNoOpcode: break; case RemotePluginReset: reset(); break; default: std::cerr << "WARNING: RemotePluginServer::dispatchControlEvents: unexpected opcode " << opcode << std::endl; } }
const String WrappedJucePlugin::getCurrentProgramName () { return getProgramName (0); }
virtual bool getProgramNameIndexed(long category, long index, char* text) { getProgramName(text); return (index<1); }