Some tiny tweaks needed for AudioThumbnail in "passive" mode


I have a theory :smiley: that I’m the only one yet to use the thumbnail in what I call passive mode, when you call addBlock yourself…

because it seems that you need a little more to make it actually work, specifically:

[code]void AudioThumbnail::reset (int newNumChannels, double newSampleRate, int totalSamples_)

    numChannels = newNumChannels;
    sampleRate = newSampleRate;
    totalSamples = totalSamples_;

    createChannels (1 + (int) (totalSamples / samplesPerThumbSample));


I haven’t updated Juce in a week or two, if this is a known issue.

I’m also having some issue with writing the thumbnails - they are huge (50MB for a song-length stereo track at 512 samples/sample) and when I read them back, I don’t get an error - but I don’t get a thumbnail displayed either! BUT I haven’t debugged this it and statistically it’s probably my code.

(First edit: actually, reading the thumbnail from my disk cache works fine - it just takes a long time because it’s so large! Now to figure out why it’s so large - perhaps my samples per sample rate is much too low…)

(Second edit: I corrected my code above to divide by “samplesPerThumbSample” in createChannels() so now my samples are 512 times smaller. :-D)


Just wanted to update this thread, he says with a wink. Sorry for all the traffic on the forum, hope it’s all contributory.

I’m using the tweak in the above message for “passive” thumbnails and it works very well - in specific, I can get thumbnails of CD tracks while playing them, which was my Ultima Thule. And, I don’t see any way that anyone else could use addBlock() to update without my tweak or one much like it.


I’ve already added and checked-in a suitable tweak!


Hah! Well done!

This is the only software project I ever worked with where it always pays to be on the bleeding edge!