code: private int getSegmentForX(int x) {
          if (autoScroll.get()) {
              int playHead = (x - (getWidth() / 2));
              int offset = Util.timeToHalfFrame(getFurthestPlaybackPosition()) / scale.get();
              return  (playHead + offset) * scale.get();
          }
          return x * scale.get();
      }
docs: Figure out the starting waveform segment that corresponds to the specified coordinate in the window.
  
  @param x the column being drawn
  
  @return the offset into the waveform at the current scale and playback time that should be drawn there