Consider the call to draw the thumbnail:
If x is 0, it works ok. If x > 0 then drawChannel draws garbage to the left of x. If x is large enough (but still smaller than w), it throws an access violation because of a bad pointer.
I traced inside of drawChannel and found the following the lines:
const Rectangle clip (g.getClipBounds());
const int skipLeft = clip.getX() - x;
w -= skipLeft;
x += skipLeft;
In my code, clip.getX() always returns 0, so that if x > 0, skipLeft < 0. This decrements x which causes the waveform to be drawn outside the specified bounds, presumably from bogus data. It also increments w, which I believe will cause the access violation as w is used to control what gets cached in the thumbnail. A value of w > than the original width passed in will cause the cache to read from outside of the inputSource’s data range.
Again, it all works fine if x, the first argument to drawChannel, is 0.
Any insight on this would be greatly appreciated – Jeff.