I can’t seem to figure out why my AudioThumbnail isn’t drawing as I would expect. It’s drawing the correct portion of the audio, but it’s not drawing it in the correct location or scale. At first I thought maybe it was a HiDPI issue, but the numbers don’t support that. I print out the rectangle bounds (using getX() and getX()+getWidth()), and I get the values 72 for the left and 973 for the right, which is correct. But the data that gets drawn to my graphics context are not those values at all.
Here is a screen shot of the graphics as drawn. The waveform should go from the left edge of that bottom graph to the right edge, just like the graph above does, but it’s not doing that. I’m not applying any scaling myself to the graphics context, so I don’t understand that is happening here. Any ideas?
Here is the line of code that prints the bounds, and the line of code that executes the draw:
DBG( "Drawing waveform from " << area.getX() << " through " << area.getWidth()+area.getX() );
pThumbnail->drawChannel(g, area, startSeconds, endSeconds, channelNum, 1.0f );
Here is what is output:
Drawing waveform from 72 through 973
Here is the screen shot: