当前位置: 首页>>代码示例>>C++>>正文


C++ PartList类代码示例

本文整理汇总了C++中PartList的典型用法代码示例。如果您正苦于以下问题:C++ PartList类的具体用法?C++ PartList怎么用?C++ PartList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PartList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: partSplitter

Undo partSplitter(unsigned int pos, bool onlySelectedTracks)
{
    Undo operations;
    TrackList* tracks = MusEGlobal::song->tracks();

    for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
        Track* track = *it;
        if (track == 0 || (onlySelectedTracks && !track->selected()))
              continue;

        PartList* pl = track->parts();
        for (iPart p = pl->begin(); p != pl->end(); ++p) {
              Part* part = p->second;
              unsigned int p1 = part->tick();
              unsigned int l0 = part->lenTick();
              if (pos > p1 && pos < (p1+l0)) {
                    Part* p1;
                    Part* p2;
                    part->splitPart(pos, p1, p2);

                    MusEGlobal::song->informAboutNewParts(part, p1);
                    MusEGlobal::song->informAboutNewParts(part, p2);
                    operations.push_back(UndoOp(UndoOp::DeletePart,part));
                    operations.push_back(UndoOp(UndoOp::AddPart,p1));
                    operations.push_back(UndoOp(UndoOp::AddPart,p2));
                    break;
              }
        }
    }
    return operations;
}
开发者ID:Windfisch,项目名称:muse,代码行数:31,代码来源:structure.cpp

示例2: cmdGluePart

void Song::cmdGluePart(Track* track, Part* oPart)
{
    PartList* pl = track->parts();
    Part* nextPart = 0;

    for (iPart ip = pl->begin(); ip != pl->end(); ++ip)
    {
        if (ip->second == oPart)
        {
            ++ip;
            if (ip == pl->end())
                return;
            nextPart = ip->second;
            break;
        }
    }

    Part* nPart = track->newPart(oPart);
    nPart->setLenTick(nextPart->tick() + nextPart->lenTick() - oPart->tick());

    // populate nPart with Events from oPart and nextPart

    EventList* sl1 = oPart->events();
    EventList* dl = nPart->events();

    for (iEvent ie = sl1->begin(); ie != sl1->end(); ++ie)
        dl->add(ie->second);

    EventList* sl2 = nextPart->events();

    //int frameOffset = nextPart->frame() - oPart->frame();
    //for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie) {
    //      Event event = ie->second.clone();
    //      event.setFrame(event.frame() + frameOffset);
    //      dl->add(event);
    //      }
    // p3.3.54 Changed.

    {
        int tickOffset = nextPart->tick() - oPart->tick();
        for (iEvent ie = sl2->begin(); ie != sl2->end(); ++ie)
        {
            Event event = ie->second.clone();
            event.setTick(event.tick() + tickOffset);
            dl->add(event);
        }
    }

    startUndo();
    audio->msgRemovePart(nextPart, false);
    // Indicate no undo, and do port controller values but not clone parts.
    //audio->msgChangePart(oPart, nPart, false);
    audio->msgChangePart(oPart, nPart, false, true, false);
    endUndo(SC_PART_MODIFIED | SC_PART_REMOVED);
}
开发者ID:ViktorNova,项目名称:los,代码行数:55,代码来源:part.cpp

示例3: partMap

PartMap PartList::partMap(MidiTrack* track)
{
    PartMap pmap;
    PartList* list = new PartList;
    for (iPart i = begin(); i != end(); ++i)
    {
        if (i->second->track() == track)
        {
            list->add(i->second);
        }
    }
    pmap.track = track;
    pmap.parts = list;
    return pmap;
}
开发者ID:ViktorNova,项目名称:los,代码行数:15,代码来源:part.cpp

示例4: getLinkedParts

	base::ReturnCode BodyParts::getLinkedParts(BodyPart *linkedTo, PartList &result) const
	{
		if (!linkedTo)
		{
			return base::NULL_PARAMETER;
		}
		if (!hasBodyPart(linkedTo))
		{
			return base::BODY_PART_NOT_FOUND;
		}

		for (size_t i = 0; i < mPartList.size(); i++)
		{
			BodyPart *part = mPartList[i];
			if (part == linkedTo)
			{
				continue;
			}
			if (part->getCanHoldOnto() == linkedTo)
			{
				result.push_back(part);
			}
		}
		return base::SUCCESS;
	}
开发者ID:astrellon,项目名称:Rouge,代码行数:25,代码来源:body_parts.cpp

示例5: ReadParticles

