static void setProgram(Node *n, GLProgram *p) { n->setShaderProgram(p); auto& children = n->getChildren(); for(const auto &child : children) { setProgram(child, p); } }
bool ContextBase::parseCmdArgs(int argc, char **argv, int skipFirstArgs) { _argc = argc; _argv = argv; _skipFirstArgs = skipFirstArgs; if (_argc < 2) { setShowHelp(true); return false; } setProgram(_programNames[argv[0]]); _argsProcessed.resize(_argc - _skipFirstArgs, false); for (_i=_skipFirstArgs; _i < argc; _i++) { if (isUsed(_i - _skipFirstArgs)) { continue; } if (strcmp(_argv[_i], "-i") == 0) { if (!handle_i()) return false; } else if (strcmp(_argv[_i], "-g") == 0) { if (!handle_g()) return false; } else if ((strcmp(_argv[_i], "-h") == 0) || (strcmp(_argv[_i], "--help") == 0)) { if (!handle_h()) return false; } else if (strcmp(_argv[_i], "-split") == 0) { if (!handle_split()) return false; } else if (strcmp(_argv[_i], "-bed") == 0) { if (!handle_bed()) return false; } else if (strcmp(_argv[_i], "-ubam") == 0) { if (!handle_ubam()) return false; } else if (strcmp(_argv[_i], "-fbam") == 0) { if (!handle_fbam()) return false; } else if(strcmp(_argv[_i], "-sorted") == 0) { if (!handle_sorted()) return false; } else if (strcmp(_argv[_i], "-nobuf") == 0) { if (!handle_nobuf()) return false; } else if (strcmp(_argv[_i], "-header") == 0) { if (!handle_header()) return false; } else if (strcmp(_argv[_i], "-n") == 0) { if (!handle_n()) return false; } else if (strcmp(_argv[_i], "-seed") == 0) { if (!handle_seed()) return false; } } return true; }
KProcess &KProcess::operator<<(const QStringList &args) { Q_D(KProcess); if (d->prog.isEmpty()) setProgram(args); else d->args << args; return *this; }
void IRGenerator::accept(Unit& unit) { FNTRACE(); setProgram(new IRProgram()); for (const auto sym: *unit.scope()) { codegen(sym); } }
//----------------------------------------------------------------------------- MidiCCStepper::MidiCCStepper(audioMasterCallback audioMaster) : PizMidi(audioMaster, kNumPrograms, kNumParams) { programs = new MidiCCStepperProgram[numPrograms]; if (programs) setProgram (0); lastTime = 0 - samplesPerStep; init(); }
//---------------------------------------------------------------------------- //You don't have to do this, but I like to... //---------------------------------------------------------------------------- void AmplitudeImposer::MIDI_ProgramChange(int ch, int val, int delta) { if(val < kNumPrograms) setProgram(val); MIDIEvent[0]->midiData[0] = 0xD0 + ch; MIDIEvent[0]->midiData[1] = val; MIDIEvent[0]->midiData[2] = 0; MIDIEvent[0]->deltaFrames = delta; sendVstEventsToHost(Events); }
NS_CC_BEGIN #if CC_CLIPPING_NODE_OPENGLES static void setProgram(Node *n, GLProgram *p) { n->setGLProgram(p); auto& children = n->getChildren(); for(const auto &child : children) { setProgram(child, p); } }
void pinInt() { unsigned char pinClock = PINB & _BV(DAT); if (pinClock != pinClockLast && pinClock != 0) { readData(); if (msgIdx == 8) { setProgram(); TOC = BRIGHTMAX - 1; clearMsg(); } } pinClockLast = pinClock; }
void ClippingNode::setAlphaThreshold(GLfloat alphaThreshold) { #if CC_CLIPPING_NODE_OPENGLES if (alphaThreshold == 1 && alphaThreshold != _stencilStateManager->getAlphaThreshold()) { // should reset program used by _stencil if (_stencil) setProgram(_stencil, _originStencilProgram); } #endif _stencilStateManager->setAlphaThreshold(alphaThreshold); }
bool ContextBase::testCmdArgs(int argc, char **argv) { _argc = argc; _argv = argv; _skipFirstArgs = 1; _origProgramName = argv[0]; setProgram(_programNames[_origProgramName]); _argsProcessed.resize(_argc - _skipFirstArgs, false); if (!parseCmdArgs(argc, argv, 1) || getShowHelp() || !isValidState()) { return false; } return true; }
mdaLoudness::mdaLoudness(audioMasterCallback audioMaster): AudioEffectX(audioMaster, NPROGS, NPARAMS) { setNumInputs(2); setNumOutputs(2); setUniqueID('mdal'); DECLARE_VST_DEPRECATED(canMono) (); canProcessReplacing(); programs = new mdaLoudnessProgram[NPROGS]; setProgram(0); suspend(); }
//have fun modifying this one! void Midi16CCRouter::processMidiEvents (VstMidiEventVec *inputs, VstMidiEventVec *outputs, VstInt32 sampleFrames) { // process incoming events for (unsigned int i=0;i<inputs[0].size();i++) { //copying event "i" from input (with all its fields) VstMidiEvent tomod = inputs[0][i]; short status = tomod.midiData[0] & 0xf0; // scraping channel short channel = (tomod.midiData[0] & 0x0f) + 1; // isolating channel (1-16) short data1 = tomod.midiData[1] & 0x7f; //short data2 = tomod.midiData[2] & 0x7f; int cci[numCCs]; int cco[numCCs]; bool discard=false; for (int i=0;i<numCCs;i++) { cci[i] = FLOAT_TO_MIDI(param[i*2]); cco[i] = FLOAT_TO_MIDI2(param[i*2+1]); } int chi = FLOAT_TO_CHANNEL016(param[kChi]); int cho = FLOAT_TO_CHANNEL016(param[kCho]); if (cho==0) cho=channel; int chipc = FLOAT_TO_CHANNEL016(param[kPC]); if (param[kPC]==1.0f) chipc=-1; //only look at the selected channel if (channel == chipc || chipc == 0) { if (status == MIDI_PROGRAMCHANGE){ automated=true; setProgram(data1); } } if (channel == chi || chi == 0) { if (status == MIDI_CONTROLCHANGE){ for (int i=0;i<numCCs;i++) { if (data1==cci[i]/* && cco[i]>0*/) { if (cco[i]!=0) tomod.midiData[1] = cco[i]-1; tomod.midiData[0] = status | (cho-1); outputs[0].push_back(tomod); discard=true; } } } } if (!discard) outputs[0].push_back(tomod); } }
bool ContextClosest::parseCmdArgs(int argc, char **argv, int skipFirstArgs){ _argc = argc; _argv = argv; _skipFirstArgs = skipFirstArgs; if (_argc < 2) { setShowHelp(true); return false; } setProgram(_programNames[argv[0]]); _argsProcessed.resize(_argc - _skipFirstArgs, false); for (_i=_skipFirstArgs; _i < argc; _i++) { if (isUsed(_i - _skipFirstArgs)) { continue; } if (strcmp(_argv[_i], "-c") == 0) { //bypass intersect's use of the -c option, because -c //means writeCount for intersect, but means columns for map. if (!ContextBase::handle_c()) return false; } else if (strcmp(_argv[_i], "-d") == 0) { if (!handle_d()) return false; } else if (strcmp(_argv[_i], "-D") == 0) { if (!handle_D()) return false; } else if (strcmp(_argv[_i], "-io") == 0) { if (!handle_io()) return false; } else if (strcmp(_argv[_i], "-iu") == 0) { if (!handle_iu()) return false; } else if (strcmp(_argv[_i], "-id") == 0) { if (!handle_id()) return false; } else if (strcmp(_argv[_i], "-N") == 0) { if (!handle_N()) return false; } else if (strcmp(_argv[_i], "-t") == 0) { if (!handle_t()) return false; } else if (strcmp(_argv[_i], "-mdb") == 0) { if (!handle_mdb()) return false; } } return ContextIntersect::parseCmdArgs(argc, argv, _skipFirstArgs); }
void Bank::newBank( const string& path, const string& name, bool doSave ) { close( doSave ); path_ = path; name_ = name; programNum_ = -1; Program* program = generateDefaultProgram( 0 ); insert( end(), program ); setProgram( 0, false ); if( doSave ) save( path_, false ); }
void Bank::generateDefaultBank() { resize( NUMPROGRAMS ); for( INT32 i=0; i<NUMPROGRAMS; i++ ) { Program* program = generateDefaultProgram( i ); insertProgram( i, program ); } programNum_ = -1; name_ = "Default Bank"; path_ = ""; setProgram( 0, false ); }
void JenSx1000AudioProcessor::setStateInformation (const void* data, int sizeInBytes) { // You should use this method to restore your parameters from this memory block, // whose contents will have been created by the getStateInformation() call. Program* newProgram = new Program("New Program"); ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes)); newProgram -> setProgramFromXml(xmlState); setProgram(newProgram); }
bool ContextBase::testCmdArgs(int argc, char **argv) { _argc = argc; _argv = argv; _skipFirstArgs = 1; setProgram(_programNames[argv[0]]); _argsProcessed.resize(_argc - _skipFirstArgs, false); if (!parseCmdArgs(argc, argv, 1) || getShowHelp() || !isValidState()) { if (!_errorMsg.empty()) { cerr <<_errorMsg << endl; } return false; } return true; }
/** * Executes the back-end process. * @param sName The name of the process (for error messages) * @param slArgs A list containing the command-line arguments * @param sWorkDir (Optional) working directory * @param bBlock (Optional) true to block, false otherwise * @return true if the process was executed successfully, false otherwise */ bool Frontend::run(const QString& sName, const QStringList& slArgs, const QString& incDirs, const QString& srcDirs, const QString& sWorkDir, bool bBlock) { // Cannot start if another controlled process is currently running if (QProcess::state() == QProcess::Running) { m_sError = i18n("Cannot restart while another process is still " "running"); return false; } // Reset variables m_nRecords = 0; m_bKilled = false; // Setup the command-line arguments clearProgram(); if (m_bUseShell) // Execute inside a shell; join all arguments in a single QString setShellCommand(slArgs.join(" ")); else // Or setup args directly setProgram(slArgs); // Set the working directory, if requested if (!sWorkDir.isEmpty()) setWorkingDirectory(sWorkDir); // Set environment variables (INCLUDEDIRS & SOURCEDIRS) if required if (! incDirs.isEmpty()) { setEnv("INCLUDEDIRS", incDirs); } if (! srcDirs.isEmpty()) { setEnv("SOURCEDIRS", srcDirs); } // Execute the child process setOutputChannelMode( KProcess::SeparateChannels ); start(); if (! ( bBlock ? waitForFinished( -1 ) : waitForStarted ( -1 ))) { m_sError = sName + i18n(": Failed to start process"); return false; } m_sError = i18n("No error"); return true; }
bool KJavaProcess::invokeJVM() { QStringList args; if( !d->classPath.isEmpty() ) { args << "-classpath"; args << d->classPath; } //set the system properties, iterate through the qmap of system properties QMap<QString,QString>::ConstIterator it = d->systemProps.constBegin(); const QMap<QString,QString>::ConstIterator itEnd = d->systemProps.constEnd(); for( ; it != itEnd; ++it ) { if( !it.key().isEmpty() ) { QString currarg = "-D" + it.key(); if( !it.value().isEmpty() ) currarg += '=' + it.value(); args << currarg; } } //load the extra user-defined arguments if( !d->extraArgs.isEmpty() ) { KShell::Errors err; args += KShell::splitArgs( d->extraArgs, KShell::AbortOnMeta, &err ); if( err != KShell::NoError ) kWarning(6100) << "Extra args for JVM cannot be parsed, arguments = " << d->extraArgs; } args << d->mainClass; if ( !d->classArgs.isNull() ) args << d->classArgs; kDebug(6100) << "Invoking JVM" << d->jvmPath << "now...with arguments = " << KShell::joinArgs(args); setOutputChannelMode(KProcess::SeparateChannels); setProgram( d->jvmPath, args ); start(); return waitForStarted(); }
//----------------------------------------------------------------------------- MidiScaleChanger::MidiScaleChanger(audioMasterCallback audioMaster) : PizMidi(audioMaster, kNumPrograms, kNumParams), programs(0) { programs = new MidiScaleChangerProgram[numPrograms]; if (programs) { CFxBank* defaultBank = new CFxBank(numPrograms,numParams); if (readDefaultBank(PLUG_NAME,defaultBank)) { if((VstInt32)defaultBank->GetFxID()==PLUG_IDENT) { for(int i=0;i<numPrograms;i++){ n0 = defaultBank->GetProgParm(i,k0); n1 = defaultBank->GetProgParm(i,k1); n2 = defaultBank->GetProgParm(i,k2); n3 = defaultBank->GetProgParm(i,k3); n4 = defaultBank->GetProgParm(i,k4); n5 = defaultBank->GetProgParm(i,k5); n6 = defaultBank->GetProgParm(i,k6); n7 = defaultBank->GetProgParm(i,k7); n8 = defaultBank->GetProgParm(i,k8); n9 = defaultBank->GetProgParm(i,k9); n10 = defaultBank->GetProgParm(i,k10); n11 = defaultBank->GetProgParm(i,k11); fRoot = defaultBank->GetProgParm(i,kRoot); fWrap = defaultBank->GetProgParm(i,kWrap); fChannel = defaultBank->GetProgParm(i,kChannel); fAltChannel = defaultBank->GetProgParm(i,kAltChannel); strcpy(programs[i].name,defaultBank->GetProgramName(i)); } } } else { for(int i=0;i<numPrograms;i++){ sprintf(programs[i].name,"Program %d",i+1); } } setProgram (0); } for (int n=0;n<128;n++) { for (int c=0;c<16;c++) { transposed[n][c]=n; noteOnChannel[n][c]=c; } } settingprog=false; init(); }
//----------------------------------------------------------------------------- ForceToRange::ForceToRange (audioMasterCallback audioMaster) : PizMidi (audioMaster, kNumPrograms, kNumParams), programs(0) { settingProgram=false; programs = new ForceToRangeProgram[numPrograms]; if (programs) { CFxBank* defaultBank = new CFxBank(kNumPrograms,kNumParams); if (readDefaultBank(PLUG_NAME,defaultBank)) { if((VstInt32)defaultBank->GetFxID()==PLUG_IDENT) { for(int i=0;i<kNumPrograms;i++){ for (int p=0;p<kNumParams;p++) { programs[i].param[p] = defaultBank->GetProgParm(i,p); } strcpy(programs[i].name,defaultBank->GetProgramName(i)); } } } else { // built-in programs for(int i=0;i<kNumPrograms;i++){ switch(i) { case 0: programs[i].param[kLowNote] = MIDI_TO_FLOAT(48); programs[i].param[kHighNote] = MIDI_TO_FLOAT(60); sprintf(programs[i].name,"Octave 2"); break; case 1: programs[i].param[kLowNote] = MIDI_TO_FLOAT(60); programs[i].param[kHighNote] = MIDI_TO_FLOAT(72); sprintf(programs[i].name,"Octave 3"); break; //etc default: sprintf(programs[i].name,"Program %d",i+1); break; } } } setProgram (0); } for (int n=0;n<128;n++) { for (int c=0;c<16;c++) transposed[n][c]=n; } init(); }
//----------------------------------------------------------------------------------------- tf3Synth::tf3Synth (audioMasterCallback audioMaster, void* hInstance) : AudioEffectX (audioMaster, kNumPrograms, TF_PARAM_COUNT) { // Initialize module path eChar mpath[512]; eMemSet(mpath, 0, 512); GetModuleFileName((HMODULE)hInstance, mpath, 512); eChar *str = &mpath[511]; while (str != mpath && *str!='/' && *str!='\\') { *str-- = '\0'; } modulePath = QString(mpath); // Initialize tunefish tf = new tfInstrument(); // initialize programs for (long i = 0; i < kNumPrograms; i++) programs[i].loadDefault(i); loadProgramAll(); for (long i = 0; i < 16; i++) channelPrograms[i] = i; if (programs) setProgram (0); editor = new tfEditor(this); if (audioMaster) { setNumInputs (0); // no inputs setNumOutputs (kNumOutputs); // 2 outputs, 1 for each oscillator canProcessReplacing (); hasVu (false); hasClip (false); isSynth (); setUniqueID ('TF3'); // <<<! *must* change this!!!! } initProcess (); suspend (); }
void MidiProgramInBlock::checkIfEventFits(MidiEvent event) { setLearning(false); // chek if this event was a control change event: if (event.type != MidiConstants::PROGRAM_CHANGE) { m_controller->guiManager()->showToast("This was not a Program Change event."); return; } // set attributes to match the event: setUseDefaultChannel(false); setChannel(event.channel); setProgram(event.target + 1); // update output: m_outputNode->setValue(1.0); emit validMessageReceived(); m_programIsActive = true; emit programIsActiveChanged(); }
//------------------------------------------------------------------------------------------------------- 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; }
//----------------------------------------------------------------------------- MidiGain::MidiGain (audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParams), programs(0) { setNumInputs(2); setNumOutputs(2); isSynth(); setUniqueID(PLUG_IDENT); canProcessReplacing(); programs = new MidiGainProgram[numPrograms]; if (programs) setProgram (0); init(); }
//----------------------------------------------------------------------------- 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; }
/** * @fn QueuedProcess */ QueuedProcess::QueuedProcess(QObject *_parent, const QueuedProcessDefinitions &definitions, const long long index) : QProcess(_parent) , m_definitions(definitions) , m_index(index) { qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; qRegisterMetaType<QueuedLimits::Limits>("QueuedLimits::Limits"); m_cgroup = new QueuedControlGroupsAdaptor(this, name()); // update QProcess related values as well setProgram(m_definitions.command); setArguments(m_definitions.arguments); setWorkDirectory(m_definitions.workingDirectory); connect(this, SIGNAL(started()), this, SLOT(applyCGroup())); }
mdaSplitter::mdaSplitter(audioMasterCallback audioMaster): AudioEffectX(audioMaster, NPROGS, NPARAMS) { setNumInputs(2); setNumOutputs(2); setUniqueID('mda7'); ///identify plug-in here DECLARE_VST_DEPRECATED(canMono) (); canProcessReplacing(); env = buf0 = buf1 = buf2 = buf3 = 0.0f; ///differences from default program... programs[1].param[2] = 0.50f; programs[1].param[4] = 0.25f; strcpy(programs[1].name,"Pass Peaks Only"); programs[2].param[0] = 0.60f; strcpy(programs[2].name,"Stereo Crossover"); setProgram(0); }
//----------------------------------------------------------------------------- MidiSostenuto::MidiSostenuto(audioMasterCallback audioMaster) : PizMidi(audioMaster, kNumPrograms, kNumParams), programs(0) { programs = new MidiSostenutoProgram[numPrograms]; if (programs) { CFxBank* defaultBank = new CFxBank(kNumPrograms,kNumParams); if (readDefaultBank(PLUG_NAME,defaultBank)) { if((VstInt32)defaultBank->GetFxID()==PLUG_IDENT) { for(int i=0; i<kNumPrograms; i++) { programs[i].fParam01 = defaultBank->GetProgParm(i,0); programs[i].fParam02 = defaultBank->GetProgParm(i,1); programs[i].fParam03 = defaultBank->GetProgParm(i,2); programs[i].fParam04 = defaultBank->GetProgParm(i,3); programs[i].fParam05 = defaultBank->GetProgParm(i,4); strcpy(programs[i].name,defaultBank->GetProgramName(i)); } } } else { // built-in programs for(int i=0; i<kNumPrograms; i++) { sprintf(programs[i].name,"Program %d", i+1); } setProgram (0); } } sostenuto = 0; discard = 0; for (int i=0; i<128; i++) { held_notes[i]=0; sustained_notes[i]=0; noteon_queue[i]=0; noteon_queue_velocity[i]=0; } CCvalue_current = 0; CCvalue_prev = 0; init(); }
//----------------------------------------------------------------------------- ADelay::ADelay (audioMasterCallback audioMaster) : AudioEffectX (audioMaster, kNumPrograms, kNumParams) { // init all parameter values size = 44100; cursor = 0; delay = 0; buffer = new float[size]; programs = new ADelayProgram[numPrograms]; fDelay = fFeedBack = fOut = fTest = 0; if (programs) setProgram (0); setNumInputs (1); // mono input setNumOutputs (2); // stereo output setUniqueID ('ADly'); resume (); // flush buffer }