plugdata-team / plugdata

Pure Data as a plugin, with a new GUI
https://plugdata.org
GNU General Public License v3.0
1.56k stars 65 forks source link

Feature - Remember settings in compile window #1202

Closed whocano closed 1 year ago

whocano commented 1 year ago

Would be handy if Plugdata could remember the last settings in the compile window at least while it is open. Or ideally it would store the last used settings for each of the recently opened patches.

timothyschoen commented 1 year ago

I agree, I'll fix this soon!

timothyschoen commented 1 year ago

Done!

whocano commented 11 months ago

Thank you @timothyschoen , but using the nightly now I see another issue: I use a custom json file and linker and these are not remembered, so while it still says "custom json", it will try to compile and then not find the controls. So I have to select another Target Board, go back to custom and then select the file. Can this be amended please?

dromer commented 11 months ago

@whocano hmm are you sure? I added the linker specifically with storing the settings in mind and have tested this myself several times (turning off plugdata, then trying the flash again, etc.):

https://github.com/plugdata-team/plugdata/blob/main/Source/Heavy/DaisyExporter.h#L79

whocano commented 11 months ago

Sorry you are right about the linker. But the JSON does get lost.

dromer commented 11 months ago

This should also get stored in the state file: https://github.com/plugdata-team/plugdata/blob/main/Source/Heavy/DaisyExporter.h#L72

whocano commented 11 months ago

Hmm well in the nightly I installed earlier today, it certainly doesn't work:

--> Generating Daisy module
  1) Error c2daisy: Unknown parameter "fs1"
dromer commented 11 months ago

Please check the settingsfile. I see the full path to my custom json there when the state is saved:

  <HeavyState>
    <HeavySelect listBox="1"/>
    <CPP inputPatchValue="1" projectNameValue="" projectCopyrightValue=""/>
    <Daisy inputPatchValue="1" projectNameValue="helloworld" projectCopyrightValue=""
           customBoardDefinitionValue="/home/dreamer/Sources/_audio/_electro-smith/pd2dsy/field.json"
           targetBoardValue="8" exportTypeValue="3" usbMidiValue="0" debugPrintValue="1"
           patchSizeValue="4" appTypeValue="2" customLinkerValue="/home/dreamer/Downloads/_bin/pd2dsyGUI/data/util/qspi_linker_sdram.lds"/>
    <DPF inputPatchValue="1" projectNameValue="helloworld" projectCopyrightValue=""
         midiinEnableValue="0" lv2EnableValue="0" vst2EnableValue="0"
         vst3EnableValue="0" clapEnableValue="0" jackEnableValue="1" exportTypeValue="2"
         pluginTypeValue="1"/>
    <PdExt inputPatchValue="1" projectNameValue="lorenztest" projectCopyrightValue=""
           exportTypeValue="2" copyToPath="1"/>
  </HeavyState>

However maybe the problem is with this line? -> https://github.com/plugdata-team/plugdata/blob/main/Source/Heavy/DaisyExporter.h#L145

Maybe this entire else clause needs to be removed. It looks like the value gets overwritten with an empty File() instance.

whocano commented 11 months ago

Yeah the path is correct in the settings file. It just doesn't seem to use it.

timothyschoen commented 11 months ago

Interesting, what OS are you using? Maybe we need to replace some "\" with "/" somewhere, if you're on Windows that is.

dromer commented 11 months ago

@timothyschoen they explained on Discord that they are on macOS. Was also wondering if that is part of the issue.

The linker path being restored correctly, but not the board.json is really odd. The get/set is exactly the same afaict.

whocano commented 11 months ago

So I had another look. After running compile with newly selecting JSON and linker files, the relevant part of the settings file looks like this:

  <HeavyState>
    <HeavySelect listBox="1"/>
    <CPP inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""/>
    <Daisy inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""
           customBoardDefinitionValue="/Users/XYZ/Documents/Puredata/terrarium.json"
           targetBoardValue="8" exportTypeValue="3" usbMidiValue="0" debugPrintValue="0"
           patchSizeValue="4" appTypeValue="2" customLinkerValue="/Users/XYZ/Documents/GitHub/pd2dsy/util/sram_linker_sdram.lds"/>
    <DPF inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""
         midiinEnableValue="0" lv2EnableValue="1" vst2EnableValue="1"
         vst3EnableValue="1" clapEnableValue="1" jackEnableValue="0" exportTypeValue="2"
         pluginTypeValue="1"/>
    <PdExt inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""
           exportTypeValue="2" copyToPath="0"/>
  </HeavyState>

whereas after reopening and rerunning it (without changing any values or files) it looks like this:

  <HeavyState>
    <HeavySelect listBox="1"/>
    <CPP inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""/>
    <Daisy inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""
           customBoardDefinitionValue="" targetBoardValue="8" exportTypeValue="3"
           usbMidiValue="0" debugPrintValue="0" patchSizeValue="4" appTypeValue="2"
           customLinkerValue="/Users/XYZ/Documents/GitHub/pd2dsy/util/sram_linker_sdram.lds"/>
    <DPF inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""
         midiinEnableValue="0" lv2EnableValue="1" vst2EnableValue="1"
         vst3EnableValue="1" clapEnableValue="1" jackEnableValue="0" exportTypeValue="2"
         pluginTypeValue="1"/>
    <PdExt inputPatchValue="1" projectNameValue="terrarium_delay" projectCopyrightValue=""
           exportTypeValue="2" copyToPath="0"/>
  </HeavyState>

So you can see that it is saved, but then somehow lost during the restoration of the data.

dromer commented 11 months ago

I can confirm this behavior!

The setting is there, then I do an export (can even be just source-code) and then this field in the settings is empty.

Still no clue why though ..

dromer commented 11 months ago

Removing the else clause as I pointed to before seems to solve this issue. I'm not sure why it gets triggered, but I don't see a reason to have this else there in the first place