positionToPixel method

double positionToPixel(
  1. Duration position
)

Converts an audio position to a pixel position. The returned position is a double for accuracy, but can be converted toInt and used to access the nearest pixel value via getPixelMin/getPixelMax.

Implementation

double positionToPixel(Duration position) =>
    position.inMicroseconds * sampleRate / (samplesPerPixel * 1000000);