Skip to content

Commit 08d9b43

Browse files
authored
Update V1.8.0
1 parent 83594ac commit 08d9b43

14 files changed

+5138
-224
lines changed

CuePointEditor.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class CueWaveformStrip : public juce::Component
4848

4949
void setDurationMs(uint32_t ms) { durationMs = ms; repaint(); }
5050
void setPlayheadMs(uint32_t ms) { playheadMs = ms; repaint(); }
51+
void setPlayheadVisible(bool v) { playheadVisible = v; repaint(); }
5152
uint32_t getEditCursorMs() const { return editCursorSet ? editCursorMs : 0; }
5253
bool hasEditCursor() const { return editCursorSet; }
5354
void clearEditCursor() { editCursorSet = false; repaint(); }
@@ -163,7 +164,8 @@ class CueWaveformStrip : public juce::Component
163164
g.fillRect(cx - 1.0f, 0.0f, 3.0f, b.getHeight());
164165
}
165166

166-
// Playhead cursor (red)
167+
// Playhead cursor (red) -- only when the playing track matches
168+
if (playheadVisible && durationMs > 0)
167169
{
168170
float ratio = (float)playheadMs / (float)durationMs;
169171
float cx = inset + ratio * drawW;
@@ -206,6 +208,7 @@ class CueWaveformStrip : public juce::Component
206208
bool hasData = false;
207209
uint32_t durationMs = 0;
208210
uint32_t playheadMs = 0;
211+
bool playheadVisible = true;
209212
uint32_t editCursorMs = 0;
210213
bool editCursorSet = false;
211214
std::vector<uint32_t> cuePositions;
@@ -296,6 +299,7 @@ class CuePointEditor : public juce::Component,
296299
else if (onCapturePlayhead)
297300
{
298301
ms = onCapturePlayhead();
302+
if (ms == UINT32_MAX) ms = 0; // playing track doesn't match
299303
}
300304
if (ms == 0) return;
301305

@@ -455,6 +459,25 @@ class CuePointEditor : public juce::Component,
455459
if (onCapturePlayhead && trackDurationMs > 0)
456460
{
457461
uint32_t ms = onCapturePlayhead();
462+
463+
if (ms == UINT32_MAX)
464+
{
465+
// Playing track doesn't match editing track -- hide red cursor
466+
if (trackIsLive)
467+
{
468+
trackIsLive = false;
469+
waveformStrip.setPlayheadMs(0);
470+
waveformStrip.setPlayheadVisible(false);
471+
}
472+
return;
473+
}
474+
475+
// Track matches -- show live playhead
476+
if (!trackIsLive)
477+
{
478+
trackIsLive = true;
479+
waveformStrip.setPlayheadVisible(true);
480+
}
458481
waveformStrip.setPlayheadMs(ms);
459482

460483
// Any playhead movement (play, jog, scrub) clears the edit cursor
@@ -653,6 +676,7 @@ class CuePointEditor : public juce::Component,
653676
uint32_t trackDurationMs = 0;
654677
uint32_t editCursorMs = 0;
655678
bool editCursorActive = false;
679+
bool trackIsLive = true; // false when playing track != editing track
656680
uint32_t lastPlayheadMs = 0; // for detecting playhead movement (jog/scrub/play)
657681

658682
// Table

0 commit comments

Comments
 (0)