int main(int argc, char **argv) { int status,c; head = 0;/*the default heading lines is 0.*/ char line[1024];/*assign the line string.*/ status = 0; progname = argv[0]; extern int process(char *line, char *addr, int head); extern void process1(char *line, FILE *fp, int head); while ((c = getopt(argc, argv, "h:")) != EOF) { switch (c) { case 'h': head = atoi(optarg); break; case '?': default: status = 1; break; } } if (status){ fprintf(stderr, "usage: table [-h] num [file ...]\n"); return(status); } //if there is argument, program takes text line from standard input and never end. if (argc == 1){ process1(line, stdin, head); return (status); } //there is -h argument but no input file. if (optind >= argc){ process1(line, stdin, head); return (status); }else{ for (; optind < argc; optind++){ head = process(line, argv[optind], head); } } return(status); }
int main() { const char buf[] = "i am children 2"; nokia::AffinityProcess process1(Process1); nokia::AffinityProcess process2(Process2, static_cast<void*>(const_cast<char*>(buf))); nokia::AffinityProcess process3(Process2, static_cast<void*>(const_cast<char*>("22"))); nokia::AffinityProcess process4(Process2, static_cast<void*>(const_cast<char*>("33"))); nokia::AffinityProcess process5(Process2, static_cast<void*>(const_cast<char*>("44"))); nokia::AffinityProcess process6(Process2, static_cast<void*>(const_cast<char*>("55"))); nokia::AffinityProcess process7(Process2, static_cast<void*>(const_cast<char*>("66"))); nokia::AffinityProcess process8(Process2, static_cast<void*>(const_cast<char*>("77"))); nokia::AffinityProcess process9(Process2, static_cast<void*>(const_cast<char*>("88"))); nokia::AffinityProcess process10(Process2, static_cast<void*>(const_cast<char*>("99"))); process1.Wait(); process2.Wait(); process3.Wait(); process4.Wait(); process5.Wait(); process6.Wait(); process7.Wait(); process8.Wait(); process9.Wait(); process10.Wait(); return 0; }
void ViBenchMarker3::nextFile() { if(mFiles.isEmpty()) { quit(); } else { initParams(); for(int i = 0; i < mParamsStart.size(); ++i) mParamsCurrent[i] = mParamsStart[i]; mCurrentFile = mFiles.dequeue(); mBestMatthews = 0; printFileHeader(); mCurrentObject->clearBuffers(); mCurrentObject.setNull(); mCurrentObject = ViAudioObject::create(); mCurrentObject->setFilePath(ViAudio::Target, mCurrentFile); QObject::connect(mCurrentObject.data(), SIGNAL(decoded()), this, SLOT(process1())); mCurrentObject->decode(); } }
void VstXSynth::processReplacing(float **inputs, float **outputs, long sampleFrames) { float *out1 = outputs[0]; float *out2 = outputs[1]; float *in1 = inputs[0]; float *in2 = inputs[1]; short mask = createmask(SAVE); bool or = SAVE[kOr]>0.5f; bool and = SAVE[kAnd]>0.5f; bool sig = SAVE[kSig]>0.5f; for(long i=0;i<sampleFrames;i++) { out1[i] = process1(in1[i],mask,or,and,sig); out2[i] = process1(in2[i],mask,or,and,sig); } }
void process3( array * base ) { fullSortTableType arrays; query( arrays, base->t, base->t, base->v, base->v, 0, -1 ); fullSortTableType::iterator it; for ( it = arrays.begin(); it != arrays.end(); it++ ) { process1( *it, base, &arrays ); } }
int main() { int n,sum1,sum2; for(n = 1;n<20000;n++) { sum1 = process1(n); sum2 = process2(n); if(sum1 != sum2) printf("%d %d %d\n",n,sum1,sum2); } return 0; }
void process( array * base ) { if ( base->k > MAXK ) return; process1( base ); if ( base->t < MAXT ) { process2( base ); } process3( base ); }
void ViBenchMarker3::process1(bool generate) { QObject::disconnect(mCurrentObject.data(), SIGNAL(decoded()), this, SLOT(process1())); if(generate) { ViNoiseCreator creator; creator.createNoise(mCurrentObject->buffer(ViAudio::Target), mCurrentObject->buffer(ViAudio::Corrupted), mCurrentObject->buffer(ViAudio::CustomMask), mCurrentObject->buffer(ViAudio::Custom)); } mCurrentObject->clearBuffer(ViAudio::Target); mCurrentObject->clearBuffer(ViAudio::Noise); mCurrentObject->clearBuffer(ViAudio::NoiseMask); /*if(mParamsStart.size() == 1) mDetector->setParameters(mParamsCurrent[0]); else if(mParamsStart.size() == 2) mDetector->setParameters(mParamsCurrent[0], mParamsCurrent[1]); else if(mParamsStart.size() == 3) mDetector->setParameters(mParamsCurrent[0], mParamsCurrent[1], mParamsCurrent[2]); else if(mParamsStart.size() == 4) mDetector->setParameters(mParamsCurrent[0], mParamsCurrent[1], mParamsCurrent[2], mParamsCurrent[3]); //else { cout << "Invalid parameter count of "<<mParamsStart.size()<<". Min: 1, Max: 4" << endl; quit(); }*/ QObject::connect(mCurrentObject.data(), SIGNAL(noiseGenerated()), this, SLOT(process2())); mTime.restart(); mCurrentObject->generateNoiseMask(mDetector); }
//This method creates process to run process1 by forking the current process. void createProcess1(){ //Instantiating a variable to check pid. pid_t childPID; //Creates a child process by forking. The child process will replace \n with ' ' switch(childPID = fork()){ //Checks if forks successfully case -1: perror("fork failed"); exit(EXIT_FAILURE); //The child process closes the appropriate pipes and calls process1 case 0: close(pipe1[1]); close(pipe2[0]); close(pipe3[0]); close(pipe3[1]); process1(pipe1[0],pipe2[1]); break; //The parent process continues to fork more child processes by calling a //process that creates process 2. Then it waits for child process before completing. default: createProcess2(); wait(); } };
/** Variable containing the path to XML file is passed to the function. In this function the XML file is parsed, states and * transitions are added while creating separate copies for send phase and receive phase */ void generate_automata(const char* path) { cout << "; loading xml file" << endl; string bad_role = "RECEIVER"; xml_document xml; xml_parse_result xml_result = xml.load_file(path); if(!strcmp(xml_result.description(),"File was not found")) { cout << "Xml File not found!" << endl << "Exiting" << endl; exit(0); } xml_node temp = xml.first_child(); typedef ListDigraph::Node state; typedef ListDigraph::Arc transition; for(xml_node tem1 = temp.child("messages").child("message");tem1;tem1 = tem1.next_sibling()) Aut_messages.push_back(tem1.child_value()); for(temp = temp.child("role");temp;temp = temp.next_sibling("role")) { ///Adding states to the Graph string role = temp.attribute("name").value(); cout<<endl<<"; adding states for process "<<role; Process_roles.push_back(role); Process_pointer process(new Graph); Process_pointer process1(new Graph); std:shared_ptr<Node_namess> state_name = std::make_shared<Node_namess>(*process); shared_ptr<Node_namess> state_name1 = std::make_shared<Node_namess>(*process1); Avalues_pointer transition_message = std::make_shared<Arc_valuess>(*process); Avalues_pointer transition_symbol = std::make_shared<Arc_valuess>(*process); Avalues_pointer transition_message1 = std::make_shared<Arc_valuess>(*process1); Avalues_pointer transition_symbol1 = std::make_shared<Arc_valuess>(*process1); Cvalue_pointer Pchannel = std::make_shared<Channel_valuess>(*process); Cvalue_pointer Pchannel1 = std::make_shared<Channel_valuess>(*process1); state initial_state,initial_state1,vertex,vertex1,vertex2,vertex3,from_vertex,to_vertex,from_vertex1,to_vertex1; transition edge,edge1; vector<state> final_state,final_state1; vertex2 = process->addNode(); string fstate; fstate = role+"_FINAL_STATE_S"; (*state_name)[vertex2] = fstate; string fstate1; fstate1 = role+"_FINAL_STATE_R"; vertex3 = process1->addNode(); (*state_name1)[vertex3] = fstate1; for(xml_node temp1 = temp.child("states").child("state");temp1;temp1 = temp1.next_sibling()) { string state,state1; state = state1 = temp1.child_value(); state = role + "_" + state + "_S"; state1 = role + "_" + state1 + "_R"; vertex = process->addNode(); vertex1 = process1->addNode(); (*state_name)[vertex] = state; (*state_name1)[vertex1] = state1; if(temp1.attribute("type") && (!strcmp(temp1.attribute("type").value(),"initial"))) { initial_state = vertex; initial_state1 = vertex1; } if(temp1.attribute("type") && (!strcmp(temp1.attribute("type").value(),"final"))) ListDigraph::Arc f_edge; } ///Adding transitions to the Graph cout<<endl<<"; adding transitions for process "<<role; for(xml_node temp2 = temp.child("rule"); temp2 ; temp2 = temp2.next_sibling()) { string from_state, to_state,from_state1,to_state1, send_symbol, receive_symbol,channel1,channel2; from_state = temp2.child("pre").child("current_state").child_value(); from_state1 = from_state; from_state = role+"_"+from_state+"_S"; from_state1 = role+"_"+from_state1+"_R"; to_state = temp2.child("post").child("next_state").child_value(); to_state1 = to_state; to_state = role+"_"+to_state+"_S"; to_state1 = role+"_"+to_state1+"_R"; for(ListDigraph::NodeIt n(*process); n != INVALID; ++n) { if((*state_name)[n] == (from_state)) from_vertex = n; if((*state_name)[n] == (to_state)) to_vertex = n; } for(ListDigraph::NodeIt n(*process1); n != INVALID; ++n) { if((*state_name1)[n] == (from_state1)) from_vertex1 = n; if((*state_name1)[n] == (to_state1)) to_vertex1 = n; } if(temp2.child("pre").child("channel")) channel1 = temp2.child("pre").child("channel").child_value(); else channel1 = ""; if(temp2.child("post").child("channel")) channel2 = temp2.child("post").child("channel").child_value(); else channel2 = ""; if(temp2.child("pre").child("received_message")) { receive_symbol = temp2.child("pre").child("received_message").child_value(); Channels[channel1].insert(receive_symbol); } else receive_symbol = ""; if(temp2.child("post").child("send_message")) { send_symbol = temp2.child("post").child("send_message").child_value(); Channels[channel2].insert(send_symbol); } else send_symbol = ""; if(send_symbol == "" && (receive_symbol == "" || receive_symbol == "eps")) { edge = process->addArc(from_vertex,to_vertex); edge1 = process1->addArc(from_vertex1,to_vertex1); (*transition_symbol)[edge] = "eps"; (*transition_message)[edge] = "eps"; (*transition_symbol1)[edge1] = "eps"; (*transition_message1)[edge1] = "eps"; } else if(receive_symbol == "") { edge = process->addArc(from_vertex,to_vertex); (*transition_symbol)[edge] = send_symbol; (*Pchannel)[edge] = channel2; (*transition_message)[edge] = "send"; } else if(send_symbol == "") { edge1 = process1->addArc(from_vertex1,to_vertex1); (*transition_symbol1)[edge1] = receive_symbol; (*Pchannel1)[edge1] = channel1; (*transition_message1)[edge1] = "receive"; } else { string intermediate_state,intermediate_state1; intermediate_state = role +"_INTERMEDIATE_"+ temp2.attribute("id").value() + "_S"; intermediate_state1 = role +"_INTERMEDIATE_"+ temp2.attribute("id").value() + "_R"; vertex = process->addNode(); vertex1 = process1->addNode(); (*state_name)[vertex] = intermediate_state; (*state_name1)[vertex1] = intermediate_state1; edge1 = process1->addArc(from_vertex1,vertex1); (*Pchannel1)[edge1] = channel1; (*transition_symbol1)[edge1] = receive_symbol; (*transition_message1)[edge1] = "receive"; edge = process->addArc(vertex,to_vertex); (*Pchannel)[edge] = channel2; (*transition_symbol)[edge] = send_symbol; (*transition_message)[edge] = "send"; } } Process_initial_state.push_back(initial_state); Process_final_state.push_back(vertex2); Processes.emplace_back(process); Process_initial_state.push_back(initial_state1); Process_final_state.push_back(vertex3); Processes.emplace_back(process1); Process_state_name.push_back(state_name); Process_transition_symbol.push_back(transition_symbol); Process_transition_message.push_back(transition_message); Process_state_name.push_back(state_name1); Process_transition_symbol.push_back(transition_symbol1); Process_transition_message.push_back(transition_message1); Process_channel.push_back(Pchannel); Process_channel.push_back(Pchannel1); } }
int main (int argc, char *argv[]) { char buf[MAXL]; char host[64]; /*socket structure variables */ struct hostent *hp, *ihp; struct sockaddr_in sin, incoming; int port; int i, result, len; /*********************************************************************/ /* command line parsing */ /*********************************************************************/ if ( argc != 2 ) { fprintf(stderr, "Usage: %s <port-number> \n", argv[0]); exit(1); } /* get port number */ port = atoi((char*)argv[1]); /* get my host name and fill in hostent struct */ gethostname(host, sizeof host); hp = gethostbyname(host); if ( hp == NULL ) { fprintf(stderr, "%s: host not found (%s)\n", argv[0], host); exit(1); } /*************************************************** open a socket for listening 4 steps: 1. create socket 2. bind it to an address/port 3. listen 4. accept a connection *****************************************************/ /* create passive socket: use address family INET and STREAMing sockets (TCP) */ socket_dp = socket(AF_INET, SOCK_STREAM, 0); if ( socket_dp < 0 ) { perror("socket:"); exit(socket_dp); } /* set up the address and port */ sin.sin_family = AF_INET; sin.sin_port = htons(port); memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); /* bind socket s to address sin */ result = bind(socket_dp, (struct sockaddr *)&sin, sizeof(sin)); if ( result < 0 ) { perror("bind:"); exit(result); } /* listen to the network for connections */ result = listen(socket_dp, N); if ( result < 0 ) { perror("listen:"); exit(result); } /*********************************************************************/ /* accept connections */ /*********************************************************************/ len = sizeof(struct sockaddr_in); /* wait to accept a connection */ conn_dp = accept(socket_dp, (struct sockaddr *)&incoming, (socklen_t *) &len); if ( conn_dp < 0 ) { perror("accept:"); exit(result); } ihp = gethostbyaddr((char *)&incoming.sin_addr,sizeof(struct in_addr), AF_INET); printf(">> Connected to %s\n", ihp->h_name); /* read and print strings sent over the connection */ while ( 1 ) { len = recv(conn_dp, buf, MAXL, 0); if ( len < 0 ) { perror("recv"); exit(1); } if ( strcmp("CLOSE", buf)==0 ) break; process1(buf); /* Send ACK string (including the last char '\0') */ /* through the connection */ len = send(conn_dp, ack_msg, strlen(ack_msg)+1, 0); if ( len != strlen(ack_msg)+1 ) { perror("send"); exit(1); } } close(conn_dp); printf(">> Connection closed\n"); close(socket_dp); }
void ViBenchMarker3::process2() { int time = mTime.elapsed(); QObject::disconnect(mCurrentObject.data(), SIGNAL(noiseGenerated()), this, SLOT(process2())); /*QObject::connect(mCurrentObject.data(), SIGNAL(encoded()), this, SLOT(quit())); mCurrentObject->encode(ViAudio::Noise); return;*/ qreal maxMAT = 0; qint64 maxTP = 0, maxTN = 0, maxFP = 0, maxFN = 0; qint64 i, lengthIndex, offset1 = 0, offset2 = 0; int noChange = 0; ViAudioReadData corrupted(mCurrentObject->buffer(ViAudio::Noise)); ViAudioReadData realMask(mCurrentObject->buffer(ViAudio::CustomMask)); ViAudioReadData length(mCurrentObject->buffer(ViAudio::Custom)); corrupted.setSampleCount(WINDOW_SIZE); realMask.setSampleCount(WINDOW_SIZE); length.setSampleCount(WINDOW_SIZE); ViSampleChunk *nData1 = new ViSampleChunk(corrupted.bufferSamples() / 2); ViSampleChunk *nData2 = new ViSampleChunk(corrupted.bufferSamples() / 2); ViSampleChunk *nMask1 = new ViSampleChunk(corrupted.bufferSamples() / 2); ViSampleChunk *nMask2 = new ViSampleChunk(corrupted.bufferSamples() / 2); ViSampleChunk *nRealMask1 = new ViSampleChunk(realMask.bufferSamples() / 2); ViSampleChunk *nRealMask2 = new ViSampleChunk(realMask.bufferSamples() / 2); ViSampleChunk *nLength1 = new ViSampleChunk(corrupted.bufferSamples() / 2); ViSampleChunk *nLength2 = new ViSampleChunk(corrupted.bufferSamples() / 2); while(corrupted.hasData() && realMask.hasData()) { corrupted.read(); ViSampleChunk &corrupted1 = corrupted.splitSamples(0); ViSampleChunk &corrupted2 = corrupted.splitSamples(1); realMask.read(); ViSampleChunk &realMask1 = realMask.splitSamples(0); ViSampleChunk &realMask2 = realMask.splitSamples(1); length.read(); ViSampleChunk &length1 = length.splitSamples(0); ViSampleChunk &length2 = length.splitSamples(1); for(i = 0; i < corrupted1.size(); ++i) { (*nData1)[i + offset1] = corrupted1[i]; (*nRealMask1)[i + offset1] = realMask1[i]; (*nLength1)[i + offset1] = length1[i]; } offset1 += corrupted1.size(); for(i = 0; i < corrupted2.size(); ++i) { (*nData2)[i + offset2] = corrupted2[i]; (*nRealMask2)[i + offset2] = realMask2[i]; (*nLength2)[i + offset2] = length2[i]; } offset2 += corrupted2.size(); } mCurrentObject->clearBuffer(ViAudio::Target); mCurrentObject->clearBuffer(ViAudio::Noise); mCurrentObject->clearBuffer(ViAudio::NoiseMask); ViNoise noise1(nData1, nMask1, mCurrentThreshold); ViNoise noise2(nData2, nMask2, mCurrentThreshold); QVector<qreal> lengthTP(ViNoiseCreator::noiseSizeCount()); QVector<qreal> lengthFN(ViNoiseCreator::noiseSizeCount()); lengthTP.fill(0); lengthFN.fill(0); QVector<qreal> maxLengthTP, maxLengthFN; for(mCurrentThreshold = MASK_START; mCurrentThreshold <= MASK_END; mCurrentThreshold += MASK_INTERVAL) { noise1.setThreshold(mCurrentThreshold); noise1.generateMask(ViNoise::NOISE_TYPE); noise2.setThreshold(mCurrentThreshold); noise2.generateMask(ViNoise::NOISE_TYPE); qint64 truePositives = 0, falsePositives = 0, trueNegatives = 0, falseNegatives = 0; for(i = 0; i < nRealMask1->size(); ++i) { if((*nRealMask1)[i] == 1) { lengthIndex = ViNoiseCreator::fromSizeMask((*nLength1)[i]) - 1; if((*nMask1)[i] == 1) { ++truePositives; lengthTP[lengthIndex] += 1; } else { ++falseNegatives; lengthFN[lengthIndex] += 1; } } else if((*nRealMask1)[i] == 0) { if((*nMask1)[i] == 1) ++falsePositives; else ++trueNegatives; } } for(i = 0; i < nRealMask2->size(); ++i) { if((*nRealMask2)[i] == 1) { lengthIndex = ViNoiseCreator::fromSizeMask((*nLength2)[i]) - 1; if((*nMask2)[i] == 1) { ++truePositives; lengthTP[lengthIndex] += 1; } else { ++falseNegatives; lengthFN[lengthIndex] += 1; } } else if((*nRealMask2)[i] == 0) { if((*nMask2)[i] == 1) ++falsePositives; else ++trueNegatives; } } qreal math = matthews(truePositives, trueNegatives, falsePositives, falseNegatives); if(math > maxMAT) { maxMAT = math; maxTP = truePositives; maxTN = trueNegatives; maxFP = falsePositives; maxFN = falseNegatives; maxLengthTP = lengthTP; maxLengthFN = lengthFN; noChange = 0; } ++noChange; if(noChange > NO_CHANGE) break; } delete nRealMask1; delete nRealMask2; delete nLength1; delete nLength2; ++mDoneParamIterations; if(maxMAT > mBestMatthews) mBestMatthews = maxMAT; printFileData(time, maxTP, maxTN, maxFP, maxFN, maxLengthTP, maxLengthFN); printTerminal(time, maxTP, maxTN, maxFP, maxFN, mBestMatthews); if(nextParam()) process1(false); else nextFile(); }
int main(int argc, char *argv[]) { struct sockaddr_in ProxyAddr; struct sockaddr_in BrowserAddr; struct hostent *HostInfo; int opt; int httpNumber = 1; int portNumber; int bl = 1; /* bind()失敗対策 */ int clientSocket; int browserlength; char ipaddress[15]; if (argc != 4) { fprintf(stderr, "usage: ./proxy [-0][-1] [ipaddress] [port]\n"); exit(1); } /* オプションの取得*/ if((opt = getopt(argc,argv,"01")) != -1) { switch(opt) { case '0': printf("Select HTTP/1.0\n"); httpNumber = 0; break; case '1': printf("Select HTTP/1.1\n"); httpNumber = 1; break; default: printf("Please Select one of [-0][-1]\n"); exit(1); break; } } strcpy(ipaddress, argv[2]); portNumber = atoi(argv[3]); printf("Port Number: %d\n", portNumber); printf("IP address : %s\n", ipaddress); /* SIGINTにSigHandler()を,SIGCHLDにCatchChild()を登録 */ signal(SIGINT, SigHandler); signal(SIGCHLD, CatchChild); /* ブラウザとの通信用のソケットを作成 */ if ((ProxySocket = socket(AF_INET, SOCK_STREAM, 0)) == -1) { fprintf(stderr, "Failed to make a Proxysocket!\n"); exit(1); } /* ホスト名を得る */ /*if ((HostInfo = gethostbyname("localhost")) == NULL) {*/ if ((HostInfo = gethostbyname(ipaddress)) == NULL) { fprintf(stderr, "Failed to find host!\n"); exit(1); } ProxyAddr.sin_family = AF_INET; ProxyAddr.sin_port = htons(portNumber); memcpy((char *)&ProxyAddr.sin_addr, (char *)HostInfo->h_addr_list[0], HostInfo->h_length); /* bind()失敗対策 */ setsockopt(ProxySocket, SOL_SOCKET, SO_REUSEADDR, (const char *)&bl, sizeof(bl)); /* IPアドレスとポート番号の設定 */ if (bind(ProxySocket, (struct sockaddr *)&ProxyAddr, sizeof(ProxyAddr)) == -1) { fprintf(stderr, "Failed to assign a name to the Proxysocket!\n"); exit(1); } /* listen */ if (listen(ProxySocket, 5) == -1) { fprintf(stderr, "Failed to listen ProxySocket!\n"); exit(1); } /* ブラウザから要求があったらプロセスを作成するループ */ while (1) { int pid; /* プロセスの作成 */ struct timeval waitval; /* タイムアウト */ fd_set rfds; /* select()に必要 */ /* 監視対象をセット */ FD_ZERO(&rfds); FD_SET(ProxySocket, &rfds); /* 監視のタイムアウトの時間を設定 */ waitval.tv_sec = 5; waitval.tv_usec = 0; if (select(ProxySocket+1, &rfds, NULL, NULL, &waitval) <= 0) { continue; /* select()に失敗するとwhile文をやり直す */ } /* clientSocketをプロセスに渡す */ if (FD_ISSET(ProxySocket, &rfds)) { /* ブラウザからの接続要求をaccept() */ browserlength = sizeof(BrowserAddr); if ((clientSocket = accept(ProxySocket, (struct sockaddr *)&BrowserAddr, (socklen_t *)&browserlength)) == -1) { fprintf(stderr, "Failed to accept clientSocket!\n"); exit(1); } pid = fork(); /* プロセスの作成 */ if (pid == 0) { #if defined(DEBUG) printf("子プロセス開始.\n"); #endif /* 子プロセス */ if(httpNumber == 0) process0(clientSocket); if(httpNumber == 1) process1(clientSocket, ipaddress); } else if (pid > 0) { /* fork()失敗 */ close(clientSocket); } else { /* アクセプトソケットクローズ */ close(clientSocket); #if defined(DEBUG) printf("ブラウザのソケットを閉じました.\n"); #endif } /* 親プロセス処理なし */ } } return 0; }
void VstXSynth::processReplacing(float **inputs, float **outputs, long sampleFrames) { if(isDirty) { LP.SetParams(1.f - SCALED[kdamp]); float x1 = fabsf(SCALED[kfreq1] - SCALED[kdfreq1]); float x2 = fabsf(SCALED[kfreq1] + SCALED[kdfreq1]); if(x1 < 0.01f) x1 = 0.01f; if(x2 < 0.01f) x2 = 0.01f; x1 = getSampleRate()/x1; if(x1 > 500000.f) x1 = 500000.f; x2 = getSampleRate()/x2; if(x2 > 500000.f) x2 = 500000.f; S.SetParams(x1,x2); F.SetParams(SCALED[kfreq2],SCALED[kfeed2],SCALED[kdrywet],SCALED[kdist],SCALED[kmindelay],SCALED[kmaxdelay]); E.SetParams(SCALED[kattack],SCALED[krelease]); isDirty = false; } float *out1 = outputs[0]; float *out2 = outputs[1]; float *in1 = inputs[0]; bool murder = SCALED[kmurder] > 0.5f; short mask = (short)SCALED[kbits]; bool b_and = SCALED[kand] > 0.5f; bool b_xor = SCALED[kxor] > 0.5f; bool power = SCALED[kpower] > 0.5f; float tmp1 = (1.f - SCALED[kdrywet]); float tmp2 = SCALED[kdrywet]*SCALED[kamp]; float tmp4 = (1.f-SCALED[kfeed1]); float tmp3 = SCALED[klimiter] * 0.5f; for(long i=0;i<sampleFrames;i++) { float bitout; if(murder) bitout = process1(in1[i],mask,b_xor,b_and,power); else bitout = in1[i]; ivan_output = F.GetVal(Delay.GetVal(LP.GetVal(SCALED[kfeed1]*ivan_output + tmp4*bitout),S.GetVal(TriToSine(S2.GetVal(SCALED[kvibfreq]))*SCALED[kdvibfreq]))); float env_out = E.GetVal(ivan_output); if(env_out < 1.f) ivan_output *= 1.f - tmp3 * env_out; else ivan_output *= (1.f - tmp3 * 2.f) + tmp3 / env_out; out1[i] = in1[i]*tmp1 + ivan_output*tmp2; out2[i] = in1[i]*tmp1 + ivan_output*tmp2; } if(fabs(ivan_output) < 1e-10 || fabs(ivan_output) > 1e10) ivan_output = 0.f; }