Skip to content

Commit d58e247

Browse files
tucktuckg00seclaude
andcommitted
Add lazy chop preview highlight and update screenshot
Show red-tinted region between chop position and playhead during lazy chop to visualize the pending slice boundary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 66e7e3a commit d58e247

4 files changed

Lines changed: 25 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ cmake --build build --config Release
2020
```bash
2121
cd "C:\Users\m_t_w\Documents\claude-projects\tuckers-sampler" && "C:\Program Files\CMake\bin\cmake.exe" --build build --config Release
2222
```
23+
cppcheck location: C:\Program Files\Cppcheck\cppcheck.exe
2324

2425
On Windows, cmake is not on PATH — always use the full path: `"C:\Program Files\CMake\bin\cmake.exe"`
2526

docs/screenshot.png

-38.7 KB
Loading

project/src/audio/LazyChopEngine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class LazyChopEngine
66
{
77
public:
88
bool isActive() const { return active; }
9+
bool isPlaying() const { return playing; }
10+
int getChopPos() const { return chopPos; }
911

1012
void start (int sampleLen, SliceManager& sliceMgr);
1113
void stop (VoicePool& voicePool, SliceManager& sliceMgr);

project/src/ui/WaveformView.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,28 @@ void WaveformView::paint (juce::Graphics& g)
7575
}
7676
}
7777

78+
// Draw lazy chop preview: highlight between chopPos and playhead
79+
if (processor.lazyChop.isActive() && processor.lazyChop.isPlaying()
80+
&& processor.lazyChop.getChopPos() >= 0)
81+
{
82+
int previewIdx = LazyChopEngine::getPreviewVoiceIndex();
83+
float playhead = processor.voicePool.voicePositions[previewIdx].load (std::memory_order_relaxed);
84+
if (playhead > 0.0f)
85+
{
86+
int chopSample = processor.lazyChop.getChopPos();
87+
int headSample = (int) playhead;
88+
int x1 = sampleToPixel (std::min (chopSample, headSample));
89+
int x2 = sampleToPixel (std::max (chopSample, headSample));
90+
if (x2 > x1)
91+
{
92+
g.setColour (juce::Colour (0xFFCC4444).withAlpha (0.15f));
93+
g.fillRect (x1, 0, x2 - x1, getHeight());
94+
g.setColour (juce::Colour (0xFFCC4444).withAlpha (0.5f));
95+
g.drawVerticalLine (sampleToPixel (chopSample), 0.0f, (float) getHeight());
96+
}
97+
}
98+
}
99+
78100
drawPlaybackCursors (g);
79101
}
80102
else

0 commit comments

Comments
 (0)