MCPcopy Create free account
hub / github.com/DamRsn/NeuralNote / paint

Method paint

NeuralNote/Source/Components/Playhead.cpp:18–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18void 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
39void Playhead::setPlayheadTime(double inNewTime)
40{

Callers

nothing calls this directly

Calls 1

getStateMethod · 0.80

Tested by

no test coverage detected