whoops, time signature wasn't saved :|

portability/boost
zetaPRIME 2019-01-09 03:36:16 -05:00
parent 9bb2a38a90
commit bb973babc9
1 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,13 @@ bool Xybrid::FileOps::saveProject(std::shared_ptr<Project> project, QString file
for (auto p : project->patterns) {
QCborMap pm;
pm.insert(QString("name"), QString::fromStdString(p->name));
{
QCborArray ts;
ts << p->time.beatsPerMeasure << p->time.rowsPerBeat << p->time.ticksPerRow;
pm.insert(QString("time"), ts);
}
QCborArray chns;
bool needsCount = true;
for (auto& ch : p->channels) {
@ -150,6 +157,9 @@ std::shared_ptr<Xybrid::Data::Project> Xybrid::FileOps::loadProject(QString file
project->patterns.push_back(p);
p->name = pm.value("name").toString().toStdString();
if (auto ts = pm.value("time").toArray(); !ts.empty())
p->time = Data::TimeSignature(static_cast<int>(ts[0].toInteger()), static_cast<int>(ts[1].toInteger()), static_cast<int>(ts[2].toInteger()));
auto chns = pm.value("channels").toArray();
for (auto chm_ : chns) {
if (chm_.isInteger()) { // can have a number of rows encoded as part of the channels map