Locating sound files ressources in a generic way


#1

We are adding soundfile support in our faust2juce script. We generate plugins that will have to embed some sound files, then locate and load them. Are they some facilities in JUCE to:

  • copy additional ressources (like soundfile in this case…) in the generated plugin, in a generic way (that is not depending of the particular plugin model…)
  • the locate the ressources so that our audio file loading code can be used

BTW we are using libsndfile for now to load the audio files in the generated binaries. Il means libsndfile code has to be linked in the final code. Does JUCE offer audio file related services that could be used instead of libsndfile in this particular case?
Thanks


#2

JUCE does have facilities to allow compiling in data into the binary and using it. But you might want to consider if you really want to be using that for something as big as audio files. Is there a good reason for wanting to have the sound files be part of the plugin binary?

JUCE has good facilities for dealing with reading and writing audio files, there should be no need to deal with libsndfile while using JUCE.


#3

If the audio files are not put directly in the final binary, what the the correct way to distribute them and have the plugin code load them?


#4

I’d probably have them something like this :

VSTPluginDirectory/MyPlugin.dll
VSTPluginDirectory/MyPluginData/Samples/001.wav
VSTPluginDirectory/MyPluginData/Samples/002.wav
etc

Then in the code use File::getSpecialLocation with currentExecutableFile as parameter to help form the absolute paths into the files.

Obviously other schemes could be used as well. Also you might be able to get away with having the data built into the plugin binary, but it can get problematic with large amounts of data, so generally I would suggest avoiding that.


#5

I don’t think having any resource files inside the vst folder is a good idea. It’s better to store them under Application Data folder (or similar). This way you don’t need duplicate files for different plugin formats and standalone app. And it’s easy to organize the plugin files inside plugin folders after that.

  • Jussi

#6

Right, but it wouldn’t be any different space usage wise compared to how the original poster wanted to do it in the first place. :wink:


#7

Rail


#8

We are adding them into bundle on mac and have a structure similar to the one described by @Xenakios on windows. The windows installer writes an entry to the registry about the location of the sound files.