Skip to content

Commit 9f783e6

Browse files
tucktuckg00seclaude
andcommitted
v0.10.4: fix global SET BPM to use selected slice range
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d88bed1 commit 9f783e6

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/ui/SignalChainBar.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,23 +1634,26 @@ void SignalChainBar::showSetBpmPopup()
16341634
}
16351635
else if (processor.sampleData.isLoaded())
16361636
{
1637+
int startSmp = 0;
1638+
int endSmp = processor.sampleData.getNumFrames();
1639+
1640+
const int sel = processor.sliceManager.selectedSlice.load();
1641+
if (sel >= 0 && sel < processor.sliceManager.getNumSlices())
1642+
{
1643+
const auto& s = processor.sliceManager.getSlice (sel);
1644+
startSmp = s.startSample;
1645+
endSmp = s.endSample;
1646+
}
1647+
16371648
const float sampleRate = processor.getSampleRate() > 0.0 ? (float) processor.getSampleRate() : 44100.0f;
1638-
const float newBpm = GrainEngine::calcStretchBpm (0,
1639-
processor.sampleData.getNumFrames(),
1640-
barCount,
1641-
sampleRate);
1649+
const float newBpm = GrainEngine::calcStretchBpm (startSmp, endSmp, barCount, sampleRate);
16421650
if (auto* bpmParam = processor.apvts.getParameter (ParamIds::defaultBpm))
16431651
{
16441652
bpmParam->beginChangeGesture();
16451653
bpmParam->setValueNotifyingHost (bpmParam->convertTo0to1 (newBpm));
16461654
bpmParam->endChangeGesture();
16471655
}
1648-
if (auto* algoParam = processor.apvts.getParameter (ParamIds::defaultAlgorithm))
1649-
{
1650-
algoParam->beginChangeGesture();
1651-
algoParam->setValueNotifyingHost (algoParam->convertTo0to1 (1.0f));
1652-
algoParam->endChangeGesture();
1653-
}
1656+
layoutDirty = true;
16541657
}
16551658

16561659
repaint();

0 commit comments

Comments
 (0)