AudioThumbnail Bug, or just User Error :)

I’m not entirely sure what I’m doing wrong. I’ve written similar code that works fine in OS X, but my component shows this y offset error under windows. Below is the .cpp code for my component. I can provide the .h code upon request.

As a side note (don’t know if this matters) but I’m resizing the component in my MainComponent after I new up the instance of AudioThumbnailComponent.

[code]#include “AudioThumbnailComponent.h”

//[MiscUserDefs] You can add your own user definitions and misc code here…

AudioThumbnailComponent::AudioThumbnailComponent (int numSamples, AudioFormatManager & mgr, AudioThumbnailCache & cache)
: groupComponent (0),
mpThumbnail (0)
addAndMakeVisible (groupComponent = new GroupComponent (T(“new group”),

mpThumbnail = new AudioThumbnail (numSamples, mgr, cache);


setSize (400, 150);

//[Constructor] You can add your own custom stuff here..


//[Destructor_pre]. You can add your own custom destruction code here…

deleteAndZero (groupComponent);
deleteAndZero (mpThumbnail);

//[Destructor]. You can add your own custom destruction code here..


void AudioThumbnailComponent::paint (Graphics& g)
//[UserPrePaint] Add your own custom painting code here…

//g.fillAll (Colours::white);

//[UserPaint] Add your own custom painting code here..
	(8) + 16, (0) + 24, getWidth() - 44, (getHeight() - 8) - 39,
	0, mpThumbnail->getTotalLength(),


void AudioThumbnailComponent::resized()
groupComponent->setBounds (8, 0, getWidth() - 14, getHeight() - 8);
//mpThumbnail->setBounds ((8) + 16, (0) + 24, getWidth() - 44, (getHeight() - 8) - 39);
//[UserResized] Add your own custom resize handling here…

//[MiscUserCode] You can add your own definitions of your custom methods or any other code here…
void AudioThumbnailComponent::addChangeListener(ChangeListener* const listener) throw()

You may also have a problem in your x-axis as well. Do you really have that much silence at the beginning and end as well as the clipped group of samples at the beginning and end of the non-zero data?

The reason I mention the x-axis is that I had a similiar problem: whenever I set the x argument to drawChannel to any value except zero, AudioThumbnail drew a line followed by random garbage, until it got to x, at which it draws correctly. I thought I had reported this in an earlier post, but apparently I forgot after I found a workaround. The workaround was to set the x argument to zero and adjust my component to compensate. The component is a little thin on the left side, but it doesn’t look too bad.

Update: I’ve posted the above and another anomaly I found as possible bugs.