PDA

View Full Version : load sample bank on startup ?


DukeRoodee
07-22-2009, 01:42 PM
Hello :-)

i´ve developed a sample player w/ some special features for my needs and am currently looking for a framework to build a GUI around it. I found IPlug, which looks very promising. I could also build and test the example project and everything looks straight-forward, so for me IPlug is the best choice at the moment.
There is one thing i´d like to know / understand.
Imagine I load a sample bank at runtime (using the IFileSelectorControl).
Somehow i want the host to keep the information (=file name of the sample bank), so that i can automatically load it on restart (of the corresponding project, of course).
How do i make that ? There is a good parameter handing between host and plugin, serialisation and deserialisation of parameters (so the host can save/reset everything on startup if i understand this right) ... but all the parameters are basically numerical values. I can impossibly code a whole filename with path into a double or so.
Some ideas how i could implement this ?

thanks & best regards
Rudi

DukeRoodee
07-23-2009, 01:28 AM
After a few hours of investigation i think i found the solution.

I´ll have to override the

virtual bool SerializeState(ByteChunk* pChunk)
virtual int UnserializeState(ByteChunk* pChunk, int startPos)

methods and store/readout my filenames in/from the ByteChunk using

inline int PutStr(const char* str)
inline int GetStr(WDL_String* pStr, int startPos)

right ? :-)

cc_
07-23-2009, 08:50 AM
I haven't actually done in, but I think you're right.

You also need to set plugDoesChunks=true when you construct your plugin, which you do using the #define PLUG_DOES_STATE_CHUNKS in resource.h (assuming you're using IPLUG_CTOR() to do the constructing).