zynthian / zynthian-issue-tracking

Centralized Issue Tracking for Zynthian Project
https://github.com/orgs/zynthian/projects/1
11 stars 3 forks source link

Bug: Sometimes saving a patch causes the presets_Obxa.json file to become corrupted #905

Open polluxsynth opened 1 year ago

polluxsynth commented 1 year ago

Describe the bug Sometimes when saving an LV2 preset (bold click select -> select synth plugin -> select 'save preset'), the presets json file (in my case presets_Obxa.json) becomes corrupted, with the url field for the newly saved preset, as well as other neighbouring presets, instead of being a file:///... url contains a parameter name and associated value. Upon subsequent loading of the patch, Obxa seems to crash, emitting a short bleep and then going silent, necessitating a reload of the snap shot to bring it up again.

This does not happen every time. A rough guesstimate is once every 5 or 10 saves or so.

To Reproduce Steps to reproduce the behavior:

  1. Bring up an Obxa preset
  2. Edit it in the Zynthian UI.
  3. Save it: Bold click select -> select synth plugin -> select 'save preset' -> edit name -> Enter).
  4. Attempt to play the preset, either directly after saving, or selecting it from the preset list.
  5. The bug is not always triggered, but when it is, Obxa will be silent, possibly after emitting a short bleep, no matter which preset is subsequently selected.

Expected behavior Saving a preset should just save it with no adverse effect when subsequently played.

Screenshots See attached files. presets_Obxd.json-bad2 is after saving, note the url for Heavy_resonance_bass.lv2 . presets_Obxd.json is the file manually patched to add the proper file url.

Setup: Hardware (Zynthian v4.4): Raspberry Pi 4 Model B Rev 1.4 Audio: [HifiBerry DAC+ ADC PRO] Display: [ZynScreen 3.5 (v1)] Wiring: [MCP23017_ZynScreen] I2C: [MCP23017@0x20, MCP23017@0x21, ADS1115@0x48, MCP4728@0x61] Software: (latest stable at time of writing) zyncoder: stable (83acc8b) zynthian-ui: [stable (3ce8a5e)] zynthian-sys: [stable (37e06cc)] zynthian-data: [stable (1321e5d)] zynthian-webconf: [stable (f7d0f1e)]

Additional context This is essentially the same bug as described in https://github.com/zynthian/zynthian-issue-tracking/issues/903, but at that time I thought it was corruption due to something that happened several versions back, and that the initial problem was something wrong in the preset (lv2) file. However for the issue at hand, all was well until a new patch was saved, so it must be a problem with the current version. The lv2 files are all ok, and when the json file is manually edited and the correct url entered, the presets load fine.

Also, I noted that not just the last saved preset had issues, three other presets, Cllick Organ, Magnetic Field and Bowed Pad were also corrupted in a similar way (albeit with different parameter names in the url field). I don't know if this happened at the same time or it is the result of earlier saves.

presets_Obxd.zip

polluxsynth commented 1 year ago

Speculation, not yet verified: The problem is related to exactly which state the editor is in when bold clicking Select to initiate the save process (recently having edited a parameter, recently having scrolled long the page list, etc).