void ReadParticles(PartList &list,
                          const boost::property_tree::ptree &pt) {

  auto particleTree = pt.get_child_optional("ParticleList");
  if (!particleTree)
    return;
  for (auto const &v : particleTree.get()) {
    auto tmp = ParticleProperties(v.second);
    auto p = std::make_pair(tmp.name(), tmp);
    auto last = list.insert(p);

    if (!last.second) {
      LOG(INFO) << "ReadParticles() | Particle " << last.first->first
                << " already exists in list. We overwrite its parameters!";
      last.first->second = tmp;
    }
    tmp = last.first->second;

    // cparity is optional
    double cparity = 0.0;
    try {
      cparity = tmp.GetQuantumNumber("Cparity");
    } catch (std::exception &ex) {
    }

    LOG(DEBUG) << "ReadParticles() | Particle " << tmp.name()
               << " (id=" << tmp.GetId() << ") "
               << " J(PC)=" << tmp.GetSpinQuantumNumber("Spin") << "("
               << tmp.GetQuantumNumber("Parity") << cparity << ") "
               << " mass=" << tmp.GetMass()
               << " decayType=" << tmp.GetDecayType();
  }

  return;
}
开发者ID:ComPWA,项目名称:ComPWA,代码行数:35,代码来源:Properties.cpp

示例6: findPartBySerial

Part* findPartBySerial(int sn)
{
	TrackList* tracks = song->tracks();
	for (ciTrack t = tracks->begin(); t != tracks->end(); ++t)
	{
		Track* track = *t;
		PartList* parts = track->parts();
		for (ciPart p = parts->begin(); p != parts->end(); p++)
		{
			Part* part = p->second;
			if (part->sn() == sn)
				return part;
		}
	}

	return NULL;
}
开发者ID:OpenGanesh,项目名称:oom,代码行数:17,代码来源:pyapi.cpp

示例7: update

/*!
    \fn PartsWidget::update(PartList& partList)
 */
void PartsWidget::update(PartList& partList)
{
    this->partList = partList;
    PartsWidget::Part closePart;
    closePart.fromPosition = partList.getSize();
    closePart.type = -10;
    this->partList.push_back(closePart);
    QWidget::update();
}
开发者ID:BackupTheBerlios,项目名称:juicer-svn,代码行数:12,代码来源:partswidget.cpp

示例8: movePartsTotheRight

Undo movePartsTotheRight(unsigned int startTicks, int moveTicks, bool only_selected, set<Track*>* tracklist)
{
      if (moveTicks<=0)
            return Undo();

      Undo operations;
      TrackList* tracks = MusEGlobal::song->tracks();
      
      for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
            Track* track = *it;
            if ( (track == 0) ||
                 (only_selected && !track->selected()) ||
                 (tracklist && tracklist->find(track)==tracklist->end()) )
                  continue;
            PartList* pl = track->parts();
            for (riPart p = pl->rbegin(); p != pl->rend(); ++p) {
                  Part* part = p->second;
                  unsigned t = part->tick();
                  int l = part->lenTick();
                  if (t + l <= startTicks)
                        continue;
                  if (startTicks > t && startTicks < (t+l)) {
                        // split part to insert new space
                        Part* p1;
                        Part* p2;
                        part->splitPart(startTicks, p1, p2);
                        p2->setTick(startTicks+moveTicks);

                        MusEGlobal::song->informAboutNewParts(part,p1,p2);
                        operations.push_back(UndoOp(UndoOp::DeletePart, part));
                        operations.push_back(UndoOp(UndoOp::AddPart, p1));
                        operations.push_back(UndoOp(UndoOp::AddPart, p2));
                        }
                  else if (t >= startTicks) {
                        operations.push_back(UndoOp(UndoOp::ModifyPartTick, part, part->tick(), t + moveTicks));
                        }
                  }
            }

      adjustGlobalLists(operations, startTicks, moveTicks);

      return operations;
      }
开发者ID:Windfisch,项目名称:muse,代码行数:43,代码来源:structure.cpp

示例9: unchainTrackParts

void unchainTrackParts(MidiTrack* t, bool decRefCount)/*{{{*/
{
    PartList* pl = t->parts();
    for (iPart ip = pl->begin(); ip != pl->end(); ++ip)
    {
        Part* p = ip->second;
        chainCheckErr(p);

        // Do we want to decrease the reference count?
        if (decRefCount)
            p->events()->incARef(-1);

        // Unchain the part.
        p->prevClone()->setNextClone(p->nextClone());
        p->nextClone()->setPrevClone(p->prevClone());

        // Isolate the part.
        p->setPrevClone(p);
        p->setNextClone(p);
    }
}/*}}}*/
开发者ID:ViktorNova,项目名称:los,代码行数:21,代码来源:part.cpp

