Skip to content

Commit

Permalink
Favorites didn't survive a refresh (surge-synthesizer#5226)
Browse files Browse the repository at this point in the history
NOw they do
  • Loading branch information
baconpaul authored Oct 7, 2021
1 parent f13072e commit 5ced8f7
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,6 @@ SurgeStorage::SurgeStorage(std::string suppliedDataPath) : otherscene_clients(0)
{
refresh_wtlist();
refresh_patchlist();
auto favorites = patchDB->readUserFavorites();
std::unordered_set<std::string> favSet;
for (auto f : favorites)
{
favSet.insert(f);
}
for (auto &p : patch_list)
{
auto ps = p.path.u8string();
if (favSet.find(ps) != favSet.end())
p.isFavorite = true;
else
p.isFavorite = false;
}
}

getPatch().scene[0].osc[0].wt.dt = 1.0f / 512.f;
Expand Down Expand Up @@ -733,6 +719,21 @@ void SurgeStorage::refresh_patchlist()
{
patch_category[patchCategoryOrdering[i]].order = i;
}

auto favorites = patchDB->readUserFavorites();
std::unordered_set<std::string> favSet;
for (auto f : favorites)
{
favSet.insert(f);
}
for (auto &p : patch_list)
{
auto ps = p.path.u8string();
if (favSet.find(ps) != favSet.end())
p.isFavorite = true;
else
p.isFavorite = false;
}
}

void SurgeStorage::refreshPatchlistAddDir(bool userDir, string subdir)
Expand Down

0 comments on commit 5ced8f7

Please sign in to comment.