int Speech_Encode_Frame_First ( Speech_Encode_FrameState *st, /* i/o : post filter states */ Word16 *new_speech) /* i : speech input */ { #if !defined(NO13BIT) Word16 i; #endif setCounter(st->complexityCounter); #if !defined(NO13BIT) /* Delete the 3 LSBs (13-bit input) */ for (i = 0; i < L_NEXT; i++) { new_speech[i] = new_speech[i] & 0xfff8; move16 (); logic16 (); } #endif /* filter + downscaling */ Pre_Process (st->pre_state, new_speech, L_NEXT); cod_amr_first(st->cod_amr_state, new_speech); Init_WMOPS_counter (); /* reset WMOPS counter for the new frame */ return 0; }
void newTheorem(char *name, char *caption, char *numbered_like, char *within) /************************************************************************** purpose: allocates and initializes a \newtheorem **************************************************************************/ { if (iNewTheoremCount==MAX_THEOREMS){ diagnostics(WARNING,"Too many \\newtheorems, ignoring %s", name); return; } NewTheorems[iNewTheoremCount].name=strdup(name); NewTheorems[iNewTheoremCount].caption=strdup(caption); if (numbered_like) NewTheorems[iNewTheoremCount].numbered_like=strdup(numbered_like); else NewTheorems[iNewTheoremCount].numbered_like=strdup(name); if (within) NewTheorems[iNewTheoremCount].within=strdup(within); else NewTheorems[iNewTheoremCount].within=NULL; setCounter(NewTheorems[iNewTheoremCount].numbered_like,0); iNewTheoremCount++; }
/************************************************************************* * * Function: Speech_Encode_Frame_reset * Purpose: Resetses state memory * ************************************************************************** */ int Speech_Encode_Frame_reset (Speech_Encode_FrameState *state) { if (state == (Speech_Encode_FrameState *) NULL){ fprintf(stderr, "Speech_Encode_Frame_reset: invalid parameter\n"); return -1; } Pre_Process_reset(state->pre_state); cod_amr_reset(state->cod_amr_state); setCounter(state->complexityCounter); Init_WMOPS_counter(); setCounter(0); /* set counter to global counter */ return 0; }
AbstractCounter::AbstractCounter(Player *_player, int _id, const QString &_name, bool _shownInCounterArea, int _value, QGraphicsItem *parent) : QGraphicsItem(parent), player(_player), id(_id), name(_name), value(_value), hovered(false), aDec(0), aInc(0), dialogSemaphore(false), deleteAfterDialog(false), shownInCounterArea(_shownInCounterArea) { #if QT_VERSION < 0x050000 setAcceptsHoverEvents(true); #else setAcceptHoverEvents(true); #endif if (player->getLocal()) { menu = new QMenu(name); aSet = new QAction(this); connect(aSet, SIGNAL(triggered()), this, SLOT(setCounter())); menu->addAction(aSet); menu->addSeparator(); for (int i = -10; i <= 10; ++i) if (i == 0) menu->addSeparator(); else { QAction *aIncrement = new QAction(QString(i < 0 ? "%1" : "+%1").arg(i), this); if (i == -1) aDec = aIncrement; else if (i == 1) aInc = aIncrement; aIncrement->setData(i); connect(aIncrement, SIGNAL(triggered()), this, SLOT(incrementCounter())); menu->addAction(aIncrement); } } else menu = 0; retranslateUi(); }
void DutyUnit::nr4Change(const unsigned newNr4, const unsigned long cc) { setFreq((newNr4 << 8 & 0x700) | (getFreq() & 0xFF), cc); if (newNr4 & 0x80) { nextPosUpdate = (cc & ~1) + period; setCounter(); } }
void DutyUnit::loadState(const SaveState::SPU::Duty &dstate, const unsigned nr1, const unsigned nr4, const unsigned long cc) { nextPosUpdate = std::max(dstate.nextPosUpdate, cc); pos = dstate.pos & 7; setDuty(nr1); period = toPeriod((nr4 << 8 & 0x700) | dstate.nr3); enableEvents = true; setCounter(); }
void DutyUnit::saveState(SaveState::SPU::Duty &dstate, unsigned long const cc) { updatePos(cc); setCounter(); dstate.nextPosUpdate = nextPosUpdate_; dstate.nr3 = freq() & 0xFF; dstate.pos = pos_; dstate.high = high_; }
void YubikoOtpKeyConfig::copyAndSaveToken(const yubikey_token_st& pToken) { setCounter(pToken.ctr); setUseCounter(pToken.use); getToken().tstph = pToken.tstph; getToken().tstpl = pToken.tstpl; computeCrc(); save(); }
void DutyUnit::resetCounters(unsigned long const oldCc) { if (nextPosUpdate_ == counter_disabled) return; updatePos(oldCc); nextPosUpdate_ -= counter_max; setCounter(); }
void DutyUnit::nr4Change(unsigned const newNr4, unsigned long const cc) { setFreq((newNr4 << 8 & 0x700) | (freq() & 0xFF), cc); if (newNr4 & 0x80) { nextPosUpdate_ = (cc & ~1ul) + period_ + 4; setCounter(); } }
/************************************************************************* * * Function: Speech_Encode_Frame_exit * Purpose: The memory used for state memory is freed * ************************************************************************** */ void Speech_Encode_Frame_exit (Speech_Encode_FrameState **state) { if (state == NULL || *state == NULL) return; Pre_Process_exit(&(*state)->pre_state); cod_amr_exit(&(*state)->cod_amr_state); setCounter((*state)->complexityCounter); WMOPS_output(0); setCounter(0); /* set counter to global counter */ /* deallocate memory */ free(*state); *state = NULL; return; }
int Speech_Encode_Frame ( Speech_Encode_FrameState *st, /* i/o : post filter states */ enum Mode mode, /* i : speech coder mode */ Word16 *new_speech, /* i : speech input */ Word16 *serial, /* o : serial bit stream */ enum Mode *usedMode /* o : used speech coder mode */ ) { Word16 prm[MAX_PRM_SIZE]; /* Analysis parameters. */ Word16 syn[L_FRAME]; /* Buffer for synthesis speech */ Word16 i; setCounter(st->complexityCounter); Reset_WMOPS_counter (); /* reset WMOPS counter for the new frame */ /* initialize the serial output frame to zero */ for (i = 0; i < MAX_SERIAL_SIZE; i++) { serial[i] = 0; move16 (); } #if !defined(NO13BIT) /* Delete the 3 LSBs (13-bit input) */ for (i = 0; i < L_FRAME; i++) { new_speech[i] = new_speech[i] & 0xfff8; move16 (); logic16 (); } #endif /* filter + downscaling */ Pre_Process (st->pre_state, new_speech, L_FRAME); /* Call the speech encoder */ cod_amr(st->cod_amr_state, mode, new_speech, prm, usedMode, syn); /* Parameters to serial bits */ Prm2bits (*usedMode, prm, &serial[0]); fwc(); setCounter(0); /* set counter to global counter */ return 0; }
void listener(zhandle_t *zzh, int type, int state, const char *path,void* ctx) { if (type == ZOO_SESSION_EVENT) { if (state == ZOO_CONNECTED_STATE || state == ZOO_READONLY_STATE) { pthread_mutex_lock(&lock); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&lock); } setCounter(0); } }
void DutyUnit::loadState(SaveState::SPU::Duty const &dstate, unsigned const nr1, unsigned const nr4, unsigned long const cc) { nextPosUpdate_ = std::max(dstate.nextPosUpdate, cc); pos_ = dstate.pos & 7; high_ = dstate.high; duty_ = nr1 >> 6; period_ = toPeriod((nr4 << 8 & 0x700) | dstate.nr3); enableEvents_ = true; setCounter(); }
colorContainer::colorContainer(vector<colorObject> theColors, colorObject color, int counter) { int size = theColors.size(); pointArray.resize(size); for (int i = 0; i < size; i++) { pointArray.push_back(Point(theColors.at(i).getXPos(), theColors.at(i).getYPos())); } setType(color.getType()); setCounter(counter); std::sort(pointArray.begin(), pointArray.end(), CompareX()); divideArray(); }
void resetTheoremCounter(char *unit) /************************************************************************** purpose: resets theorem counters based on unit **************************************************************************/ { int i; for (i=0; i<iNewTheoremCount; i++) { if (strequal(unit,NewTheorems[i].within)) setCounter(NewTheorems[i].numbered_like, 0); } }
void SwapScreen::waitForKey(){ BITMAP* textBuf; textBuf = create_bitmap(150,50); clear_to_color(textBuf,makecol(255,0,255)); counter=255; flag=false; rest(20); clear_keybuf(); while (!keypressed()){ textprintf_ex(textBuf,font,5,5, makecol(counter,counter,counter), -1, "<Press Any Key>"); draw_sprite(screen,textBuf,160, SCREEN_H/2); setCounter(); } rest(20); destroy_bitmap(textBuf); }
Counter::Counter(QWidget *parent): QWidget(parent), _ui(new Ui::Counter), _timer(new QTimer(this)), _updater(new QTimer(this)), _audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)), _mediaObject(new Phonon::MediaObject(this)), _settings(new SettingsDialog(_audioOutput, _mediaObject, this)), _editor(new EditorDialog(this)) { _ui->setupUi(this); _ui->start->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPlay)); _ui->pause->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaPause)); _ui->pause->setVisible(false); _ui->reset->setIcon(qApp->style()->standardIcon(QStyle::SP_MediaStop)); #if QT_VERSION < 0x040704 _ui->settings->setIcon(qApp->style()->standardIcon(QStyle::SP_FileDialogDetailedView)); #else _ui->settings->setIcon(qApp->style()->standardIcon(static_cast<QStyle::StandardPixmap>(SP_CustomToolBarList))); #endif _timer->setSingleShot(true); _updater->setSingleShot(false); _updater->setInterval(10); Phonon::createPath(_mediaObject, _audioOutput); _mediaObject->setCurrentSource(Phonon::MediaSource("timer.mp3")); connect(_ui->counterLabel, SIGNAL(clicked()), this, SLOT(editCounter())); connect(_ui->start, SIGNAL(clicked()), this, SLOT(start())); connect(_ui->pause, SIGNAL(clicked()), this, SLOT(pause())); connect(_ui->reset, SIGNAL(clicked()), this, SLOT(reset())); connect(_updater, SIGNAL(timeout()), this, SLOT(updateLabel())); connect(_timer, SIGNAL(timeout()), this, SLOT(reset())); connect(_timer, SIGNAL(timeout()), this, SLOT(alarm())); connect(_timer, SIGNAL(timeout()), _mediaObject, SLOT(play())); connect(_ui->reset, SIGNAL(clicked()), _mediaObject, SLOT(stop())); connect(_ui->settings, SIGNAL(clicked()), _settings, SLOT(showMaximized())); connect(_editor, SIGNAL(accepted()), this, SLOT(setCounter())); }
void YubikoOtpKeyConfig::load() { BOOST_LOG_NAMED_SCOPE("YubikoOtpKeyConfig::load"); const string myInFile = checkFileName(false); ptree myTree; read_json(myInFile, myTree); const string myVer(myTree.get<string>(K_NM_DOC_VERS)); BOOST_LOG_TRIVIAL(info)<< K_NM_VERS << ":" << myVer; setPrivateId(myTree.get<string>(K_NM_DOC_PRIV_ID)); setPublicId(myTree.get<string>(K_NM_DOC_PUB_ID)); setSecretKey(myTree.get<string>(K_NM_DOC_SEC_KEY)); setTimestamp(UTimestamp(myTree.get<uint64_t>(K_NM_DOC_TIMESTAMP))); setCounter(myTree.get<uint8_t>(K_NM_DOC_SES_CNTR)); setCrc(myTree.get<uint16_t>(K_NM_DOC_CRC)); setRandom(myTree.get<uint16_t>(K_NM_DOC_RANDOM)); setUseCounter(myTree.get<uint8_t>(K_NM_DOC_USE_CNTR)); setDescription(myTree.get<string>(K_NM_DOC_DESC)); if (myVer != "0.0.1") { const string mySysUser { myTree.get<string>(K_NM_DOC_SYS_USER) }; if (!mySysUser.empty()) setSysUser(mySysUser); } itsChangedFlag = false; }
void DutyUnit::nr1Change(const unsigned newNr1, const unsigned long cc) { updatePos(cc); setDuty(newNr1); setCounter(); }
void DutyUnit::reviveCounter(unsigned long const cc) { updatePos(cc); enableEvents_ = true; setCounter(); }
void DutyUnit::killCounter() { enableEvents_ = false; setCounter(); }
void DutyUnit::reset() { pos_ = 0; high_ = false; nextPosUpdate_ = counter_disabled; setCounter(); }
void DutyUnit::reviveCounter(const unsigned long cc) { updatePos(cc); high = toOutState(duty, pos); enableEvents = true; setCounter(); }
void DutyUnit::nr1Change(unsigned newNr1, unsigned long cc) { updatePos(cc); duty_ = newNr1 >> 6; setCounter(); }
void Countimer::setCounter(uint8_t hours, uint8_t minutes, uint8_t seconds, CountType countType, timer_callback onComplete) { _onComplete = onComplete; _countType = countType; setCounter(hours, minutes, seconds); }
void StickersBox::CounterWidget::updateCounter() { setCounter(Global::FeaturedStickerSetsUnreadCount()); update(); }
void Encoder::reset() { setCounter(0); }
void CmdEquation(int code) /****************************************************************************** purpose : Handle everything associated with equations ******************************************************************************/ { char *pre, *eq, *post; int inline_equation, number, true_code; true_code = code & ~ON; if (!(code & ON)) return ; SlurpEquation(code,&pre,&eq,&post); diagnostics(4, "Entering CmdEquation --------%x\n<%s>\n<%s>\n<%s>",code,pre,eq,post); inline_equation = (true_code == EQN_MATH) || (true_code == EQN_DOLLAR) || (true_code == EQN_RND_OPEN); number=getCounter("equation"); if (g_equation_comment) WriteEquationAsComment(pre,eq,post); diagnostics(4,"inline=%d inline_bitmap=%d",inline_equation,g_equation_inline_bitmap); diagnostics(4,"inline=%d display_bitmap=%d",inline_equation,g_equation_display_bitmap); diagnostics(4,"inline=%d inline_rtf =%d",inline_equation,g_equation_inline_rtf); diagnostics(4,"inline=%d display_rtf =%d",inline_equation,g_equation_display_rtf); if ((inline_equation && g_equation_inline_bitmap) || (!inline_equation && g_equation_display_bitmap) ) { if (true_code != EQN_ARRAY) { PrepareRtfEquation(true_code,FALSE); WriteLatexAsBitmap(pre,eq,post); FinishRtfEquation(true_code,FALSE); } else { char *s, *t; s=eq; diagnostics(4,"eqnarray whole = <%s>",s); do { t=strstr(s,"\\\\"); if (t) *t = '\0'; diagnostics(4,"eqnarray piece = <%s>",s); if (strstr(s,"\\nonumber")) g_suppress_equation_number = TRUE; else g_suppress_equation_number = FALSE; PrepareRtfEquation(true_code,FALSE); WriteLatexAsBitmap("\\begin{eqnarray*}",s,"\\end{eqnarray*}"); FinishRtfEquation(true_code,FALSE); if (t) s = t+2; } while (t); } } if ((inline_equation && g_equation_inline_rtf) || (!inline_equation && g_equation_display_rtf) ) { setCounter("equation",number); WriteEquationAsRTF(true_code,&eq); } /* balance \begin{xxx} with \end{xxx} call */ if (true_code == EQN_MATH || true_code == EQN_DISPLAYMATH || true_code == EQN_EQUATION || true_code == EQN_EQUATION_STAR || true_code == EQN_ARRAY || true_code == EQN_ARRAY_STAR ) ConvertString(post); free(pre); free(eq); free(post); }
void DutyUnit::setFreq(unsigned newFreq, unsigned long cc) { updatePos(cc); period_ = toPeriod(newFreq); setCounter(); }