Best Practice for storing large amounts of Data with a patch

Yes. When done right the asset(s) gets included in the autosave dir and packaged up with the patch. Andrew gave an example in here long time ago but otherwise probably look at the VCV Wavetable VCO code.

Ah, here it is in Fundamental/WTVCO.cpp at v2 · VCVRack/Fundamental · GitHub

	void onAdd(const AddEvent& e) override {
		std::string path = system::join(getPatchStorageDirectory(), "wavetable.wav");
		// Silently fails
		wavetable.load(path);
	}

	void onSave(const SaveEvent& e) override {
		if (!wavetable.samples.empty()) {
			std::string path = system::join(createPatchStorageDirectory(), "wavetable.wav");
			wavetable.save(path);
		}
	}
3 Likes