FIXED - Reaper setStateInformation bug

Up until now after I started fixing my previous perfectly working standalone synth, into a DAW multi instance plugin, I only used my favorite DAW Reaper for testing.

Today as a test I tried to change my wavetable size, and note that I save and restore my fully editable tables in getStateInformation / setStateInformation, I experienced a bug that took me several hours to finally conclude that it was a Reaper problem, and not me.

So up until this morning my wavetable size was 4096 and I wanted to test if I could hear any difference using a smaller size of 2048, to conserve memory and DAW project plus patch file size.

So Reaper kept insisting on using a size of 4096 and load my waveform as 4096 in size, even starting a brand new project. I used debug to find out how that could be. So inserting my synth in Reaper does the following;

  1. At the end of PluginProcessor’s constructor I call a method that sets all synth parameters to default, including creating default waveforms and tables.
  2. getStateInformation is called twice in a row. I can see here that my tablesize and first many floats of the first wavetable is what it should be.
  3. setStateInformation is called and when it gets to loading my tablesize and tables, it overrides what getStateInformation just created, and instead loads what must be an old cached version, which I have no idea where it is getting it’s information from.

I tried to restart Reaper, and flush plugin cache and rescan all plugins, which made no difference.

To confirm that it is most likely a Reaper problem, I download Traktion’s “Waveform Free”, inserted my synth and bang no problem!

I should mention that if I with Reaper after having started a new project, inserted my synth, and via my PluginEditor invoke my “Synth Master Reset”, save the project, exit Reaper and reload the project, the information retrieved via setStateInformation is 100% correct. So to clarify the problem is only when creating a new project, or inserting a new track with my synth on an existing project, not when loading a project with one or more of my synth’s on tracks.

Any idea what could be going on?

So you are saying that on a fresh new project, Reaper calls setStateInformation when you insert your plugin?

I do not own Reaper, but my first guess would be that you (or Reaper itself) saved a default plugin preset, and now each time you insert your plugin, Reaper applies the said preset.

1 Like

Eureka and thank you VERY much! I’ve been trying to track this problem down for hours, and the solution was so simple - wow!