Loading audio file from binary data


#1

Just trying to load a wav file from the BinaryData class that i’ve built using the jucer binary builder.

Had no problems with images, but stuck on what to do with audio…
audioFile[0] is of type ‘File’.

I’ve tried the following…

audioFile[0].appendData(BinaryData::MR16_BD_01_C2A_wav, BinaryData::MR16_BD_01_C2A_wavSize);

//same using replaceWithData

Also tried without using files, using the MemoryInputStream method as demonstrated in the Juce demo. However I need to be able to load 8 different files into 8 different transports…

Would preferably like to use ‘File’ if it can be done…

Thanks


#2

This data is already loaded in your process’s memory. Writing it to file and then reading another copy of it back into memory would be… well, pretty daft. Just use MemoryInputStream (and make sure to set the constructor parameter that tells it not to make a copy of the data).