示例10: genPartlist

void AbstractMidiEditor::genPartlist()/*{{{*/
{
    _pl->clear();
    for (std::list<int>::iterator i = _parts.begin(); i != _parts.end(); ++i)
    {
        MidiTrackList* tl = song->tracks();
        for (iMidiTrack it = tl->begin(); it != tl->end(); ++it)
        {
            PartList* pl = (*it)->parts();
            iPart ip;
            for (ip = pl->begin(); ip != pl->end(); ++ip)
            {
                if (ip->second->sn() == *i)
                {
                    _pl->add(ip->second);
                    break;
                }
            }
            if (ip != pl->end())
                break;
        }
    }
}/*}}}*/
开发者ID:peter1000,项目名称:los,代码行数:23,代码来源:AbstractMidiEditor.cpp

示例11: populateMultiSelect

void EventCanvas::populateMultiSelect(CItem* baseItem)/*{{{*/
{
    if(editor->isGlobalEdit() && baseItem)
    {
        PartList* pl = editor->parts();
        int curTranspose = ((MidiTrack*)baseItem->part()->track())->getTransposition();
        Event curEvent = baseItem->event();
        int curPitch = curEvent.pitch();
        int curRawPitch = curPitch - curTranspose;
        //int curLen = curEvent.lenTick();
        m_multiSelect.clear();
        for(iPart p = pl->begin(); p != pl->end(); ++p)
        {
            if(p->second == _curPart)
                continue;
            CItemList pitems = getItemlistForPart(p->second);
            for (iCItem i = pitems.begin(); i != pitems.end(); ++i)
            {
                MidiTrack* mtrack = (MidiTrack*)i->second->part()->track();
                int transp = mtrack->getTransposition();
                Event e = i->second->event();
                if(e.empty())
                    continue;
                int pitch = e.pitch();
                int rpitch = pitch - transp;
                //int len = e.lenTick();
                //printf("Current pitch: %d, rawpitch: %d - note pitch: %d, raw: %d\n", curPitch, curRawPitch, pitch, rpitch);
                if(e.tick() == curEvent.tick() && rpitch == curRawPitch/*, len == curLen*/)
                {
                    m_multiSelect.add(i->second);
                        break;
                }
            }
        }
        //printf("MultiSelect list size: %d \n", (int)m_multiSelect.size());
    }
}/*}}}*/
开发者ID:ViktorNova,项目名称:los,代码行数:37,代码来源:EventCanvas.cpp

示例12: selectionChanged

void TrackListView::selectionChanged(const QModelIndex current, const QModelIndex)/*{{{*/
{
    if(!current.isValid())
        return;
    int row = current.row();
    m_selectedIndex = row;
    QStandardItem* item = m_model->item(row);
    if(item)
    {
        int type = item->data(TrackRole).toInt();
        qint64 tid = item->data(TrackIdRole).toLongLong();
        bool checked = (item->checkState() == Qt::Checked);
        //QString trackName = item->data(TrackNameRole).toString();
        MidiTrack* track = song->findTrackById(tid);
        if(!track || !m_editor || type == 1 || !checked)
            return;

        PartList* list = track->parts();
        int sn = item->data(PartRole).toInt();
        unsigned tick = item->data(TickRole).toInt();
        Part* part = list->find(tick, sn);
        updatePartSelection(part);
    }
}/*}}}*/
开发者ID:peter1000,项目名称:los,代码行数:24,代码来源:tracklistview.cpp

示例13: preloadControllers

