| 16 | } |
| 17 | |
| 18 | void Playhead::paint(Graphics& g) |
| 19 | { |
| 20 | if (mAudioSampleDuration > 0 && mProcessor->getState() == PopulatedAudioAndMidiRegions) { |
| 21 | auto playhead_x = static_cast<int>(std::round(computePlayheadPositionPixel( |
| 22 | mCurrentPlayerPlayheadTime, mAudioSampleDuration, mBaseNumPixelsPerSecond, mZoomLevel, getWidth()))); |
| 23 | |
| 24 | g.setColour(juce::Colours::white); |
| 25 | g.drawVerticalLine(playhead_x, 0, static_cast<float>(getHeight())); |
| 26 | |
| 27 | auto playhead_center_x = static_cast<float>(playhead_x) + 0.5f; |
| 28 | Path triangle; |
| 29 | triangle.addTriangle(jmax(0.0f, playhead_center_x - mTriangleSide / 2.0f), |
| 30 | 0, |
| 31 | jmin(playhead_center_x + mTriangleSide / 2.0f, static_cast<float>(getWidth())), |
| 32 | 0, |
| 33 | playhead_center_x, |
| 34 | mTriangleHeight); |
| 35 | g.fillPath(triangle); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | void Playhead::setPlayheadTime(double inNewTime) |
| 40 | { |