//********************************************************* void PenaltyShotUsPivot2002Transition::executePlayTransition(VisionData& field, RobocupStrategyData* rsd, BasePlay* currentPlay) { if(currentPlay->readTimer() >= TIMEOUT) { setPlay(JamAndShoot::playNum, rsd); } //when aggressor is finished, go to upfield defense. RobotIndex AggressorID = rsd->getRobotByPosition(AGGRESSOR); if(AggressorID != NO_ROBOT) { SkillSet* skills = rsd->getStrategyModule().getSkillSet(AggressorID); Skill* skill = skills->getSkill(PenaltyShotUsAimAndShootSkill::skillNum); if(skill->isFinished()) { setPlay(UpfieldDefense::playNum, rsd); } } else { setPlay(UpfieldDefense::playNum, rsd); } }
void MqttBridge::received(const QMQTT::Message &message){ //Now we have to pass on the different command to the DBUS command //That will be done by emitting signals, as we have no //knowlege of the dBus class, We will try to have a clean interface qDebug()<<"Message Topic and payload "<<message.topic() << message.payload(); if (message.topic()==mediaPlayCommand) emit setPlay(); else if (message.topic()==mediaNextCommand) emit setNext(); else if (message.topic()==mediaPrevCommand) emit setPrevious(); else if (message.topic()==mediaVolumeCommand) { double volume = message.payload().toDouble()/100; emit setVolume(volume); } else if (message.topic()==mediaPlayIdCommand) { QDBusObjectPath _path; _path.setPath(message.payload()); emit setPlayId(_path); } else if (message.topic()==mediaPlayPauseCommand) emit setPlayPause(); else if (message.topic()==mediaRepeatCommand){ if (message.payload()=="0") emit setLoop("None"); else emit setLoop("Playlist"); } else if (message.topic()==mediaMixCommand){ if (message.payload()=="0") emit setShuffle(false); else emit setShuffle(true); } }
void MainWindow::setup() { currentTime = 0; this->ui->horizontalSlider->setRange(0, (int) (engine->getFinishTime() / SLIDER_RATIO)); this->ui->horizontalSlider->setEnabled(true); setPlay(true); }
bool Fermata::readProperties(XmlReader& e) { const QStringRef& tag(e.name()); if (tag == "subtype") { QString s = e.readElementText(); SymId id = Sym::name2id(s); setSymId(id); } else if ( tag == "play") setPlay(e.readBool()); else if (tag == "timeStretch") _timeStretch = e.readDouble(); else if (tag == "offset") { if (score()->mscVersion() > 114) Element::readProperties(e); else e.skipCurrentElement(); // ignore manual layout in older scores } else if (Element::readProperties(e)) ; else return false; return true; }
bool Fermata::setProperty(Pid propertyId, const QVariant& v) { switch (propertyId) { case Pid::PLACEMENT: { Placement p = Placement(v.toInt()); if (p != placement()) { QString s = Sym::id2name(_symId); bool up = placeAbove(); if (s.endsWith(up ? "Above" : "Below")) { QString s2 = s.left(s.size() - 5) + (up ? "Below" : "Above"); _symId = Sym::name2id(s2); } setPlacement(p); } } break; case Pid::PLAY: setPlay(v.toBool()); break; case Pid::TIME_STRETCH: setTimeStretch(v.toDouble()); score()->fixTicks(); break; default: return Element::setProperty(propertyId, v); } triggerLayout(); return true; }
void SDLAudioDev::open(bool start_play) { if(running) { D_MSG("device already running"); return; } open_spec = wanted; work = SDL_OpenAudio(&wanted, &obtained); if(obtained.freq!=wanted.freq || obtained.format!=wanted.format || obtained.channels!=wanted.channels || obtained.samples!=wanted.samples) { D_ERROR("unable to get wanted format, continue"); } if(work==-1) { D_ERROR("failed to open audio"); D_MSG(SDL_GetError()); } else { setPlay(start_play); running=true; } }
Fermata::Fermata(Score* s) : Element(s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { setPlacement(Placement::ABOVE); _symId = SymId::noSym; _timeStretch = 1.0; setPlay(true); }
void MainWindow::togglePlay() { if (!engine) return; if (currentTime >= engine->getFinishTime()) setup(); else setPlay(!isPlaying); }
void SDLAudioDev::close() { if(!running) { D_MSG("device not open"); return; } setPlay(false); SDL_CloseAudio(); running=false; }
//********************************************************* void DoublePickOffenseTransition::executePlayTransition(VisionData& field, RobocupStrategyData* rsd, BasePlay* currentPlay) { if(rsd->getRobotByPosition(AGGRESSOR) != NO_ROBOT) { Pair ball=rsd->getOffensiveBallLocation(); SkillSet* skills = rsd->getStrategyModule().getSkillSet (rsd->getRobotByPosition(AGGRESSOR)); DribblePickScoreSkill* skillHandle = (DribblePickScoreSkill*)skills->getSkill(DribblePickScoreSkill::skillNum); //If no robot (But blocker) has possesion of ball //then go to upfield defense RobotIndex activeRobotID; if(!weHavePossession(field,rsd->getMutableSystemParams(),*rsd, &activeRobotID) || activeRobotID == rsd->getRobotByPosition(BLOCKER) || activeRobotID == rsd->getRobotByPosition(DEFENDER)) { setPlay(UpfieldDefense::playNum, rsd); } //if aggressor finished, go to single assist else if(skillHandle->isFinished(FINISH_DIST) || ball.getX() <= rsd->getSystemParams().field.HALF_LINE) { setPlay(SingleAssistOffense::playNum, rsd); } //else if max time elapsed, go to jam and shoot else if(currentPlay->readTimer() >= MAX_ELAPSED_TIME) { setPlay(JamAndShoot::playNum, rsd); } } else { setPlay(UpfieldDefense::playNum, rsd); } }
void CrossCreasePassTransition::executePlayTransition(VisionData& field, RobocupStrategyData* rsd, BasePlay* currentPlay) { if(rsd->getRobotByPosition(AGGRESSOR) != NO_ROBOT) { SkillSet* skills = rsd->getStrategyModule().getSkillSet (rsd->getRobotByPosition(AGGRESSOR)); CrossCreasePassSkill* skillHandle = (CrossCreasePassSkill*)skills->getSkill(CrossCreasePassSkill::skillNum); RobotIndex activeRobotID; //If no robot (But blocker) has possesion of ball //then go to upfield defense if(!weHavePossession(field,rsd->getMutableSystemParams(),*rsd, &activeRobotID) || activeRobotID == rsd->getRobotByPosition(BLOCKER) || activeRobotID == rsd->getRobotByPosition(DEFENDER)) { setPlay(UpfieldDefense::playNum, rsd); } //if aggressor finished, go to touch shoot else if(skillHandle->isFinished(0.0f)) { setPlay(TouchShoot::playNum, rsd); } //else if max time elapsed, go to jam and shoot else if(currentPlay->readTimer() >= MAX_ELAPSED_TIME) { setPlay(JamAndShoot::playNum, rsd); } } else { setPlay(UpfieldDefense::playNum, rsd); } }
void MainWindow::update() { if (!engine) return; if (currentTime >= engine->getFinishTime()) { setPlay(false); return; } currentTime += INTERVAL; ui->subtitleLabel->setText(getSubtitle(false)); ui->timeLabel->setText((SrtEngine::millisToTimeString(currentTime) + " / " + SrtEngine::millisToTimeString(engine->getFinishTime()))); ui->horizontalSlider->setValue((int) (currentTime / SLIDER_RATIO)); }
bool TremoloBar::setProperty(Pid propertyId, const QVariant& v) { switch (propertyId) { case Pid::LINE_WIDTH: lineWidthStyle = PropertyFlags::UNSTYLED; setLineWidth(v.value<Spatium>()); break; case Pid::MAG: setUserMag(v.toDouble()); break; case Pid::PLAY: setPlay(v.toBool()); score()->setPlaylistDirty(); break; default: return Element::setProperty(propertyId, v); } score()->setLayoutAll(); return true; }
void TremoloBar::read(XmlReader& e) { while (e.readNextStartElement()) { auto tag = e.name(); if (tag == "point") { PitchValue pv; pv.time = e.intAttribute("time"); pv.pitch = e.intAttribute("pitch"); pv.vibrato = e.intAttribute("vibrato"); _points.append(pv); e.readNext(); } else if (tag == "mag") _userMag = e.readDouble(0.1, 10.0); else if (tag == "lineWidth") setLineWidth(Spatium(e.readDouble())); else if (tag == "play") setPlay(e.readInt()); else e.unknown(); } }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: setPlay(); break; case 1: setPause(); break; case 2: changeSide(); break; case 3: setPenalty(); break; case 4: setFreekick(); break; case 5: setGoalkick(); break; case 6: setFreeball(); break; case 7: setInicialPosition(); break; case 8: cleanFutRobot(); break; default: ; } _id -= 9; } return _id; }
//-------------------------------------------------------------- bool Video::processOscMessage(const ofxOscMessage& message) { // call the base class if(DrawableObject::processOscMessage(message)) { return true; } else if(message.getAddress() == oscRootAddress + "/play") { bool b = bPlay; if(tryBool(message, b, 0)) { setPlay(b); } return true; } else if(message.getAddress() == oscRootAddress + "/volume") { float v = 0; if(tryNumber(message, v, 0)) { setVolume(v); } return true; } else if(message.getAddress() == oscRootAddress + "/speed") { float s = 0; if(tryNumber(message, s, 0)) { setSpeed(s); } return true; } else if(message.getAddress() == oscRootAddress + "/loop") { unsigned int l = (unsigned int) OF_LOOP_NONE; if(tryNumber(message, l, 0)) { setLoop((ofLoopType) l); } return true; } if(message.getAddress() == oscRootAddress + "/position") { tryNumber(message, pos.x, 0); tryNumber(message, pos.y, 1); return true; } else if(message.getAddress() == oscRootAddress + "/position/x") { tryNumber(message, pos.x, 0); return true; } else if(message.getAddress() == oscRootAddress + "/position/y") { tryNumber(message, pos.y, 0); return true; } else if(message.getAddress() == oscRootAddress + "/size") { tryNumber(message, width, 0); tryNumber(message, height, 1); return true; } else if(message.getAddress() == oscRootAddress + "/size/width") { tryNumber(message, width, 0); return true; } else if(message.getAddress() == oscRootAddress + "/size/height") { tryNumber(message, height, 0); return true; } else if(message.getAddress() == oscRootAddress + "/center") { tryBool(message, bDrawFromCenter, 0); return true; } return false; }