void Audio::preloadControllers()/*{{{*/
{
	midiBusy = true;

	MidiTrackList* tracks = song->midis();
	for (iMidiTrack it = tracks->begin(); it != tracks->end(); ++it)
	{
		MidiTrack* track = *it;
		//activePorts[track->outPort()] = true;
		QList<ProcessList*> pcevents;

		int port = track->outPort();
		int channel = track->outChannel();
		int defaultPort = port;

		MidiDevice* md = midiPorts[port].device();
		if (!md)
		{
			continue;
		}
		MPEventList* playEvents = md->playEvents();
		playEvents->erase(playEvents->begin(), playEvents->end());

		PartList* pl = track->parts();
		for (iPart p = pl->begin(); p != pl->end(); ++p)
		{
			MidiPart* part = (MidiPart*) (p->second);
			EventList* events = part->events();
			unsigned partTick = part->tick();
			//unsigned partLen = part->lenTick();
			int delay = track->delay;

			unsigned offset = delay + partTick;

			for (iEvent ie = events->begin(); ie != events->end(); ++ie)
			{
				Event ev = ie->second;
				port = defaultPort;
				unsigned tick = ev.tick() + offset;
				//unsigned frame = tempomap.tick2frame(tick) + frameOffset;
				switch (ev.dataA())
				{
					case CTRL_PROGRAM:
					{
						ProcessList *pl = new ProcessList;
						pl->port = port;
						pl->channel = channel;
						pl->dataB = ev.dataB();
						bool addEvent = true;
						for(int i = 0; i < pcevents.size(); ++i)
						{
							ProcessList* ipl = pcevents.at(i);
							if(ipl->port == pl->port && ipl->channel == pl->channel && ipl->dataB == pl->dataB)
							{
								addEvent = false;
								break;
							}
						}
						if(addEvent)
						{
							printf("Audio::preloadControllers() Loading event @ tick: %d - on channel: %d - on port: %d - dataA: %d - dataB: %d\n",
								tick, channel, port, ev.dataA(), ev.dataB());
							pcevents.append(pl);
							playEvents->add(MidiPlayEvent(tick, port, channel, ev));
						}
					}
						break;
					default:
						break;
				}
			}
		}
		md->setNextPlayEvent(playEvents->begin());
	}
	midiBusy = false;
}/*}}}*/
开发者ID:faesong,项目名称:oom,代码行数:76,代码来源:midi.cpp

示例14: getParts

