| 2873 | } |
| 2874 | |
| 2875 | void ModularSynth::SaveState(std::string file, bool autosave) |
| 2876 | { |
| 2877 | if (!autosave) |
| 2878 | { |
| 2879 | mCurrentSaveStatePath = file; |
| 2880 | std::string filename = File(mCurrentSaveStatePath).getFileName().toStdString(); |
| 2881 | mMainComponent->getTopLevelComponent()->setName("bespoke synth - " + filename); |
| 2882 | TheTitleBar->DisplayTemporaryMessage("saved " + filename); |
| 2883 | } |
| 2884 | |
| 2885 | mAudioThreadMutex.Lock("SaveState()"); |
| 2886 | |
| 2887 | //write to a temp file first, so we don't corrupt data if we crash mid-save |
| 2888 | std::string tmpFilePath = ofToDataPath("tmp"); |
| 2889 | |
| 2890 | { |
| 2891 | FileStreamOut out(tmpFilePath); |
| 2892 | |
| 2893 | mZoomer.WriteCurrentLocation(-1); |
| 2894 | out << GetLayout().getRawString(true); |
| 2895 | mModuleContainer.SaveState(out); |
| 2896 | mUILayerModuleContainer.SaveState(out); |
| 2897 | } |
| 2898 | |
| 2899 | juce::File writtenFile(tmpFilePath); |
| 2900 | juce::File targetFile(file); |
| 2901 | writtenFile.copyFileTo(targetFile); |
| 2902 | |
| 2903 | mAudioThreadMutex.Unlock(); |
| 2904 | } |
| 2905 | |
| 2906 | void ModularSynth::SetStartupSaveStateFile(std::string bskPath) |
| 2907 | { |
no test coverage detected