Loading sample/files

SDK for VST 3 audio plug-in and host development.
pongasoft
Posts: 44
Joined: Sun Mar 11, 2018 5:57 pm

Loading sample/files

Postby pongasoft » Sat Sep 15, 2018 7:03 pm

Hello

Let's say I would like to build a VST3 plugin that has a bunch of pads. Each pad is a different sample. When the user press a pad it plays the sample/sound associated with that pad for as long as the pad is being held.

Questions:
1) how would I let the user load/assign their own sample (wav, mp3, etc...) with each pad? Is there any classes in the SDK that facilitate this loading?
2) the samples would have to be saved with the VST. Shall they be saved with the regular state (Processor::getState) or differently?
3) I would like the ability for the user to drag and drop their own file on a pad. Is there any classes in the SDK that facilitate this?

Thank you
Yan

pongasoft
Posts: 44
Joined: Sun Mar 11, 2018 5:57 pm

Re: Loading sample/files

Postby pongasoft » Tue Oct 16, 2018 2:15 pm

I found the class CNewFileSelector (<vstgui4/vstgui/lib/cfileselector.h>) in the SDK which opens the a file dialog to select one file which answers my question #1.

So now that I have loaded a sample and I assume there is no help in the SDK to turn the file into an array of samples, but I suppose you can use libsndfile, or similar to do the job... Is that correct?

Once the sample is loaded, it becomes part of the "state" of the plugin since it needs to be restored when the plugin is loaded again later on. Should it be just saved part of the state like any other parameter (getState(IBStream* state))? Or is there a different mechanism that should be used for larger amount of data (sample could be big...)

Any help appreciated.

Thanks
Yan

ygrabit
Posts: 106
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg

Re: Loading sample/files

Postby ygrabit » Fri Oct 19, 2018 3:57 pm

Hi

if this is small data (1 or 2 mega) and you want to be sure the user will move between different computer then you could save it in the plugin state,
but i will recommend to save only a path to this file, and reload it when setState is called....
YVan Grabit


Return to “VST 3 SDK”

Who is online

Users browsing this forum: No registered users and 2 guests