Skip to content

Commit

Permalink
only write cached msds to 4 values and optimize the load function for…
Browse files Browse the repository at this point in the history
… this
  • Loading branch information
MinaciousGrace committed May 3, 2017
1 parent 5c5d834 commit 4df4581
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/NotesLoaderSSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,14 @@ void SetChartKey(StepsTagInfo& info) {
info.steps->SetChartKey((*info.params)[1]);
}

void strsplit(vector<float>& o, const RString& s, size_t i) {
size_t j = s.find(",", i);
o.emplace_back(StringToFloat(s.substr(i, j - 1)));
if (j != s.npos)
strsplit(o, s, j + 1);
vector<float> msdsplit(const RString& s) {
vector<float> o;
size_t nchar = s.size();
int numrates = static_cast<int>(nchar / 5.f);

for (size_t i = 0; i < numrates; ++i)
o.emplace_back(StringToFloat(s.substr(i * 5, 5)));
return o;
}

void SetMSDValues(StepsTagInfo& info) {
Expand All @@ -538,11 +541,8 @@ void SetMSDValues(StepsTagInfo& info) {
auto params = (*info.params);
auto size = params.params.size();
// Start from index 1
for (size_t i = 1; i <= size; i++) {
vector<float> diffs;
strsplit(diffs, params[i], 0);
o.push_back(diffs);
}
for (size_t i = 1; i <= size; i++)
o.emplace_back(msdsplit(params[i]));
info.steps->SetAllMSD(o);
}

Expand Down
2 changes: 1 addition & 1 deletion src/NotesWriterSSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RString MSDToString(MinaSD x) {
RString o = "";
for (size_t i = 0; i < x.size(); i++) {
for (size_t ii = 0; ii < x[i].size(); ii++) {
o.append(to_string(x[i][ii]));
o.append(to_string(x[i][ii]).substr(0,5));
if (ii != x[i].size() - 1)
o.append(",");
}
Expand Down

0 comments on commit 4df4581

Please sign in to comment.