summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse/muse/route.cpp48
-rw-r--r--muse/muse/route.h9
-rw-r--r--muse/muse/track.cpp7
3 files changed, 57 insertions, 7 deletions
diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp
index 5e474695..3b132bc4 100644
--- a/muse/muse/route.cpp
+++ b/muse/muse/route.cpp
@@ -122,6 +122,13 @@ Route::Route(Track* tr, RouteType t)
type = t;
}
+Route::Route(Track* tr)
+ {
+ track = tr;
+ channel = -1;
+ type = TRACK;
+ }
+
Route::Route(Track* tr, int ch, RouteType t)
{
track = tr;
@@ -315,6 +322,7 @@ QString Route::name() const
case MIDIPORT:
return midiDriver->portName(port);
}
+ return QString("?");
}
//---------------------------------------------------------
@@ -458,9 +466,45 @@ const char* Route::tname() const
// write
//---------------------------------------------------------
-void Route::write(Xml& xml, const char* name)
+void Route::write(Xml& xml, const char* label) const
{
xml.put("<%s type=\"%s\" channel=\"%d\" stream=\"%d\" name=\"%s\"\>",
- name, tname(), channel + 1, stream, name().toUtf8().data());
+ label, tname(), channel + 1, stream, name().toUtf8().data());
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void Route::write(Xml& xml, const char* label, const Track* track)
+ {
+// xml.put("<%s type=\"%s\" channel=\"%d\" stream=\"%d\" name=\"%s\"\>",
+// label, tname(), channel + 1, stream, name().toUtf8().data());
+ }
+
+//---------------------------------------------------------
+// read
+//---------------------------------------------------------
+
+void Route::read(QDomNode node)
+ {
+ QDomElement e = node.toElement();
+ QString st = e.attribute("type", "TRACK");
+ if (st == "TRACK")
+ type = Route::TRACK;
+ else if (st == "AUDIOPORT")
+ type = Route::AUDIOPORT;
+ else if (st == "MIDIPORT")
+ type = Route::MIDIPORT;
+ else if (st == "SYNTIPORT")
+ type = Route::SYNTIPORT;
+ else {
+ printf("Route::read(): unknown type <%s>\n", st.toLatin1().data());
+ type = Route::TRACK;
+ }
+ channel = e.attribute("channel","0").toInt() - 1;
+ stream = e.attribute("stream", "0").toInt();
+ QString nm = e.attribute("name");
}
+
diff --git a/muse/muse/route.h b/muse/muse/route.h
index 37f0ea05..fe862041 100644
--- a/muse/muse/route.h
+++ b/muse/muse/route.h
@@ -22,6 +22,12 @@
#define __ROUTE_H__
class Track;
+namespace AL {
+ class Xml;
+ };
+using AL::Xml;
+
+
typedef void* Port;
//---------------------------------------------------------
@@ -47,7 +53,8 @@ struct Route {
Route(Track*, int, RouteType);
QString name() const;
void read(QDomNode node);
- void write(Xml&, const char* name);
+ void write(Xml&, const char* name) const;
+ static void write(Xml&, const char* name, const Track*);
bool operator==(const Route& a) const;
bool isValid() const { return track != 0; }
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index aebb851d..dbf90c84 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -669,17 +669,16 @@ void Track::writeRouting(Xml& xml) const
for (ciRoute r = rl->begin(); r != rl->end(); ++r) {
Route dst(name(), r->channel, Route::TRACK);
xml.tag("Route");
- xml.put("<src type=\"%s\" name=\"%s\"\>",
+ xml.put("<src type=\"%s\" name=\"%s\"/>",
Route::tname(rt), r->name().toLatin1().data());
- xml.put("<dst type=\"TRACK\" name=\"%s\"\>",
+ xml.put("<dst type=\"TRACK\" name=\"%s\"/>",
dst.name().toLatin1().data());
xml.etag("Route");
}
}
for (ciRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r) {
xml.tag("Route");
- Route src(this);
- src->write(xml, "src");
+ Route::write(xml, "src", this);
r->write(xml, "dst");
xml.etag("Route");
}