MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / SaveState

Method SaveState

Source/ModularSynth.cpp:2875–2904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2873}
2874
2875void 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
2906void ModularSynth::SetStartupSaveStateFile(std::string bskPath)
2907{

Callers 1

DuplicateModuleMethod · 0.45

Calls 6

ofToDataPathFunction · 0.85
LockMethod · 0.80
WriteCurrentLocationMethod · 0.80
getRawStringMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected