void wrtttx::init() { setTxTriggerDelayInNs(mInitialTriggerDelay); setTriggerId(0); resetCounter(); enable(false); }
QWidget* StopSpam::options() { if (!enabled) { return 0; } options_ = new QWidget(); ui_.setupUi(options_); connect(options_, SIGNAL(destroyed()), SLOT(onOptionsClose())); ui_.tv_rules->setModel(model_); ui_.tv_rules->init(); connect(ui_.cb_send_block_all_mes, SIGNAL(stateChanged(int)), SLOT(changeWidgetsState())); connect(ui_.cb_enable_muc, SIGNAL(stateChanged(int)), SLOT(changeWidgetsState())); connect(ui_.cb_block_privates, SIGNAL(stateChanged(int)), SLOT(changeWidgetsState())); connect(ui_.pb_add, SIGNAL(released()), SLOT(addRow())); connect(ui_.pb_del, SIGNAL(released()), SLOT(removeRow())); connect(ui_.pb_reset, SIGNAL(released()), SLOT(resetCounter())); connect(ui_.pb_view, SIGNAL(released()), SLOT(view())); restoreOptions(); changeWidgetsState(); return options_; }
EnvelopeNodePopup::EnvelopeNodePopup(EnvelopeHandleComponent* handleToEdit) : handle(handleToEdit), initialised(false) { resetCounter(); addChildComponent(setLoopButton = new TextButton("Set Y to Loop")); addChildComponent(setReleaseButton = new TextButton("Set Y to Release")); setLoopButton->addListener(this); setReleaseButton->addListener(this); addAndMakeVisible(combo = new ComboBox("combo")); combo->addItem("Normal", idOffset + (int)Normal); combo->addItem("Release", idOffset + (int)Release); combo->addItem("Loop", idOffset + (int)Loop); combo->addItem("Release & Loop", idOffset + (int)ReleaseAndLoop); combo->addListener(this); EnvelopeComponent* env = handle->getParentComponent(); if(env != 0) { if(env->isLoopNode(handle) && env->isReleaseNode(handle)) combo->setSelectedId(idOffset + (int)ReleaseAndLoop, false); else if(env->isLoopNode(handle)) combo->setSelectedId(idOffset + (int)Loop, false); else if(env->isReleaseNode(handle)) combo->setSelectedId(idOffset + (int)Release, false); else combo->setSelectedId(idOffset + (int)Normal, false); } }
//------------------------------------------- void blobTracker::end(){ if(storedBlobs.size() <= 0)return; int timeMillis = ofGetElapsedTimeMillis(); vector <int> eraseList; eraseList.clear(); //we do it in reverse order so when we erase from the list it doesn't mess up the other indexes for(int j = storedBlobs.size()-1; j >= 0; j--){ if( storedBlobs[j].assigned ) storedBlobs[j].lastAliveTime = timeMillis; else if( timeMillis - storedBlobs[j].lastAliveTime > deathTime ){ eraseList.push_back(j); //printf("kill this - %i\n", storedBlobs[j].id); } } //now kill the old stored trackedBlobs for(int j = 0; j < eraseList.size(); j++){ //printf("deleting trackedBlob %i \n", eraseList[j]); storedBlobs.erase(storedBlobs.begin() + eraseList[j]); } numStoredBlobs = storedBlobs.size(); //printf("finished deleteing - %i left\n", numStoredBlobs); if( numStoredBlobs == 0)resetCounter(); }
EnvelopeCurvePopup::EnvelopeCurvePopup(EnvelopeHandleComponent* handleToEdit) : handle(handleToEdit), initialised(false) { resetCounter(); EnvCurve curve = handle->getCurve(); EnvCurve::CurveType type = curve.getType(); float curveValue = curve.getCurve(); addChildComponent(slider = new CurveSlider()); slider->setSliderStyle(Slider::LinearBar); //slider->setTextBoxStyle(Slider::NoTextBox, false, 0,0); slider->setRange(-1, 1, 0.0); #ifdef __JUCE_NOTIFICATIONTYPE_JUCEHEADER__ slider->setValue(curveValue, dontSendNotification); #else slider->setValue(curveValue, false); #endif addAndMakeVisible(combo = new ComboBox("combo")); combo->addItem("Empty", idOffset + (int)EnvCurve::Empty); combo->addItem("Numerical...", idOffset + (int)EnvCurve::Numerical); combo->addItem("Step", idOffset + (int)EnvCurve::Step); combo->addItem("Linear", idOffset + (int)EnvCurve::Linear); EnvelopeComponent *parent = handleToEdit->getParentComponent(); double min, max; parent->getValueRange(min, max); if(((min > 0.0) && (max > 0.0)) || ((min < 0.0) && (min < 0.0))) { // exponential can't cross zero combo->addItem("Exponential", idOffset + (int)EnvCurve::Exponential); } combo->addItem("Sine", idOffset + (int)EnvCurve::Sine); combo->addItem("Welch", idOffset + (int)EnvCurve::Welch); combo->addListener(this); switch(type) { case EnvCurve::Empty: combo->setSelectedId(idOffset + (int)EnvCurve::Empty, false); break; case EnvCurve::Numerical: combo->setSelectedId(idOffset + (int)EnvCurve::Numerical, false); break; case EnvCurve::Step: combo->setSelectedId(idOffset + (int)EnvCurve::Step, false); break; case EnvCurve::Linear: combo->setSelectedId(idOffset + (int)EnvCurve::Linear, false); break; case EnvCurve::Exponential: combo->setSelectedId(idOffset + (int)EnvCurve::Exponential, false); break; case EnvCurve::Sine: combo->setSelectedId(idOffset + (int)EnvCurve::Sine, false); break; case EnvCurve::Welch: combo->setSelectedId(idOffset + (int)EnvCurve::Welch, false); break; } slider->addListener(this); }
/* * Class: edu_wpi_first_wpilibj_hal_CounterJNI * Method: resetCounter * Signature: (J)V */ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_resetCounter (JNIEnv * env, jclass, jlong id) { COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI resetCounter"; COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << (void*)id; int32_t status = 0; resetCounter((void*)id, &status); COUNTERJNI_LOG(logDEBUG) << "Status = " << status; CheckStatus(env, status); }
void KNMusicDetailTooltip::showTooltip(const QPoint &position) { //Set the position. moveToPosition(position); //Show the tooltip box if it didn't display before. if(!isVisible()) { show(); } //Reset the fade out counter. resetCounter(); //Start the fade out counter. m_fadeOutCounter->start(); }
void EnvelopeCurvePopup::sliderValueChanged(Slider* sliderThatChanged) { resetCounter(); if(sliderThatChanged == slider) { EnvCurve curve = handle->getCurve(); double value = slider->getValue(); value = cubed(value); value = linlin(value, -1.0, 1.0, -50.0, 50.0); curve.setCurve(value); handle->setCurve(curve); } }
void VboCircleRenderer::draw() { filledCircleVbo.updateVertexData(filledCirclePos, filledCounter.vertex); filledCircleVbo.updateIndexData(filledCircleIndices, filledCounter.index); filledCircleVbo.updateColorData(filledCircleColors, filledCounter.color); filledCircleVbo.drawElements(GL_TRIANGLES , filledCounter.index); glLineWidth(lineWidth); noFillCircleVbo.updateVertexData(noFillCirclePos, noFillCounter.vertex); noFillCircleVbo.updateIndexData(noFillCircleIndices, noFillCounter.index); noFillCircleVbo.updateColorData(noFillCircleColors, noFillCounter.color); noFillCircleVbo.drawElements(GL_LINES, noFillCounter.index); resetCounter(); }
pairSaveWindow::pairSaveWindow( QWidget *parent ) : mLabWindow( parent ), _ui( new Ui::pairSaveWindow ), _intervalCounter( 0 ), _savedCounter( 0 ), _recording( false ), _dataRecorded( false ) { _ui->setupUi( this ); connect( _ui->btn_selectFile, SIGNAL( clicked() ), this, SLOT( selectFile() ) ); connect( _ui->btn_startStop, SIGNAL( clicked() ), this, SLOT( startStopPressed() ) ); connect( _ui->btn_resetCounter, SIGNAL( clicked() ), this, SLOT( resetCounter() ) ); addDelimiters(); }
void EnvelopeCurvePopup::comboBoxChanged (ComboBox* comboBoxThatHasChanged) { resetCounter(); if(comboBoxThatHasChanged == combo) { EnvCurve::CurveType type = (EnvCurve::CurveType)(combo->getSelectedId() - idOffset); bool showSlider = type == EnvCurve::Numerical; slider->setVisible(showSlider); EnvCurve curve = handle->getCurve(); curve.setType(type); handle->setCurve(curve); if(!showSlider && initialised) expire(); initialised = true; } }
void pairSaveWindow::mLabSignal( char signal, const QString& cmd ) { if( signal == SIGNAL_SHUTDOWN || (signal == SIGNAL_STOP && _ui->chb_setZeroAtStopSignal->isChecked()) ) { if( _recording ) { _recording = false; _ui->btn_startStop->setText( START_RECORDING ); _ui->lbl_status->setText( signal == SIGNAL_SHUTDOWN ? EMERGENCY_STOP : STOP_RECEIVED ); _ui->lbl_status->setStyleSheet( STYLE_ERROR ); _ui->btn_selectFile->setEnabled( true ); _ui->cob_delimiter->setEnabled( true ); _ui->cob_x->setEnabled( true ); _ui->cob_y->setEnabled( true ); _intervalCounter = 0; emit changeWindowState( this->windowTitle(), false ); } } else if( signal == 10 ) { if( _ui->btn_startStop->text() == STOP_RECORDING ) { startStopPressed(); } } else if( signal == 11 ) { if( _ui->btn_startStop->text() == START_RECORDING ) { startStopPressed(); } } else if( signal == 19 ) { resetCounter(); } }
BOOL cupdatenetlib::downloadList(){ if ( !(_wmkdir(szUpdfilesPath) < 0 && errno == EEXIST) ){ SVP_LogMsg( _T("UPD dir not exist and writeable! ")); return 0; } resetCounter(); CString szBranch = svpToolBox.fileGetContent(szUpdfilesPath + _T("branch") ); if(szBranch.IsEmpty() ){ /* 如果 mtime 小于 stable 版本的 mtime 就更新 stable , 大于就更新 beta */ // struct __stat64 sbuf; CString szPlayerPath = svpToolBox.GetPlayerPath(_T("splayer.exe")); if(!svpToolBox.ifFileExist(szPlayerPath) ){ szPlayerPath = svpToolBox.GetPlayerPath(_T("mplayerc.exe")); if (!svpToolBox.ifFileExist(szPlayerPath)){ szPlayerPath = svpToolBox.GetPlayerPath(_T("svplayer.exe")); } } if(svpToolBox.ifFileExist(szPlayerPath) ){ std::wstring str = HashController::GetInstance()->GetMD5Hash(szPlayerPath.GetBuffer()); szBranch = str.c_str(); } else szBranch = _T("stable"); } WCHAR* wsz = this->svpToolBox.getTmpFileName(); CString szTmpFilename(wsz); delete wsz; CString szPostPerm; szPostPerm.Format(_T("ver=%s&branch=%s"), BRANCHVER, szBranch); int rret = 0; CString szLog; DeleteFile(szTmpFilename); return rret; }
cupdatenetlib::cupdatenetlib(void) : m_hD3DX9Dll(NULL) { resetCounter(); CString path; GetModuleFileName(NULL, path.GetBuffer(MAX_PATH), MAX_PATH); path.ReleaseBuffer(); CPath cpath(path); cpath.RemoveFileSpec(); cpath.AddBackslash(); szBasePath = CString(cpath); cpath.Append(_T("UPD")); cpath.AddBackslash(); szUpdfilesPath = CString(cpath); _wmkdir(szUpdfilesPath); }
void EnvelopeNodePopup::comboBoxChanged (ComboBox* comboBoxThatHasChanged) { resetCounter(); if(comboBoxThatHasChanged == combo) { EnvelopeComponent* env = handle->getParentComponent(); if(env != 0) { NodeType type = (NodeType)(combo->getSelectedId() - idOffset); switch(type) { case Normal: { if(env->isLoopNode(handle)) env->setLoopNode(-1); if(env->isReleaseNode(handle)) env->setReleaseNode(-1); setLoopButton->setVisible(false); setReleaseButton->setVisible(false); } break; case Release: { if(env->isLoopNode(handle)) env->setLoopNode(-1); env->setReleaseNode(handle); setReleaseButton->setVisible(false); if(env->getLoopNode() != -1) setLoopButton->setVisible(true); } break; case Loop: { env->setLoopNode(handle); if(env->isReleaseNode(handle)) env->setReleaseNode(-1); if(env->getReleaseNode() != -1) setReleaseButton->setVisible(true); setLoopButton->setVisible(false); } break; case ReleaseAndLoop: { env->setLoopNode(handle); env->setReleaseNode(handle); setLoopButton->setVisible(false); setReleaseButton->setVisible(false); } } } if(initialised) expire(); initialised = true; } }
void main() { char s[40]; int encoder_state; word count; // Initialize the controller brdInit(); // Configure digital outputs to simulate quadrature encoder output setDigOut(LED1, 1); setDigOut(LED2, 1); // Configure quadrature encoder input setDecoder(QUAD_I, QUAD_Q, -1, 0); // Configure digital inputs for switches setDigIn(SW1); setDigIn(SW2); setDigIn(SW3); // initialize outputs to low encoder_state = 0; simulate_encoder(encoder_state); // reset quadrature decoder counter resetCounter(QUAD_I); DispStr(2, 1, "<<< Simulating a Quadrature Encoder with button presses >>>"); DispStr(1, 3, "Press Button SW1 to decrement counter"); DispStr(1, 4, "Press Button SW2 to increment counter"); DispStr(1, 5, "Press Button SW3 to reset counter"); while (1) { costate { // Display the counter value getCounter(QUAD_I, &count); sprintf(s, "Quadrature Decoder Count = %6u", count); DispStr(1, 7, s); } costate { // decrement counter waitfor(!digIn(SW1)); // wait for switch 1 to be pressed waitfor(DelayMs(50)); // debounce if (!digIn(SW1)) { --encoder_state; if (encoder_state < 0) { encoder_state = 3; } simulate_encoder(encoder_state); waitfor(DelayMs(150)); // repeat when switch held down } } costate { // increment counter waitfor(!digIn(SW2)); // wait for switch 2 to be pressed waitfor(DelayMs(50)); // debounce if (!digIn(SW2)) { ++encoder_state; if (encoder_state > 3) { encoder_state = 0; } simulate_encoder(encoder_state); waitfor(DelayMs(150)); // repeat when switch held down } } costate { // reset counter waitfor(!digIn(SW3)); // wait for switch 3 to be pressed waitfor(DelayMs(50)); // debounce if (!digIn(SW3)) { resetCounter(QUAD_I); // reset quadrature decoder counter waitfor(digIn(SW3)); // wait for switch 3 to be released } } } }
BOOL cupdatenetlib::downloadList(){ if ( !(_wmkdir(szUpdfilesPath) < 0 && errno == EEXIST) ){ SVP_LogMsg( _T("UPD dir not exist and writeable! ")); return 0; } resetCounter(); CString szBranch = svpToolBox.fileGetContent(szUpdfilesPath + _T("branch") ); if(szBranch.IsEmpty() ){ /* 如果 mtime 小于 stable 版本的 mtime 就更新 stable , 大于就更新 beta */ // struct __stat64 sbuf; CString szPlayerPath = svpToolBox.GetPlayerPath(_T("splayer.exe")); if(!svpToolBox.ifFileExist(szPlayerPath) ){ szPlayerPath = svpToolBox.GetPlayerPath(_T("mplayerc.exe")); if (!svpToolBox.ifFileExist(szPlayerPath)){ szPlayerPath = svpToolBox.GetPlayerPath(_T("svplayer.exe")); } } if(svpToolBox.ifFileExist(szPlayerPath) ){ CMD5Checksum cmd5; //szBranch.Format( _T("%I64d") , sbuf.st_mtime ); szBranch = cmd5.GetMD5((LPCTSTR)szPlayerPath).c_str(); //AfxMessageBox(szBranch); } else szBranch = _T("stable"); } WCHAR* wsz = this->svpToolBox.getTmpFileName(); CString szTmpFilename(wsz); delete wsz; CString szPostPerm; szPostPerm.Format(_T("ver=%s&branch=%s"), BRANCHVER, szBranch); int rret = 0; CString szLog; if (PostUsingCurl(szPostPerm, szTmpFilename)){ rret = 1; GetD3X9Dll(); //iSVPCU_TOTAL_FILE = 0; iSVPCU_TOTAL_FILEBYTE = 0; CString szData = svpToolBox.fileGetContent( szTmpFilename ) ; CStringArray szaLines; svpToolBox.Explode( szData, _T("\n") , &szaLines ); for(int i = 0; i < szaLines.GetCount(); i++){ if (szaLines.GetAt(i).IsEmpty()){break;} this->iSVPCU_TOTAL_FILE++; //szLog.Format(_T("Total Files need to download: %d"), iSVPCU_TOTAL_FILE); //SVP_LogMsg(szLog); CStringArray szaTmp; svpToolBox.Explode( szaLines.GetAt(i), _T(";") , &szaTmp ); if(szaTmp.GetCount() < LFILETOTALPARMS){ continue; } if (SkipThisFile(szaTmp.GetAt(LFILESETUPPATH), szaTmp.GetAt(LFILEACTION))) continue; //检查是否需要下载 CString szSetupPath = szaTmp.GetAt(LFILESETUPPATH); if (szSetupPath.CompareNoCase( _T("splayer.exe")) == 0){ if(!svpToolBox.ifFileExist(szBasePath + szSetupPath) ){ if (svpToolBox.ifFileExist(szBasePath + _T("mplayerc.exe"))) szSetupPath = _T("mplayerc.exe"); if (svpToolBox.ifFileExist(szBasePath + _T("svplayer.exe"))) szSetupPath = _T("svplayer.exe"); } } bool bDownloadThis = FALSE; //check file hash CMD5Checksum cmd5; CString updTmpHash ; CString currentHash ; if( svpToolBox.ifFileExist(szUpdfilesPath + szaTmp.GetAt(LFILETMPATH))) { updTmpHash = cmd5.GetMD5((LPCTSTR)(szUpdfilesPath + szaTmp.GetAt(LFILETMPATH))).c_str(); //Get Hash for current Temp File } if( svpToolBox.ifFileExist(szBasePath + szSetupPath ) ){ currentHash = cmd5.GetMD5((LPCTSTR)(szBasePath + szSetupPath)).c_str(); //Get Hash for bin file } if (currentHash.CompareNoCase( szaTmp.GetAt(LFILEHASH) ) == 0 ) continue; if ( updTmpHash.CompareNoCase( szaTmp.GetAt(LFILEHASH) ) != 0 ){ bDownloadThis = TRUE; } UpdateInfo* puinfo = new UpdateInfo; puinfo->bDownload = bDownloadThis; puinfo->dwDowloadedLength = _wtoi(szaTmp.GetAt(LFILEGZLEN)); puinfo->dwFileLength = _wtoi(szaTmp.GetAt(LFILELEN)); puinfo->strId = (szaTmp.GetAt(LFILEID)); puinfo->strAction = szaTmp.GetAt(LFILEACTION); puinfo->strDownloadfileMD5 = szaTmp.GetAt(LFILEGZHASH); puinfo->strFileMd5 = szaTmp.GetAt(LFILEHASH); puinfo->strPath = szaTmp.GetAt(LFILESETUPPATH); puinfo->strTempName = szaTmp.GetAt(LFILETMPATH); puinfo->strCurrentMD5 = currentHash; puinfo->bReadyToCopy = !bDownloadThis; m_UpdateFileArray.Add(puinfo); if(bDownloadThis){ iSVPCU_TOTAL_FILEBYTE += _wtoi(szaTmp.GetAt(LFILEGZLEN)); //szaTmp.SetSize(LFILETOTALPARMS); //szaLists.Append( szaTmp ); } } szLog.Format(_T("Total Files: %d ; Total Len %d"), iSVPCU_TOTAL_FILE, iSVPCU_TOTAL_FILEBYTE); SVP_LogMsg(szLog); } DeleteFile(szTmpFilename); return rret; }