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_)
{
clear();

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

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

}[/code]

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!