summaryrefslogtreecommitdiff
path: root/muse2/muse/remote/pyapi.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2013-09-18 23:54:35 +0200
committerFlorian Jung <flo@windfisch.org>2013-09-18 23:54:35 +0200
commitb3fc353a09496ee0aea7099d72e6963f4c2fc774 (patch)
tree83ab91e988c59076d81ebddc09e8ff274dee8af5 /muse2/muse/remote/pyapi.cpp
parent48a93993cfce160fb7d4cf0b67b4b77e22db19e5 (diff)
parent85a51421d44f3893a1010f77e0418caf6be70235 (diff)
Merge branch 'audiomsg_overhaul' (nonshared eventlists and more)
This introduces the following changes: - Clone Parts no more share their eventlist. Instead, all changes made to one clone are replicated to the other clones' eventlists - audio/song->msg{Add,Delete,Change}{Part,Event,Track} have been replaced by the corresponding UndoOp operations. - Enforcing of const-correctness: No GUI code may ever gain writable access to audio/midi/song data structures. Access must *always* go through applyOperationGroup. This is now enforced. - Removed a bunch of DELETETHIS or REMOVE or otherwise commented out code - Removed dead code - Removed unused Audio Messages (that should go through applyOpGroup anyway.)
Diffstat (limited to 'muse2/muse/remote/pyapi.cpp')
-rw-r--r--muse2/muse/remote/pyapi.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp
index 7e03fa0e..8f5abe06 100644
--- a/muse2/muse/remote/pyapi.cpp
+++ b/muse2/muse/remote/pyapi.cpp
@@ -199,9 +199,9 @@ PyObject* getParts(PyObject*, PyObject* args)
Py_DECREF(pstrtick2);
// Pack midi events into list before wrapping it all up
- EventList* events = mpart->events();
+ const EventList& events = mpart->events();
PyObject* pyevents = Py_BuildValue("[]");
- for (ciEvent e = events->begin(); e != events->end(); e++) {
+ 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;
@@ -331,7 +331,7 @@ bool addPyPartEventsToMusePart(MidiPart* npart, PyObject* part)
event.setC(data[2]);
event.setTick(etick);
event.setLenTick(elen);
- npart->events()->add(event);
+ npart->nonconst_events().add(event);
}
else
printf("Unhandled event type from python: %s\n", type.c_str());
@@ -404,12 +404,12 @@ PyObject* modifyPart(PyObject*, PyObject* part)
npart->setLenTick(opart->lenTick());
npart->setSn(opart->sn());
- for (iEvent e = opart->events()->begin(); e != opart->events()->end(); e++) {
+ for (ciEvent e = opart->events().begin(); e != opart->events().end(); e++) {
Event& event = e->second;
if (event.type() == Note || event.type() == Controller)
continue;
- npart->events()->add(event);
+ npart->nonconst_events()->add(event);
}
addPyPartEventsToMusePart(npart, part);
@@ -1131,9 +1131,7 @@ bool Song::event(QEvent* _e)
break;
}
case QPybridgeEvent::SONG_ADD_TRACK: {
- MusECore::Undo operations;
- MusEGlobal::song->addTrack(operations, (Track::TrackType)e->getP1()); // Add at end of list.
- MusEGlobal::song->applyOperationGroup(operations);
+ MusEGlobal::song->addTrack((Track::TrackType)e->getP1()); // Add at end of list.
break;
}
case QPybridgeEvent::SONG_CHANGE_TRACKNAME: {