Match Length button toggles with red highlight, moved controls to right side

This commit is contained in:
Armin 2026-10-06 23:27:48 +02:00
commit 16322a2bb6
3 changed files with 73 additions and 31 deletions

View file

@ -768,6 +768,17 @@ juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
return new MonoslicerProcessor();
}
bool MonoslicerProcessor::isLengthMatchedToBeats(int numBeats, float bpm) const
{
if (sampleBuffer.getNumSamples() == 0 || bpm <= 0.0f || numBeats <= 0)
return false;
double sr = loadedSampleRate;
if (sr <= 0.0) return false;
double currentDuration = static_cast<double>(sampleBuffer.getNumSamples()) / sr;
double targetDuration = static_cast<double>(numBeats) * 60.0 / static_cast<double>(bpm);
return std::abs(currentDuration - targetDuration) < 0.005;
}
void MonoslicerProcessor::stretchToBeats(int numBeats, float bpm)
{
if (sampleBuffer.getNumSamples() == 0 || bpm <= 0.0f || numBeats <= 0) return;