summaryrefslogtreecommitdiff
path: root/src/projectserialiser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/projectserialiser.cc')
-rw-r--r--src/projectserialiser.cc56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/projectserialiser.cc b/src/projectserialiser.cc
index 44f9ff7..f70e6dd 100644
--- a/src/projectserialiser.cc
+++ b/src/projectserialiser.cc
@@ -128,6 +128,15 @@ QString ProjectSerialiser::serialise(const Project& project)
for(const auto& i : project.instruments)
{
auto instrument = doc.createElement("instrument");
+
+ instrument.setAttribute("attack_length", (int)i.getAttackLength());
+ instrument.setAttribute("power_spread", (int)i.getPowerSpread());
+ instrument.setAttribute("minimum_size", (int)i.getMinimumSize());
+ instrument.setAttribute("falloff", (int)i.getFalloff());
+ instrument.setAttribute("fade_length", (int)i.getFadeLength());
+
+ instrument.setAttribute("threshold", i.getThreshold());
+
instruments.appendChild(instrument);
auto instrument_name = doc.createElement("instrument_name");
@@ -145,6 +154,24 @@ QString ProjectSerialiser::serialise(const Project& project)
file.setAttribute("master", i.master_file == f.first);
file_list.appendChild(file);
}
+
+ auto regions = doc.createElement("regions");
+ regions.setAttribute("nextid", i.selections.nextid);
+ regions.setAttribute("act", i.selections.act);
+ instrument.appendChild(regions);
+
+ for(auto r = i.selections.sels.begin(); r != i.selections.sels.end(); ++r)
+ {
+ auto region = doc.createElement("region");
+ region.setAttribute("id", (int)r.key());
+ region.setAttribute("from", (int)r.value().from);
+ region.setAttribute("to", (int)r.value().to);
+ region.setAttribute("fadein", (int)r.value().fadein);
+ region.setAttribute("fadeout", (int)r.value().fadeout);
+ region.setAttribute("energy", r.value().energy);
+ region.setAttribute("name", r.value().name);
+ regions.appendChild(region);
+ }
}
return doc.toString();
@@ -192,8 +219,33 @@ bool ProjectSerialiser::deserialise(const QString& data, Project& project)
}
file_list.push_back(qMakePair(file.text(), file["name"]));
}
- project.instruments.back().file_list = file_list;
- project.instruments.back().master_file = master_file;
+
+ instr.file_list = file_list;
+ instr.master_file = master_file;
+
+ instr.attack_length = instrument["attack_length"].toInt();
+ instr.power_spread = instrument["power_spread"].toInt();;
+ instr.minimum_size = instrument["minimum_size"].toInt();
+ instr.falloff = instrument["falloff"].toInt();
+ instr.fade_length = instrument["fade_length"].toInt();
+
+ instr.threshold = instrument["threshold"].toFloat();
+
+ auto selections = instrument("regions");
+ instr.selections.nextid = selections["nextid"].toInt();
+ instr.selections.act = selections["act"].toInt();
+
+ for(auto& selection : selections.children())
+ {
+ Selection s;
+ s.from = selection["from"].toInt();
+ s.to = selection["to"].toInt();
+ s.fadein = selection["fadein"].toInt();
+ s.fadeout = selection["fadeout"].toInt();
+ s.energy = selection["energy"].toFloat();
+ s.name = selection["name"];
+ instr.selections.sels[selection["id"].toInt()] = s;
+ }
}
return true;