Short story - I want thumbnails for my CD tracks but juce::AudioThumbnail only accepts InputSources.
This is a pity, as that InputSource is only used to create an AudioFormatReader, and I can easily make an AudioCDReader, which is an AudioFormatReader.
I could imagine that anyone wanting to do CD thumbnails would have this issue - or someone wanting to do thumbnails of any other non-standard representation, e.g. URLs.
I was able to easily solve this issue by adding a single method to juce::AudioThumbnail, void setReader (AudioFormatReader* reader, int64 hashCode);This works fine on my development system, at least, and I don’t see any reason why it would not work in general.
The full code is here: void AudioThumbnail::setReader (AudioFormatReader* reader_, int64 hashCode) {
if (! (cache.loadThumb (*this, hashCode) && isFullyLoaded()))
{
{
const ScopedLock sl (readerLock);
reader = reader_;
}
if (reader != 0)
{
initialiseFromAudioFile (*reader);
cache.addThumbnail (this);
}
}
}
Jules,
what about adding a method to AudioThumbnailCache that would let save and load the whole content of it to a file?
I know there are already AudioThumbnailCache::storeThumb and AudioThumbnailCache::loadThumb,
but I’d like to be able to load the content before creating the thumbnails.
These let me store and load the whole cache to/from a file, BEFORE creating the thumbnails. In this way, when the thumbnails get re-created (and they use AudioThumbnail::setReader), the waveforms are immediately fully loaded.
I don’t know if you like the idea, but could this be an addition to the AudioThumbnailCache class?