summaryrefslogtreecommitdiff
path: root/muse2/muse/songfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/songfile.cpp')
-rw-r--r--muse2/muse/songfile.cpp280
1 files changed, 0 insertions, 280 deletions
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
index b07d1243..6d0e056f 100644
--- a/muse2/muse/songfile.cpp
+++ b/muse2/muse/songfile.cpp
@@ -558,286 +558,6 @@ void Part::write(int level, Xml& xml, bool isCopy, bool forceWavePaths) const
xml.etag(level, "part");
}
-// DELETETHIS 280! whoa!
-/*
-//---------------------------------------------------------
-// Part::read
-//---------------------------------------------------------
-
-void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset
- {
- int id = -1;
- bool containsEvents = false;
- uuid_t uuid;
- uuid_clear(uuid);
- bool uuidvalid = false;
- bool clone = false;
-
- for (;;) {
- Xml::Token token = xml.parse();
- const QString& tag = xml.s1();
- switch (token) {
- case Xml::Error:
- case Xml::End:
- return;
- case Xml::TagStart:
- if (tag == "name")
- _name = xml.parse1();
- else if (tag == "poslen") {
- PosLen::read(xml, "poslen");
- }
- else if (tag == "pos") {
- Pos pos;
- pos.read(xml, "pos"); // obsolete
- setTick(pos.tick());
- }
- else if (tag == "len") {
- Pos len;
- len.read(xml, "len"); // obsolete
- setLenTick(len.tick());
- }
- else if (tag == "selected")
- _selected = xml.parseInt();
- else if (tag == "color")
- _colorIndex = xml.parseInt();
- else if (tag == "mute")
- _mute = xml.parseInt();
- else if (tag == "event") {
- containsEvents = true;
- EventType type = Wave;
- if (_track->isMidiTrack())
- type = Note;
- Event e(type);
- e.read(xml);
- // stored tickpos for event has absolute value. However internally
- // tickpos is relative to start of part, we substract tick().
- // TODO: better handling for wave event
- e.move(-tick());
- int tick = e.tick();
-
- // Changed by T356. Do not discard events belonging to clone parts,
- // at least not yet. A later clone might have a longer,
- // fully accommodating part length!
- //if ((tick < 0) || (tick >= (int) lenTick())) {
- if ((tick < 0) || ( id == -1 && !clone && (tick >= (int)lenTick()) ))
- {
- //printf("Part::read: warning: event not in part: %d - %d -%d, discarded\n",
- printf("Part::read: warning: event at tick:%d not in part:%s, discarded\n",
- tick, name().toLatin1().constData());
- }
- else {
- _events->add(e);
-*/
-
-
- /*
- // TODO: This should NOT be done here since the event list
- // might be deleted below. Since after reading a part it
- // likely (always?) that (msg)AddPart() or (msg)ChangePart()
- // will be called (must check if they're ever called BEFORE
- // Part::read), then those routines will take care of it,
- // they are already coded to do so.
- // Note the redundancy of doing it here AND (msg)Add/ChangePart !
- // Try to eliminate this section altogether by verifying that
- // (msg)Add/ChangePart (or one of the other routines which add port
- // controller values) is always called after Part::read...
- if (e.type() == Controller) {
- MidiTrack* mt = (MidiTrack*)_track;
- int channel = mt->outChannel();
- MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
- // tick is relative to part, controller needs an absolute value hence
- // part offset is added. If newPartOffset was given we use that instead of
- // the recorded offset!
- if (!newPartOffset)
- newPartOffset=this->tick();
-
- int ctl = e.dataA();
- if(mt->type() == Track::DRUM)
- {
- // Is it a drum controller event, according to the track port's instrument?
- MidiController* mc = mp->drumController(ctl);
- if(mc)
- {
- int note = ctl & 0x7f;
- ctl &= ~0xff;
- channel = drumMap[note].channel;
- mp = &MusEGlobal::midiPorts[drumMap[note].port];
- ctl |= drumMap[note].anote;
- }
- }
-
- // Removed by T356
- // check if controller exists
- //if (mp->hwCtrlState(channel, e.dataA()) == CTRL_VAL_UNKNOWN) {
- // mp->addManagedController(channel, e.dataA());
- // }
-
- // Changed by T356
- // add controller value
- //mp->setCtrl(channel, tick+newPartOffset, e.dataA(), e.dataB());
- mp->setControllerVal(channel, tick+newPartOffset, ctl, e.dataB(), this);
- }
- */
-/*
- }
- }
- else
- xml.unknown("Part::read");
- break;
- case Xml::Attribut:
- if (tag == "cloneId")
- id = xml.s2().toInt();
- else if (tag == "uuid")
- {
- uuid_parse(xml.s2().toLatin1().constData(), uuid);
- if(!uuid_is_null(uuid))
- uuidvalid = true;
- }
- else if (tag == "isclone")
- clone = xml.s2().toInt();
- break;
- case Xml::TagEnd:
- if (tag == "part")
- {
-*/
- /*
- if (id != -1)
- {
-
- // clone part
- if (containsEvents) {
- // add to MusEGlobal::cloneList:
- //ClonePart cp(_events, id);
- ClonePart cp(this, id);
- MusEGlobal::cloneList.push_back(cp);
- }
- else {
- // replace event list with clone event
- // list
- for (iClone i = MusEGlobal::cloneList.begin();
- i != MusEGlobal::cloneList.end(); ++i) {
- if (i->id == id) {
- delete _events;
- //_events = (EventList*)(i->el);
- _events = (EventList*)(i->cp->cevents());
- _events->incRef(1);
- _events->incARef(1);
- //i->cp->chainClone(this);
- chainClone((Part*)i->cp, this);
- break;
- }
- }
- }
- */
-
-/*
- if(id != -1)
- {
- // See if the part exists in the clone list.
- // The clone list is also the copy/paste clone list.
- // Care must be taken to ensure the list is ALWAYS EMPTY
- // before loading or dropping parts INTO muse, because the
- // current song parts are NOT the same as when the imported parts
- // were created, (even if they were created from the current session,
- // we should NOT look them up). Always back up the list, clear it,
- // read part(s), then restore the list so that paste works after.
- Part* cp = 0;
- for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i)
- {
- if(i->id == id)
- {
- cp = (Part*)i->cp;
- break;
- }
- }
- // Was a matching part found in the clone list?
- if(cp)
- {
- // Make this part a clone of that part. Use its event list...
- delete _events;
- _events = (EventList*)(cp->cevents());
- _events->incRef(1);
- _events->incARef(1);
- chainClone(cp, this);
- }
- else
- {
- // No matching part to clone was found in the clone list.
- // Does the part contain some events?
- //if(containsEvents)
- {
- // Add the part to the clone list so that subsequent parts
- // can look it up and clone from it...
- ClonePart ncp(this, id);
- MusEGlobal::cloneList.push_back(ncp);
- }
- // Otherwise this part has no matching part in the clone list
- // and no events of its own. Nothing left to do, we now have
- // a blank part with the original offset, colour etc.
- }
- }
- else
- // If a uuid was found, do the same as above. Using uuids
- // allows foolproof rejection of copied parts not found
- // in the clone list, particularly when copying parts from
- // another instance of muse.
- if(uuidvalid)
- {
- Part* cp = 0;
- for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i)
- {
- if(uuid_compare(uuid, i->uuid) == 0)
- {
- cp = (Part*)i->cp;
- break;
- }
- }
- // If a matching part was found, and we want to paste to the original track...
- if(cp && !toTrack)
- {
- // Make sure the track exists (has not been deleted).
- if((cp->track()->isMidiTrack() && MusEGlobal::song->midis()->find(cp->track()) != MusEGlobal::song->midis()->end()) ||
- (cp->track()->type() == Track::WAVE && MusEGlobal::song->waves()->find(cp->track()) != MusEGlobal::song->waves()->end()))
- setTrack(cp->track());
- }
- // Was a matching part found in the clone list, and was it
- // originally a clone part?
- if(cp && clone)
- {
- // Make this part a clone of that part. Use its event list...
- delete _events;
- _events = (EventList*)(cp->cevents());
- _events->incRef(1);
- _events->incARef(1);
- // Chain the clone.
- // Use the slower function which makes sure it chains to a part
- // within a valid (non-deleted) track.
- //chainClone(cp, this);
- chainClone(this);
- }
- else
- {
- // No matching part to clone was found in the clone list.
- // Does the part contain some events?
- //if(containsEvents)
- {
- // Add the part to the clone list so that subsequent parts
- // can look it up and clone from it...
- ClonePart ncp(this);
- // New ClonePart creates its own uuid, but we need to replace it.
- uuid_copy(ncp.uuid, uuid);
- MusEGlobal::cloneList.push_back(ncp);
- }
- }
- }
- return;
- }
- default:
- break;
- }
- }
- }
-*/
//---------------------------------------------------------
// writeFont