예제 #1
0
void XplodifyPlaylist::tracks_added(
        sp_track * const *tracks, int num_tracks, 
        int position) {
#if 0
    boost::shared_ptr<XplodifySession> sess(m_session.lock());
    if(!sess) {
        return;
    }

    track_cache_by_rand& tr_cache_rand = m_track_cache.get<0>();
    track_cache_by_rand::const_iterator cit = tr_cache_rand.begin();

    //Fast forward
    cit = cit+position-1;

    for(int i=0 ; i<num_tracks ; i++) {
        boost::shared_ptr<XplodifyTrack> tr(new XplodifyTrack(sess));
        std::pair<track_r_iterator, bool> p;
        if(tr->load(tracks[i])){
            std::string trname(tr->get_name());
            if(!trname.empty()) {
                p = tr_cache_rand.insert(cit, track_entry(trname, tr));
                if(p.second) {
                    cit++;
                }
            }
        }
    }

    sess->update_state_ts();
#endif
    return;
}
예제 #2
0
void XplodifyPlaylist::add_track(boost::shared_ptr<XplodifyTrack> tr) {
    if(!tr) {
        return;
    }

    boost::shared_ptr<XplodifySession> sess(m_session.lock());
    track_cache_by_rand& t_r = m_track_cache.get<0>();
    //push_back() delivers better performance than insert.
    t_r.push_back(track_entry(tr->get_name(), tr));
    sess->update_state_ts();
}
예제 #3
0
vector< vector<track_entry> > AnnotationDisplay::calculateTrackLayout(const vector<track_entry>& annotationFile)
{
    max_width = 1;
    int line_start = ui->getStart(glWidget);
    int width = ui->getWidth();
    int line_stop = line_start + width;
    int temp_display_size = current_display_size();
    int nextInactiveAnnotation = 0;

    if(annotationFile.empty())
        return vector< vector<track_entry> >();
    /** activeEntries is the list annotations that are on the current display line
        this is a dynamically changing group with annotations coming in and out based on
        their start and stop positions.*/
    vector<vector<track_entry> > layout;
    vector<track_entry> activeEntries = vector<track_entry>();
    track_entry blank = track_entry(0,0, color(0,0,0));
    activeEntries.push_back(blank);

    for(int row = 0; row < temp_display_size / width; row++)//for each line on the screen
    {
        //check to see if any of the tracks already in activeEntries stop on this line
        for(int k = 0; k < (int)activeEntries.size(); ++k)
        {
            if( !activeEntries[k].isBlank() )
            {
                if( activeEntries[k].stop < line_start )
                {
                    if( activeEntries[k].col == color(200,200,200) )
                        activeEntries[k] = blank;//remove the entry
                    else
                        activeEntries[k].col = color(200,200,200);
                }
            }
        }
        //check to match start for a new track
        while(nextInactiveAnnotation < (int)annotationFile.size() && annotationFile[nextInactiveAnnotation].stop < line_start)//assumes tracks are in order
            nextInactiveAnnotation++;
        //keep adding annotations that start on this line
        while(nextInactiveAnnotation < (int)annotationFile.size()
              && rangeOverlap(annotationFile[nextInactiveAnnotation].start, annotationFile[nextInactiveAnnotation].stop, line_start, line_stop))
        {
            stackEntry(activeEntries, annotationFile[nextInactiveAnnotation++]);		//place new tracks in proper position
        }

        line_start += width;
        line_stop += width;
        if( (int)activeEntries.size()*2 > max_width)
            max_width = activeEntries.size()*2;
        layout.push_back(activeEntries);
    }
    return layout;
}
예제 #4
0
void XplodifyPlaylist::add_track(boost::shared_ptr<XplodifyTrack> tr, int pos) {
    if(!tr) {
        return;
    }

    boost::shared_ptr<XplodifySession> sess(m_session.lock());

    //get iterator...
    track_cache_by_rand& t_r = m_track_cache.get<0>();
    track_cache_by_rand::iterator it = t_r.iterator_to(t_r[pos]);

    t_r.insert(it, track_entry(tr->get_name(), tr));
    sess->update_state_ts();
}