summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2013-08-10 17:22:43 +0200
committerFlorian Jung <flo@windfisch.org>2013-08-10 17:22:43 +0200
commitd51caef570ef25b97b9b4687bd870a5afcc623ec (patch)
treefd832b5f9fdd1054726d60cea57b4d05b4c0457b /muse2
parent3c6e4156914cec6e3b6d822577a030cef993656a (diff)
cleanup
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/audio.cpp7
-rw-r--r--muse2/muse/midiseq.cpp4
-rw-r--r--muse2/muse/part.cpp6
-rw-r--r--muse2/muse/song.cpp3
-rw-r--r--muse2/muse/song.h13
-rw-r--r--muse2/muse/songfile.cpp280
-rw-r--r--muse2/muse/track.cpp84
7 files changed, 13 insertions, 384 deletions
diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp
index 0c507fa2..659ae8a9 100644
--- a/muse2/muse/audio.cpp
+++ b/muse2/muse/audio.cpp
@@ -762,13 +762,6 @@ void Audio::processMsg(AudioMsg* msg)
frameOffset = syncFrame - samplePos;
}
break;
- // DELETETHIS 6
- //case SEQM_ADD_TRACK:
- //case SEQM_REMOVE_TRACK:
- //case SEQM_CHANGE_TRACK:
- //case SEQM_ADD_PART:
- //case SEQM_REMOVE_PART:
- //case SEQM_CHANGE_PART:
case SEQM_SET_TRACK_OUT_CHAN:
case SEQM_SET_TRACK_OUT_PORT:
case SEQM_REMAP_PORT_DRUM_CTL_EVS:
diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp
index 8d0427d8..b94e284e 100644
--- a/muse2/muse/midiseq.cpp
+++ b/muse2/muse/midiseq.cpp
@@ -113,10 +113,6 @@ void MidiSeq::processMsg(const ThreadMsg* m)
MusEGlobal::song->cmdRemoveTrack(msg->track);
updatePollFd();
break;
- //case MusECore::SEQM_CHANGE_TRACK: DELETETHIS 4
- // MusEGlobal::song->changeTrack((Track*)(msg->p1), (Track*)(msg->p2));
- // updatePollFd();
- // break;
case MusECore::SEQM_ADD_PART:
MusEGlobal::song->cmdAddPart((Part*)msg->p1);
break;
diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp
index 5f3aa8ee..c530b1f3 100644
--- a/muse2/muse/part.cpp
+++ b/muse2/muse/part.cpp
@@ -567,15 +567,9 @@ void removePortCtrlEvents(Part* part, bool doClones)
MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
int ch = mt->outChannel();
const EventList* el = p->cevents();
- //unsigned len = p->lenTick();
for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
{
const Event& ev = ie->second;
- // Added by T356. Do not remove events which are past the end of the part. DELETETHIS 5
- // No, actually, do remove ALL of them belonging to the part.
- // Just in case there are stray values left after the part end.
- //if(ev.tick() >= len)
- // break;
if(ev.type() == Controller)
{
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index d13f8398..8a7bf39f 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -1893,9 +1893,6 @@ void Song::processMsg(AudioMsg* msg)
case SEQM_REMOVE_TRACK:
cmdRemoveTrack(msg->track);
break;
- //case SEQM_CHANGE_TRACK: DELETETHIS 3
- // changeTrack((Track*)(msg->p1), (Track*)(msg->p2));
- // break;
case SEQM_ADD_PART:
cmdAddPart((Part*)msg->p1);
break;
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
index 6621de35..f6b1403d 100644
--- a/muse2/muse/song.h
+++ b/muse2/muse/song.h
@@ -172,7 +172,20 @@ class Song : public QObject {
~Song();
bool applyOperationGroup(Undo& group, bool doUndo=true);
+
+ /** this sends emits a signal to each MidiEditor or whoever is interested.
+ * For each part which is 1) opened in this MidiEditor and 2) which is
+ * a key in this map, the Editors shall no more edit this part, but instead
+ * all parts in the_map[old_part] (which is a std::set<Part*>)
+ */
void informAboutNewParts(const std::map< Part*, std::set<Part*> >&);
+ /** this sends emits a signal to each MidiEditor or whoever is interested.
+ * For each part which is 1) opened in this MidiEditor and 2) which is
+ * a key in this map, the Editors shall no more edit this part, but instead
+ * all parts in the_map[old_part] (which is a std::set<Part*>)
+ * this is a special case of the general function, which only replaces one part
+ * by up to nine different.
+ */
void informAboutNewParts(Part* orig, Part* p1, Part* p2=NULL, Part* p3=NULL, Part* p4=NULL, Part* p5=NULL, Part* p6=NULL, Part* p7=NULL, Part* p8=NULL, Part* p9=NULL);
void putEvent(int pv);
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
diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp
index cc1e56ac..bced64d6 100644
--- a/muse2/muse/track.cpp
+++ b/muse2/muse/track.cpp
@@ -803,90 +803,6 @@ void MidiTrack::setInPortAndChannelMask(unsigned int portmask, int chanmask)
}
}
-/* DELETETHIS 84
-//---------------------------------------------------------
-// addPortCtrlEvents
-//---------------------------------------------------------
-
-void MidiTrack::addPortCtrlEvents()
-{
- const PartList* pl = cparts();
- for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
- {
- Part* part = ip->second;
- const EventList* el = part->cevents();
- for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
- {
- const Event& ev = ie->second;
- if(ev.type() == Controller)
- {
- int tick = ev.tick() + part->tick();
- int cntrl = ev.dataA();
- int val = ev.dataB();
- int ch = _outChannel;
-
- MidiPort* mp = &MusEGlobal::midiPorts[_outPort];
- // Is it a drum controller event, according to the track port's instrument?
- if(type() == DRUM)
- {
- MidiController* mc = mp->drumController(cntrl);
- if(mc)
- {
- int note = cntrl & 0x7f;
- cntrl &= ~0xff;
- ch = MusEGlobal::drumMap[note].channel;
- mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port];
- cntrl |= MusEGlobal::drumMap[note].anote;
- }
- }
-
- mp->setControllerVal(ch, tick, cntrl, val, part);
- }
- }
- }
-}
-
-//---------------------------------------------------------
-// removePortCtrlEvents
-//---------------------------------------------------------
-
-void MidiTrack::removePortCtrlEvents()
-{
- const PartList* pl = cparts();
- for(ciPart ip = pl->begin(); ip != pl->end(); ++ip)
- {
- Part* part = ip->second;
- const EventList* el = part->cevents();
- for(ciEvent ie = el->begin(); ie != el->end(); ++ie)
- {
- const Event& ev = ie->second;
- if(ev.type() == Controller)
- {
- int tick = ev.tick() + part->tick();
- int cntrl = ev.dataA();
- int ch = _outChannel;
-
- MidiPort* mp = &MusEGlobal::midiPorts[_outPort];
- // Is it a drum controller event, according to the track port's instrument?
- if(type() == DRUM)
- {
- MidiController* mc = mp->drumController(cntrl);
- if(mc)
- {
- int note = cntrl & 0x7f;
- cntrl &= ~0xff;
- ch = MusEGlobal::drumMap[note].channel;
- mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port];
- cntrl |= MusEGlobal::drumMap[note].anote;
- }
- }
-
- mp->deleteController(ch, tick, cntrl, part);
- }
- }
- }
-}
-*/
//---------------------------------------------------------
// newPart