PyObject* getParts(PyObject*, PyObject* args)
{
	TrackList* tracks = song->tracks();
	const char* trackname;
	if (!PyArg_ParseTuple(args, "s", &trackname))
	{
		return NULL;
	}

	PyObject* pyparts = Py_BuildValue("[]");
	for (ciTrack t = tracks->begin(); t != tracks->end(); ++t)
	{
		Track* track = *t;
		if (track->name() != trackname)
			continue;

		PartList* parts = track->parts();
		for (ciPart p = parts->begin(); p != parts->end(); p++)
		{
			Part* part = p->second;

			MidiPart* mpart = (MidiPart*) part;
			PyObject* pypart = PyDict_New();
			int tick = mpart->tick();
			int lentick = mpart->lenTick();
			int serialnr = mpart->sn();
			PyObject* pstrtick = Py_BuildValue("s", "tick");
			PyObject* pitick = Py_BuildValue("i", tick);
			PyObject* pstrid = Py_BuildValue("s", "id");
			PyObject* pstrserial = Py_BuildValue("i", serialnr);
			PyObject* pstrlen = Py_BuildValue("s", "len");
			PyObject* pstrtick2 = Py_BuildValue("i", lentick);

			PyDict_SetItem(pypart, pstrtick, pitick);
			PyDict_SetItem(pypart, pstrid, pstrserial);
			PyDict_SetItem(pypart, pstrlen, pstrtick2);

			Py_DECREF(pstrtick);
			Py_DECREF(pitick);
			Py_DECREF(pstrid);
			Py_DECREF(pstrserial);
			Py_DECREF(pstrlen);
			Py_DECREF(pstrtick2);

			// Pack midi events into list before wrapping it all up
			EventList* events = mpart->events();
			PyObject* pyevents = Py_BuildValue("[]");
			for (ciEvent e = events->begin(); e != events->end(); e++)
			{
				PyObject* pyevent = PyDict_New(); // The event structure - a dictionary with keys 'type','tick','data'

				const Event& event = e->second;
				unsigned tick = e->first;
				PyObject* eventdata = Py_BuildValue("[i,i,i]", event.dataA(), event.dataB(), event.dataC());
				PyObject* pstrdata = Py_BuildValue("s", "data");
				pstrtick = Py_BuildValue("s", "tick");
				PyObject* pitickval = Py_BuildValue("i", tick);
				PyDict_SetItem(pyevent, pstrdata, eventdata);
				PyDict_SetItem(pyevent, pstrtick, pitickval);
				Py_DECREF(eventdata);
				Py_DECREF(pstrdata);
				Py_DECREF(pstrtick);
				Py_DECREF(pitickval);

				switch (event.type())
				{
					case Note:
					{
						PyObject* pstrtype = Py_BuildValue("s", "type");
						PyObject* pstrnote = Py_BuildValue("s", "note");
						PyObject* pstrlen = Py_BuildValue("s", "len");
						PyObject* pilentick = Py_BuildValue("i", event.lenTick());
						PyDict_SetItem(pyevent, pstrtype, pstrnote);
						PyDict_SetItem(pyevent, pstrlen, pilentick);
						Py_DECREF(pstrtype);
						Py_DECREF(pstrnote);
						Py_DECREF(pstrlen);
						Py_DECREF(pilentick);
						break;
					}
					case Controller:
					{
						PyObject* pstrtype = Py_BuildValue("s", "type");
						PyObject* pstrctrl = Py_BuildValue("s", "ctrl");
						PyDict_SetItem(pyevent, pstrtype, pstrctrl);
						Py_DECREF(pstrtype);
						Py_DECREF(pstrctrl);
						break;
					}
					default:
						printf("Event type not supported yet: %d\n", event.type());
						break;
				}
				PyList_Append(pyevents, pyevent);
				Py_DECREF(pyevent);
			}
			Py_DECREF(pyevents);
			// Add the event list to the pypart dictionary
			PyObject* pystrevents = Py_BuildValue("s", "events");
			PyDict_SetItem(pypart, pystrevents, pyevents);
//.........这里部分代码省略.........
开发者ID:OpenGanesh,项目名称:oom,代码行数:101,代码来源:pyapi.cpp

示例15: while

void CanvasNavigator::updateParts()/*{{{*/
{
    m_editing = true;
    m_playhead = 0;
    m_start = 0;
    m_canvasBox =  0;
    m_punchIn = 0;
    m_punchOut = 0;
    m_parts.clear();
    m_markers.clear();
    m_scene->clear();
    /*foreach(PartItem* i, m_parts)
        m_scene->removeItem(i);
    while(m_parts.size())
        delete m_parts.takeFirst();*/
    m_heightList.clear();
    m_scene->setSceneRect(QRectF());
    int index = 1;
    //QList<QGraphicsItem*> group;
    MidiTrackList* tl = song->visibletracks();
    ciMidiTrack ci = tl->begin();
    for(; ci != tl->end(); ci++)
    {
        m_heightList.append((*ci)->height());
    }
    ci = tl->begin();
    if(ci != tl->end())
    {
        int mh = (*ci)->height();
        double partHeight = (mh * 8)/100;
        m_start = m_scene->addRect(0.0, 0.0, calcSize(song->len()), partHeight);
        m_start->setBrush(QColor(63, 63, 63));
        m_start->setPen(QPen(QColor(63, 63, 63)));
        m_start->setZValue(-50);
        ci++;//Special case for master
    }
    for(; ci != tl->end(); ci++)
    {
        MidiTrack* track = *ci;
        if(track)
        {
            QList<int> list = m_heightList.mid(0, index);
            int ypos = 0;
            foreach(int i, list)
                ypos += i;
            ypos = (ypos * 8)/100;
            int ih = m_heightList.at(index);
            double partHeight = (ih * 8)/100;

            //qDebug("CanvasNavigator::updateParts: partHeight: %2f, ypos: %d", partHeight, ypos);
            PartList* parts = track->parts();
            if(parts && !parts->empty())
            {
                for(iPart p = parts->begin(); p != parts->end(); p++)
                {
                    Part *part =  p->second;

                    int tick, len;
                    if(part)
                    {
                        tick = part->tick();
                        len = part->lenTick();
                    }
                    double w = calcSize(len);
                    double pos = calcSize(tick);

                    PartItem* item = new PartItem(pos, ypos, w, partHeight);
                    item->setPart(part);
                    m_parts.append(item);
                    //group.append((QGraphicsItem*)item);
                    int i = part->colorIndex();
                    QColor partWaveColor(config.partWaveColors[i]);
                    QColor partColor(config.partColors[i]);
                    //partWaveColor.setAlpha(150);
                    partColor.setAlpha(150);
                    item->setBrush(part->selected() ? partWaveColor : partColor);
                    item->setPen(part->selected() ? partColor : partWaveColor);
                    m_scene->addItem(item);
                }
            }
            ++index;
        }
    }
    QColor colTimeLine = QColor(0, 186, 255);
    int kpos = 0;
    foreach(int i, m_heightList)
        kpos += i;
    //kpos = ((kpos + 400) * 8)/100;
    kpos = ((kpos + 400) * 8)/100;

    m_playhead = new QGraphicsRectItem(0, 0, 1, kpos);
    m_playhead->setBrush(colTimeLine);
    m_playhead->setPen(Qt::NoPen);
    m_playhead->setZValue(124001.0f);
    m_playhead->setFlags(QGraphicsItem::ItemIgnoresTransformations);
    m_scene->addItem(m_playhead);
    QColor loopColor(139, 225, 69);
    QColor markerColor(243,191,124);
    MarkerList* markers = song->marker();
    for (iMarker m = markers->begin(); m != markers->end(); ++m)
//.........这里部分代码省略.........
开发者ID:falkTX,项目名称:los,代码行数:101,代码来源:CanvasNavigator.cpp


注:本文中的PartList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。