Skip to content

Commit

Permalink
Only apply Streaming fixes when Streaming (surge-synthesizer#1070)
Browse files Browse the repository at this point in the history
Fixes the mis-application of change in surge-synthesizer#1035 by making sure the
chance to handle old streaming versions only occurs when, you know,
you are actually streaming!

Closes surge-synthesizer#1035
  • Loading branch information
baconpaul authored Aug 21, 2019
1 parent 3c2aeca commit c6bb0ab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/pauls-debug-fragments.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ void stackToInfo()
void* callstack[128];
int i, frames = backtrace(callstack, 128);
char** strs = backtrace_symbols(callstack, frames);
for (i = 0; i < frames; ++i) {
printf( "[SurgeRack] StackTrace[%3d]: %s", i, strs[i] );
for (i = 1; i < 8; ++i) {
printf( "StackTrace[%3d]: %s\n", i, strs[i] );
}
free(strs);
#endif
Expand Down
12 changes: 8 additions & 4 deletions src/common/SurgePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,9 @@ void SurgePatch::copy_globaldata(pdata* d)
// pdata scenedata[2][n_scene_params];

void SurgePatch::update_controls(bool init,
void* init_osc) // init_osc is the pointer to the data structure of
// a particular osc to be reinitialized
void* init_osc, // init_osc is the pointer to the data structure of a particular osc to init
bool from_streaming // we are loading from a patch
)
{
for (auto& sc : scene)
{
Expand All @@ -709,9 +710,12 @@ void SurgePatch::update_controls(bool init,
if (t_osc)
{
t_osc->init_ctrltypes();
t_osc->handleStreamingMismatches( streamingRevision, currentSynthStreamingRevision );
if (from_streaming)
t_osc->handleStreamingMismatches( streamingRevision, currentSynthStreamingRevision );
if (init || (init_osc == &sc.osc[osc]))
t_osc->init_default_values();
{
t_osc->init_default_values();
}
delete t_osc;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class SurgePatch
SurgePatch(SurgeStorage* storage);
~SurgePatch();
void init_default_values();
void update_controls(bool init = false, void* init_osc = 0);
void update_controls(bool init = false, void* init_osc = 0, bool from_stream = false);
void do_morph();
void copy_scenedata(pdata*, int scene);
void copy_globaldata(pdata*);
Expand Down
2 changes: 1 addition & 1 deletion src/common/SurgeSynthesizerIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void SurgeSynthesizer::loadRaw(const void* data, int size, bool preset)

storage.getPatch().init_default_values();
storage.getPatch().load_patch(data, size, preset);
storage.getPatch().update_controls(false);
storage.getPatch().update_controls(false, nullptr, true);
for (int i = 0; i < 8; i++)
{
memcpy(&fxsync[i], &storage.getPatch().fx[i], sizeof(FxStorage));
Expand Down

0 comments on commit c6bb0ab

Please sign in to comment.