void Tuplet::layout() { if (_elements.empty()) { qDebug("Tuplet::layout(): tuplet is empty"); return; } // is in a TAB without stems, skip any format: tuplets are not shown if (staff() && staff()->isTabStaff() && staff()->staffType()->slashStyle()) return; qreal _spatium = spatium(); if (_numberType != NumberType::NO_TEXT) { if (_number == 0) { _number = new Text(score()); _number->setTextStyleType(TextStyleType::TUPLET); _number->setTrack(track()); _number->setParent(this); _number->setVisible(visible()); } if (_numberType == NumberType::SHOW_NUMBER) _number->setText(QString("%1").arg(_ratio.numerator())); else _number->setText(QString("%1:%2").arg(_ratio.numerator()).arg(_ratio.denominator())); } else { if (_number) { if (_number->selected()) score()->deselect(_number); delete _number; _number = 0; } } // // find out main direction // if (_direction == MScore::Direction::AUTO) { int up = 1; foreach (const DurationElement* e, _elements) { if (e->type() == Element::Type::CHORD) { const Chord* c = static_cast<const Chord*>(e); if (c->stemDirection() != MScore::Direction::AUTO) up += c->stemDirection() == MScore::Direction::UP ? 1000 : -1000; else up += c->up() ? 1 : -1; } else if (e->type() == Element::Type::TUPLET) { // TODO } } _isUp = up > 0; }
int TextTrackCue::calculateComputedLinePosition() { // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-computed-line-position // If the text track cue line position is numeric, then that is the text // track cue computed line position. if (m_linePosition != undefinedPosition) return m_linePosition; // If the text track cue snap-to-lines flag of the text track cue is not // set, the text track cue computed line position is the value 100; if (!m_snapToLines) return 100; // Otherwise, it is the value returned by the following algorithm: // If cue is not associated with a text track, return -1 and abort these // steps. if (!track()) return -1; // Let n be the number of text tracks whose text track mode is showing or // showing by default and that are in the media element's list of text // tracks before track. // FIXME: Add a method to cache the track index considering only // rendered tracks (that have showing or showing by default mode set). // http://wkb.ug/93779 int n = track()->trackIndex(); // Increment n by one. n++; // Negate n. n = -n; return n; }
pair<long long,long long> getmcmf(int sz,int source,int sink,int times){ pair<long long,long long> res; res.first=0;res.second=0;n=sz; if(!times) times=-1; while(times){ spfa(source,sink); if(d[sink][1] == 0) break; res.first += d[sink][1]; res.second += d[sink][0] * d[sink][1]; track(sink,source,(int)d[sink][1]); times--; } return res; }
int TimelineDock::clipCount(int trackIndex) const { if (trackIndex < 0) trackIndex = currentTrack(); if (trackIndex >= 0 && trackIndex < m_model.trackList().size()) { int i = m_model.trackList().at(trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(i)); if (track) { Mlt::Playlist playlist(*track); return playlist.count(); } } return 0; }
QVariant Fermata::propertyDefault(Pid propertyId) const { switch (propertyId) { case Pid::PLACEMENT: return int(track() & 1 ? Placement::BELOW : Placement::ABOVE); case Pid::TIME_STRETCH: return 1.0; // articulationList[int(articulationType())].timeStretch; case Pid::PLAY: return true; default: break; } return Element::propertyDefault(propertyId); }
ChordRest::ChordRest(const ChordRest& cr, bool link) : DurationElement(cr) { _durationType = cr._durationType; _staffMove = cr._staffMove; _beam = 0; _tabDur = 0; // tab sur. symb. depends upon context: can't be // simply copied from another CR for (Articulation* a : cr._articulations) { // make deep copy Articulation* na = new Articulation(*a); if (link) na->linkTo(a); na->setParent(this); na->setTrack(track()); _articulations.append(na); } _beamMode = cr._beamMode; _up = cr._up; _small = cr._small; _crossMeasure = cr._crossMeasure; _space = cr._space; for (Lyrics* l : cr._lyricsList) { // make deep copy if (l == 0) { _lyricsList.append(0); continue; } Lyrics* nl = new Lyrics(*l); if (link) nl->linkTo(l); nl->setParent(this); nl->setTrack(track()); _lyricsList.append(nl); } }
void Projectile::update(int milliseconds) { lifeTime_ -= milliseconds; if (alive_) { //Turn off penetration if (penetration_ < 0) { body_->GetFixtureList()->SetSensor(false); } if (lastPen_.z != 0) { forceCallback_(b2Vec2(lastPen_.x, lastPen_.y), force_.force, force_.radius, force_.lifeTime, faction_); lastPen_.z = 0; } if (tracking_.radius != 0 && tracking_.speed != 0) { track(); } if (target_.z != 0) { b2Vec2 dir = b2Vec2(body_->GetPosition().x - target_.x, body_->GetPosition().y - target_.y); orient(dir); } b2Vec2 vel = body_->GetLinearVelocity(); body_->SetTransform(body_->GetPosition(), atan2f(-vel.x, vel.y)); //std::cout << vel.Length() << std::endl; if ((bounce_ <= 0 && vel.Length() <= 0) || hp_ <= 0 || lifeTime_ <= 0) { alive_ = false; } } //Do our force once before we deactivate else if (alive_ == false && active_ == true) { forceCallback_(body_->GetPosition(), force_.force, force_.radius, force_.lifeTime, faction_); active_ = false; } else active_ = false; }
void apply_track(int **input,int **tracked,int width, int height, int lowthresh,int highthresh) { int i,j; int **marked; d_w = width; d_h = height; //int [][] tracked = new int[d_w][d_h]; marked= new int* [d_w]; for (i=0;i<d_w;i++) marked[i]=new int [d_h]; std::stack<int> to_track; //Initialise the marked array for( i = 0; i < d_w; i++){ for( j = 0; j < d_h; j++){ marked[i][j] = 0; } } //Now find all the starting points for the tracking for( i = 0; i < d_w; i++){ for( j = 0; j < d_h; j++){ //If the point is unmarked and above high threshold then track if((input[i][j] > highthresh) && (marked[i][j] == 0)){ track(input, marked, to_track, lowthresh, i, j); } } } //Now clear all the pixels in the input which are unmarked for( i = 0; i < d_w; i++){ for( j = 0; j < d_h; j++){ if(marked[i][j] == 0){ tracked[i][j] = 0; } else { tracked[i][j] = input[i][j]; } } } for(i=0;i<d_w;i++) delete(marked[i]); delete(marked); }
/* 0.15 requires we track calloc too */ void* calloc(size_t nmemb, size_t sz) { if (!next_calloc) { extern void* __libc_calloc(size_t nmemb, size_t sz); return __libc_calloc(nmemb, sz); /* avoid infinite regress */ } if (test_mode == 2) check(); void* ptr = next_calloc(nmemb, sz); if (test_mode >= 0) track(1, sz, ptr); return ptr; }
void* malloc(size_t sz) { if (!next_malloc) { next_malloc = dlsym(RTLD_NEXT, "malloc"); next_calloc = dlsym(RTLD_NEXT, "calloc"); } if (test_mode == 2) check(); void* ptr = next_malloc(sz); if (test_mode >= 0) track(1, sz, ptr); return ptr; }
/* * salvage -- * A single salvage. */ static void salvage(void) { WT_CONNECTION *conn; WT_DECL_RET; WT_SESSION *session; conn = g.wts_conn; track("salvage", 0ULL, NULL); testutil_check(conn->open_session(conn, NULL, NULL, &session)); if ((ret = session->salvage(session, g.uri, "force=true")) != 0) testutil_die(ret, "session.salvage: %s", g.uri); testutil_check(session->close(session, NULL)); }
bool ObjectTrackerRos<Tracker>::run_once() { if (!obsrv_updated_) return false; Obsrv obsrv; sensor_msgs::Image ros_image; { std::lock_guard<std::mutex> lock_obsrv(obsrv_mutex_); ros_image = current_ros_image_; obsrv_updated_ = false; } track(ros_image); return true; }
// ignores gap range void track_local(int row, int col) const { if (row == -1 || col == -1) { return; } int min_row = row; int min_col = col; find_opt(min_row, min_col); if (at(min_row, min_col) == 0) { return; } // go right to col for (int j = min_col; j <= col; j++) { track(min_row, j) = COL_INC; } // go bottom to row for (int i = min_row; i <= row; i++) { track(i, col) = ROW_INC; } while (at(min_row, min_col) < 0) { go_prev(min_row, min_col); ASSERT_TRUE(in(min_row, min_col)); } track_local(min_row, min_col); }
TEST_F(testLHCNoiseFB, track1) { auto long_tracker = new RingAndRfSection(); auto lhcnfb = new LHCNoiseFB(1.0, 0.1, 0.9, 1); f_vector_t res; for (uint i = 0; i < 100; ++i) { long_tracker->track(); Context::Slice->track(); lhcnfb->track(); res.push_back(lhcnfb->fX); } auto params = std::string(TEST_FILES) + "/LHCNoiseFB/track/test1/"; f_vector_t v; util::read_vector_from_file(v, params + "x.txt"); // util::dump(lhcnfb->fG, "fG\n"); ASSERT_EQ(v.size(), res.size()); auto epsilon = 1e-8; for (unsigned int i = 0; i < v.size(); ++i) { auto ref = v[i]; auto real = res[i]; ASSERT_NEAR(ref, real, epsilon * std::max(fabs(ref), fabs(real))) << "Testing of fX failed on i " << i << std::endl; } delete lhcnfb; delete long_tracker; }
TEST_F(testSlices, n_macroparticles) { auto Slice = Context::Slice; //RingAndRfSection *long_tracker = new RingAndRfSection(); //long_tracker->track(0, Beam->n_macroparticles); Slice->track(); //util::dump(Slice->n_macroparticles, 100, "something\n"); std::vector<ftype> v; util::read_vector_from_file(v, track_params + "n_macroparticles"); for (unsigned int i = 0; i < v.size(); ++i) { ftype ref = v[i]; ftype real = Slice->n_macroparticles[i]; ASSERT_NEAR(ref, real, epsilon * std::max(fabs(ref), fabs(real))); } }
int TimelineDock::clipIndexAtPosition(int trackIndex, int position) { int result = -1; if (trackIndex < 0) trackIndex = currentTrack(); if (trackIndex >= 0 && trackIndex < m_model.trackList().size()) { int i = m_model.trackList().at(trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(i)); if (track) { Mlt::Playlist playlist(*track); result = playlist.get_clip_index_at(position); } } return result; }
void HTMLTrackElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == srcAttr) { if (!value.isEmpty()) scheduleLoad(); else if (m_track) m_track->removeAllCues(); // 4.8.10.12.3 Sourcing out-of-band text tracks // As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly... } else if (name == kindAttr) { track()->setKind(value.lower()); } else if (name == labelAttr) { track()->setLabel(value); } else if (name == srclangAttr) { track()->setLanguage(value); } else if (name == idAttr) { track()->setId(value); } else if (name == defaultAttr) { track()->setIsDefault(!value.isNull()); } HTMLElement::parseAttribute(name, value); }
int main() { #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) && (defined(VISP_HAVE_DC1394_2) || defined(VISP_HAVE_CMU1394)) vpImage<unsigned char> I; #if defined(VISP_HAVE_DC1394_2) vp1394TwoGrabber g; #elif defined(VISP_HAVE_CMU1394) vp1394CMUGrabber g; #endif g.open(I); // Parameters of our camera vpCameraParameters cam(840, 840, I.getWidth()/2, I.getHeight()/2); // The pose container vpHomogeneousMatrix cMo; std::vector<vpDot2> dot(4); std::vector<vpPoint> point(4); double L = 0.06; point[0].setWorldCoordinates(-L, -L, 0); point[1].setWorldCoordinates( L, -L, 0); point[2].setWorldCoordinates( L, L, 0); point[3].setWorldCoordinates(-L, L, 0); bool init = true; #if defined(VISP_HAVE_X11) vpDisplayX d(I); #elif defined(VISP_HAVE_GDI) vpDisplayGDI d(I); #endif while(1){ // Image Acquisition g.acquire(I); vpDisplay::display(I); track(I, dot, init); computePose(point, dot, cam, init, cMo); vpDisplay::displayFrame(I, cMo, cam, 0.05, vpColor::none, 3); vpDisplay::flush(I); if (init) init = false; // turn off the initialisation specific stuff if (vpDisplay::getClick(I, false)) break; } #endif }
//----------------------------------------------------------------------------------- void WireAabb::setToAabb( const Aabb &aabb ) { if( mTrackedObject ) track( (MovableObject*)0 ); if( !mParentNode ) { //We need a node of our own. SceneNode *newNode = mManager->getRootSceneNode()->createChildSceneNode(); newNode->attachObject( this ); } setVisible( true ); mParentNode->setPosition( aabb.mCenter ); mParentNode->setScale( aabb.mHalfSize ); }
void VTTCue::updateDisplayTree(double movieTime) { // The display tree may contain WebVTT timestamp objects representing // timestamps (processing instructions), along with displayable nodes. if (!track()->isRendered()) return; // Clear the contents of the set. m_cueBackgroundBox->removeChildren(); // Update the two sets containing past and future WebVTT objects. RefPtrWillBeRawPtr<DocumentFragment> referenceTree = createCueRenderingTree(); markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); m_cueBackgroundBox->appendChild(referenceTree, ASSERT_NO_EXCEPTION); }
void TextTrackCue::updateDisplayTree(float movieTime) { // The display tree may contain WebVTT timestamp objects representing // timestamps (processing instructions), along with displayable nodes. if (!track()->isRendered()) return; // Clear the contents of the set. m_allDocumentNodes->removeChildren(); // Update the two sets containing past and future WebVTT objects. RefPtr<DocumentFragment> referenceTree = createCueRenderingTree(); markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); m_allDocumentNodes->appendChild(referenceTree); }
Element* Bracket::drop(const DropData& data) { Element* e = data.element; if (e->type() == BRACKET) { Bracket* b = static_cast<Bracket*>(e); b->setParent(parent()); b->setTrack(track()); b->setSpan(span()); b->setLevel(level()); score()->undoRemoveElement(this); score()->undoAddElement(b); return b; } delete e; return 0; }
void registerClient(boost::shared_ptr<Client> &client) { typedef boost::signals2::signal<void (const Item&)> signal_type; typedef signal_type::slot_type slot_type; // create a slot. bind is not needed. slot constructor wiht more than one // argument passes automatically its parametrs to boost::bind. auto slot = slot_type(&Client::consume, client.get(), _1); slot.track(client); // slot will disconnect automatically when the tracked // object expires. slot::track() can be only used for // boost::shared_ptr objects, not for std::shared_ptr // objects. signalDeliverItem.connect(slot); // tracking has to be set before connecting }
void TextLineBaseSegment::draw(QPainter* painter) const { TextLineBase* tl = textLineBase(); qreal _spatium = spatium(); // color for line (text color comes from the text properties) QColor color; if (selected() && !(score() && score()->printing())) color = (track() > -1) ? MScore::selectColor[voice()] : MScore::selectColor[0]; else if (!tl->visible() || !tl->lineVisible()) color = Qt::gray; else color = tl->lineColor(); if (!_text->empty()) { painter->translate(_text->pos()); _text->setVisible(tl->visible()); _text->draw(painter); painter->translate(-_text->pos()); } if (!_endText->empty()) { painter->translate(_endText->pos()); _endText->setVisible(tl->visible()); _endText->draw(painter); painter->translate(-_endText->pos()); } if (npoints == 0) return; qreal textlineLineWidth = tl->lineWidth().val() * _spatium; QPen pen(color, textlineLineWidth, tl->lineStyle()); if (tl->lineStyle() == Qt::CustomDashLine) { QVector<qreal> dashes { tl->dashLineLen(), tl->dashGapLen() }; pen.setDashPattern(dashes); } painter->setPen(pen); if (twoLines) { // hairpins painter->drawLines(&points[0], 1); painter->drawLines(&points[2], 1); } else { for (int i = 0; i < npoints; ++i) painter->drawLines(&points[i], 1); } }
void TextTrackCue::updateDisplayTree(float movieTime) { // The display tree may contain WebVTT timestamp objects representing // timestamps (processing instructions), along with displayable nodes. DEFINE_STATIC_LOCAL(const String, timestampTag, ("timestamp")); DEFINE_STATIC_LOCAL(const AtomicString, trackPastNodesShadowPseudoId, ("-webkit-media-text-track-past-nodes")); DEFINE_STATIC_LOCAL(const AtomicString, trackFutureNodesShadowPseudoId, ("-webkit-media-text-track-future-nodes")); if (!track()->isRendered()) return; bool isPastNode = true; // Clear the contents of the two sets. m_futureDocumentNodes->removeChildren(); m_futureDocumentNodes->setShadowPseudoId(trackFutureNodesShadowPseudoId); m_pastDocumentNodes->removeChildren(); m_pastDocumentNodes->setShadowPseudoId(trackPastNodesShadowPseudoId); // Update the two sets containing past and future WebVTT objects. RefPtr<DocumentFragment> referenceTree = getCueAsHTML(); if (!m_hasInnerTimestamps) { m_pastDocumentNodes->appendChild(referenceTree); return; } for (Node *child = referenceTree->firstChild(); child; child = child->nextSibling()) { if (child->nodeName() == timestampTag) { unsigned int position = 0; String timestamp = child->nodeValue(); double timestampTime = WebVTTParser::create(0, m_scriptExecutionContext)->collectTimeStamp(timestamp, &position); ASSERT(timestampTime != -1); if (timestampTime > movieTime) isPastNode = false; } if (isPastNode) m_pastDocumentNodes->appendChild(child->cloneNode(true), ASSERT_NO_EXCEPTION, false); else m_futureDocumentNodes->appendChild(child->cloneNode(true), ASSERT_NO_EXCEPTION, false); } }
// Audio clip special process cycle executive. void qtractorMidiClip::process ( unsigned long iFrameStart, unsigned long iFrameEnd ) { #ifdef CONFIG_DEBUG_0 qDebug("qtractorMidiClip[%p]::process(%lu, %lu)\n", this, iFrameStart, iFrameEnd); #endif qtractorTrack *pTrack = track(); if (pTrack == NULL) return; qtractorSession *pSession = pTrack->session(); if (pSession == NULL) return; qtractorMidiEngine *pMidiEngine = pSession->midiEngine(); if (pMidiEngine == NULL) return; qtractorMidiSequence *pSeq = sequence(); if (pSeq == NULL) return; // Track mute state... const bool bMute = (pTrack->isMute() || (pSession->soloTracks() && !pTrack->isSolo())); const unsigned long t0 = pSession->tickFromFrame(clipStart()); const unsigned long iTimeStart = pSession->tickFromFrame(iFrameStart); const unsigned long iTimeEnd = pSession->tickFromFrame(iFrameEnd); // Enqueue the requested events... qtractorMidiEvent *pEvent = m_playCursor.seek(pSeq, iTimeStart > t0 ? iTimeStart - t0 : 0); while (pEvent) { const unsigned long t1 = t0 + pEvent->time(); if (t1 >= iTimeEnd) break; if (t1 >= iTimeStart && (!bMute || pEvent->type() != qtractorMidiEvent::NOTEON)) pMidiEngine->enqueue(pTrack, pEvent, t1, gain(pSession->frameFromTick(t1) - clipStart())); pEvent = pEvent->next(); } }
void FooPlaylistManager::addFilesToCurrentPlaylist(QStringList files) { QList<FooTrack> tracks; for (int i = 0; i < files.size(); i++) { QString file = files.at(i); FooTrack track(file); engine->metaData(track); tracks.append(track); } currentViewingtPlaylist->addTracks(tracks); }
static void capture(uiArea *a, BOOL capturing) { // do nothing if there's no change if (a->capturing && capturing) return; if (!a->capturing && !capturing) return; // change flag first as ReleaseCapture() sends WM_CAPTURECHANGED a->capturing = capturing; if (a->capturing) { track(a, FALSE); SetCapture(a->hwnd); } else if (ReleaseCapture() == 0) logLastError("error releasing capture on drag in capture()"); }
inline void basic_iarchive_impl::load_object( basic_iarchive & ar, void * t, const basic_iserializer & bis ){ m_moveable_objects.is_pointer = false; serialization::state_saver<bool> ss_is_pointer(m_moveable_objects.is_pointer); // if its been serialized through a pointer and the preamble's been done if(t == m_pending.object && & bis == m_pending.bis){ // read data (bis.load_object_data)(ar, t, m_pending.version); return; } const class_id_type cid = register_type(bis); const int i = cid; cobject_id & co = cobject_id_vector[i]; load_preamble(ar, co); // save the current move stack position in case we want to truncate it boost::serialization::state_saver<object_id_type> ss_start(m_moveable_objects.start); // note: extra line used to evade borland issue const bool tracking = co.tracking_level; object_id_type this_id; m_moveable_objects.start = this_id = object_id_type(object_id_vector.size()); // if we tracked this object when the archive was saved if(tracking){ // if it was already read if(!track(ar, t)) // we're done return; // add a new enty into the tracking list object_id_vector.push_back(aobject(t, cid)); // and add an entry for this object m_moveable_objects.end = object_id_type(object_id_vector.size()); } // read data (bis.load_object_data)(ar, t, co.file_version); m_moveable_objects.recent = this_id; }
QPointF Arpeggio::gripAnchor(int n) const { Chord* c = chord(); if (c == 0) return QPointF(); if (n == 0) return c->upNote()->pagePos(); else if (n == 1) { Note* dnote = c->downNote(); int btrack = track() + (_span - 1) * VOICES; ChordRest* bchord = static_cast<ChordRest*>(c->segment()->element(btrack)); if (bchord && bchord->type() == CHORD) dnote = static_cast<Chord*>(bchord)->downNote(); return dnote->pagePos(); } return QPointF(); }