mirror of
https://codeberg.org/armin/monoslicer.git
synced 2026-10-11 21:11:53 +02:00
Match Length button toggles with red highlight, moved controls to right side
This commit is contained in:
parent
7630bb93fc
commit
16322a2bb6
3 changed files with 73 additions and 31 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue