Passing binary data into a function

Is there a way to pass a file from binary data into a function (for example like the loadImpulseResponse function from the convolution class) other than by name? Is the binary data in juce indexed in some way so that an int for example can used as in input argument rather than just going “BInaryData::Example_FIle_Name”? I couldn’t find anything in the documentation…

Thanks in advance :slightly_smiling_face:

Try this:

bool doSomethingWithThisResource(const String& res)
	auto resourceName = res.replace(".", "_").replace("-", "");
	int FileSize = 0;
	auto FileN = BinaryData::getNamedResource(resourceName.toRawUTF8(), FileSize); 
	DBG("Resource Name: " << resourceName << " - Size:" << FileSize);

	if (FileSize <= 0) return false;
	return DoSomethingWith(FileN);

Thank you so much, I wasn’t aware of the getNamedResource function. I had already written a function that generates the correct file names based on knob values from the ui so getNamedResource was all I needed to make this work. You’re a life saver :grin: