Skip to content

Commit

Permalink
scroll test
Browse files Browse the repository at this point in the history
  • Loading branch information
m0dB authored and m0dB committed Oct 6, 2024
1 parent 33606dc commit 3d3a75a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
24 changes: 18 additions & 6 deletions src/qml/qmlwaveformdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,25 @@ QSGNode* QmlWaveformDisplay::updatePaintNode(QSGNode* node, UpdatePaintNodeData*
bgNode->setRect(boundingRect());
bgNode->setColor(QColor((k & 1) ? 64 : 0, (k & 4) ? 64 : 0, (k & 2) ? 64 : 0, 255));

auto pEndOfTrackNode =
std::make_unique<allshader_sg::WaveformRendererEndOfTrack>(
this, QColor("yellow"));
pEndOfTrackNode->init();
bgNode->appendChildNode(pEndOfTrackNode->backendNode());
auto pTopNode = std::make_unique<rendergraph::Node>();

// auto pEndOfTrackNode =
// std::make_unique<allshader_sg::WaveformRendererEndOfTrack>(
// this, QColor("yellow"));
// pEndOfTrackNode->init();

rendergraph::Context context(window());

auto pPrerollNode =
std::make_unique<allshader_sg::WaveformRendererPreroll>(
this, context, QColor("red"));

m_pEngine = std::make_unique<rendergraph::Engine>(std::move(pEndOfTrackNode));
// pTopNode->appendChildNode(std::move(pEndOfTrackNode));
pTopNode->appendChildNode(std::move(pPrerollNode));

bgNode->appendChildNode(pTopNode->backendNode());

m_pEngine = std::make_unique<rendergraph::Engine>(std::move(pTopNode));
m_pEngine->initialize();
}

Expand Down
18 changes: 12 additions & 6 deletions src/waveform/renderers/allshader/waveformrendererpreroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,22 @@ void WaveformRendererPreroll::preprocess() {
bool WaveformRendererPreroll::preprocessInner() {
const TrackPointer trackInfo = m_waveformRenderer->getTrackInfo();

if (!trackInfo || (m_isSlipRenderer && !m_waveformRenderer->isSlipActive())) {
return false;
}
// if (!trackInfo || (m_isSlipRenderer && !m_waveformRenderer->isSlipActive())) {
// return false;
// }

auto positionType = m_isSlipRenderer ? ::WaveformRendererAbstract::Slip
: ::WaveformRendererAbstract::Play;

const double firstDisplayedPosition =
m_waveformRenderer->getFirstDisplayedPosition(positionType);
// const double firstDisplayedPosition = -1.0; //
// m_waveformRenderer->getFirstDisplayedPosition(positionType);
const double lastDisplayedPosition = m_waveformRenderer->getLastDisplayedPosition(positionType);

static double firstDisplayedPosition = -0.5;
firstDisplayedPosition += 0.001;
if (firstDisplayedPosition > 0.0) {
firstDisplayedPosition -= 1.0;
}
// Check if the pre- or post-roll is on screen. If so, draw little triangles
// to indicate the respective zones.
const bool preRollVisible = firstDisplayedPosition < 0;
Expand All @@ -127,7 +132,8 @@ bool WaveformRendererPreroll::preprocessInner() {
const int reserved = (preRollVisible ? numVerticesPerRectangle : 0) +
(postRollVisible ? numVerticesPerRectangle : 0);

const double playMarkerPosition = m_waveformRenderer->getPlayMarkerPosition();
const double playMarkerPosition = firstDisplayedPosition +
1.0; // m_waveformRenderer->getPlayMarkerPosition();
const double vSamplesPerPixel = m_waveformRenderer->getVisualSamplePerPixel();
const double numberOfVSamples = m_waveformRenderer->getLength() * vSamplesPerPixel;

Expand Down

0 comments on commit 3d3a75a

Please sign in to comment.