I would like to decode OGG data (NKS preview files) directly from memory into memory, so users can listen to a short preview if the NKS preview-files are installed from within my own browser.
The idea is that if a preset is selected (just selected, not double clicked or anything), the code would load the entire OGG file into memory (it’s maximum of six seconds long) and decode it into memory, where it can then be mixed into the output of the plugin for instant preview (similar how it works in the Komplete Kontrol browsers).
I’ve looked at the OggVorbisAudioFormat class etc. but it seems a bit convoluted. Is there a demo somewhere, or can somebody with more experience in that field post a short code-snipped?
Is there some particular reason you want the file decoded in memory too? Because you could just load the source file into memory and create an AudioFormatReader out of that memory block with AudioFormatManager. Or you could even just read and decode the file directly from disk, but you might want to do some buffered reading for that, though…(JUCE has the BufferingAudioReader for that.)
@Xenakios Yes, I wanted to read from memory, so I can pre-cache the previous and next previews in memory myself and then trigger the decoding once the cursor moves.