void Player::onShowFrame(int position, double fps, int in, int out, int length, bool isPlaying) { m_duration = length; MLT.producer()->set("length", length); m_durationLabel->setText(QString(MLT.producer()->get_length_time()).prepend(" / ")); m_scrubber->setFramerate(fps); m_scrubber->setScale(m_duration); if (position < m_duration) { m_position = position; m_positionSpinner->blockSignals(true); m_positionSpinner->setValue(position); m_positionSpinner->blockSignals(false); m_scrubber->onSeek(position); } if (m_isMeltedPlaying == -1 || isPlaying != m_isMeltedPlaying) { m_isMeltedPlaying = isPlaying; if (isPlaying) { actionPlay->setIcon(m_pauseIcon); actionPlay->setText(tr("Pause")); actionPlay->setToolTip(tr("Pause playback (K)")); } else { actionPlay->setIcon(m_playIcon); actionPlay->setText(tr("Play")); actionPlay->setToolTip(tr("Start playback (L)")); } } m_previousIn = in; m_previousOut = out; m_scrubber->blockSignals(true); setIn(in); setOut(out); m_scrubber->blockSignals(false); }
void Player::onMeltedUnitOpened() { m_isMeltedPlaying = -1; // unknown m_duration = MLT.producer()->get_length(); m_isSeekable = true; MLT.producer()->set("ignore_points", 1); m_scrubber->setFramerate(MLT.profile().fps()); m_scrubber->setScale(m_duration); m_scrubber->setMarkers(QList<int>()); m_inPointLabel->setText("--:--:--:-- / "); m_selectedLabel->setText("--:--:--:--"); m_durationLabel->setText(QString(MLT.producer()->get_length_time()).prepend(" / ")); m_previousIn = MLT.producer()->get_in(); m_scrubber->setEnabled(true); m_scrubber->setInPoint(m_previousIn); m_previousOut = MLT.producer()->get_out(); m_scrubber->setOutPoint(m_previousOut); m_positionSpinner->setEnabled(m_isSeekable); onVolumeChanged(m_volumeSlider->value()); m_savedVolume = MLT.volume(); onMuteButtonToggled(Settings.playerMuted()); actionPlay->setEnabled(true); actionSkipPrevious->setEnabled(m_isSeekable); actionSkipNext->setEnabled(m_isSeekable); actionRewind->setEnabled(m_isSeekable); actionFastForward->setEnabled(m_isSeekable); setIn(-1); setOut(-1); setFocus(); }
NConcept_(NConcept* o) : o_(o){ setIn(true); setOut(false); setConst(false); undefLength(); setPoly(false); setEnabled(true); }
int main(int argc, char *argv[]){ char *outputfilename = NULL; char *inputfilenames[10]; int inputnum = 0; if(argc == 1){ fprintf(stderr, "ERROR: not enough parameters\n"); }else{ while(--argc > 0){ char *param = *++argv; if(strcmp(param, "-o") == 0){ argc--; outputfilename = malloc(strlen(*++argv)+1); strcpy(outputfilename, *argv); }else{ *(inputfilenames+inputnum) = malloc(strlen(param)+1); strcpy(*(inputfilenames+inputnum), param); inputnum++; } } FILE *outputfile = NULL; if(outputfilename == NULL) outputfile = stdout; else outputfile = fopen(outputfilename, "w"); int i = 0; while(i < inputnum){ char *filename = *(inputfilenames + i); FILE *file = fopen(filename, "r"); int tokenname; fprintf(outputfile, "file %s\n", filename); setIn(file); while((tokenname=yylex()) != EOF){ fprintf(outputfile, "<%d,%s>\n", tokenname, yytext); //switch(tokenname){ // case OP: // case ID: // fprintf(outputfile, "<%d,%s,%d>\n", tokenname, yytext, yylval); // break; // case ASSIGN: // case NUM: // fprintf(outputfile, "<%d,%s>\n", tokenname, yytext); // break; // default: // ; //} } fclose(file); free(filename); i++; } free(outputfilename); fclose(outputfile); } return 0; }
char battery_status() { char stat = 0; setIn(CHARGE_STATUS_PIN); setHigh(CHARGE_STATUS_PIN); _delay_ms(10); if(!getPin(CHARGE_STATUS_PIN)) stat = 1; setLow(CHARGE_STATUS_PIN); _delay_ms(10); if(getPin(CHARGE_STATUS_PIN)) stat = 2; return stat; }
void rpc_client(int nlhs, uint8_t** lhs_serial, size_t* lhs_sizes, int nrhs, uint8_t** rhs_serial, size_t* rhs_sizes, const char* host_port) { capnp::EzRpcClient client(host_port, 2360); auto& waitScope = client.getWaitScope(); Call::Client cap = client.importCap<Call>("call"); capnp::MallocMessageBuilder message; // Make RHS argument list ArgList::Builder in = message.initRoot<ArgList>(); capnp::List<ArgList::Arg>::Builder arg_list = in.initArgs(nrhs); for (size_t i = 0; i < (unsigned int) nrhs; ++i) { arg_list[i].setSize(rhs_sizes[i]); arg_list[i].setData(capnp::Data::Reader(reinterpret_cast<const unsigned char*>(rhs_serial[i]), rhs_sizes[i] * sizeof(uint8_t))); } in.setType(ArgList::Type::RIGHT); // Make request auto request = cap.callRequest(); request.setOut_size(nlhs); request.setIn(in); auto promise = request.send(); auto response = promise.wait(waitScope); auto out = response.getOut(); // Populate lhs_serial and lhs_sizes capnp::List<ArgList::Arg>::Reader out_list = out.getArgs(); for (size_t i = 0; i < (unsigned int) nlhs; ++i) { capnp::Data::Reader out_arg = out_list[i].getData(); size_t num_els = out_list[i].getSize(); lhs_serial[i] = new uint8_t[num_els]; lhs_sizes[i] = num_els; memcpy(lhs_serial[i], out_arg.begin(), num_els * sizeof(uint8_t)); } }
void hardware_lightning_enable() { // Need to power off lights // backlightVal = lcd.getBacklight(); lcd.backlight(0); if(backlightVal > 0) _delay_ms(50); setIn(LIGHT_SENSE_PIN); // set to input setLow(LIGHT_SENSE_PIN); // no pull-up uint8_t i = 3; while(i--) { hardware_light_enable(i); _delay_ms(50); uint16_t reading = hardware_analogRead(0); //DEBUG('('); //DEBUG(reading); //DEBUG(')'); //DEBUG(':'); //DEBUG(' '); //DEBUG_NL(); if(reading < 256) break; } //DEBUG(i); //if(getPin(LIGHT_SENSE_PIN)) { // DEBUG(STR("+")); //} //else //{ // DEBUG(STR("-")); //} shutter_half(); EIMSK &= ~_BV(INT6); // Interrupt disable EICRB |= (1<<ISC61)|(1<<ISC60); // Rising edge EIMSK |= _BV(INT6); // Interrupt enable }
void obj_to_game(OBJ_DATA *obj) { if(setIn(object_set, obj)) return; // property table, for lookup by python if(!obj_exists(obj)) obj_exist(obj); // set and list storage, for objects physically 'in' the game listPut(object_list, obj); setPut(object_set, obj); // execute all of our to_game hooks hookRun("obj_to_game", hookBuildInfo("obj", obj)); // also add all contents if(listSize(objGetContents(obj)) > 0) { LIST_ITERATOR *cont_i = newListIterator(objGetContents(obj)); OBJ_DATA *cont = NULL; ITERATE_LIST(cont, cont_i) obj_to_game(cont); deleteListIterator(cont_i); } }
void Player::setOut(int pos) { m_scrubber->setOutPoint(pos); if (pos >= 0 && pos < m_previousIn) setIn(0); }