Skip to content

Commit 8fad72b

Browse files
Enkerliclaude
andcommitted
CRITICAL: Remove debug file I/O causing CPU glitches
PERFORMANCE FIX: Removed all debug file operations from audio callbacks - File I/O operations (std::ofstream) in audio callbacks cause severe CPU spikes - Was writing to /tmp/rhythm_steps_debug.log on every audio block - This caused audio glitches and CPU overload symptoms REMOVED: - All std::ofstream debugFile operations from processBlock() - All debugFile.close() calls from audio thread - Debug logging from both main and transport timing calculations RESULT: Should eliminate CPU glitches while preserving Steps mode fixes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1654c0e commit 8fad72b

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

Plugin/Source/PluginProcessor.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,6 @@ void RhythmPatternExplorerAudioProcessor::processBlock (juce::AudioBuffer<float>
384384
// Steps mode: subdivision duration × number of steps (pattern length value ignored)
385385
patternLengthInBeats = subdivisionBeatsPerStep * patternSteps;
386386

387-
// Debug log to file
388-
std::ofstream debugFile("/tmp/rhythm_steps_debug.log", std::ios::app);
389-
debugFile << "MAIN Steps mode: subdivisionIndex=" << subdivisionIndex
390-
<< ", subdivisionBeatsPerStep=" << subdivisionBeatsPerStep
391-
<< ", patternSteps=" << patternSteps
392-
<< ", result=" << patternLengthInBeats
393-
<< " (pattern length value IGNORED)" << std::endl;
394-
debugFile.close();
395387
break;
396388
}
397389
case 1: // Beats mode
@@ -415,15 +407,6 @@ void RhythmPatternExplorerAudioProcessor::processBlock (juce::AudioBuffer<float>
415407
double stepsInCurrentCycle = fmod(stepsFromStart, patternEngine.getStepCount());
416408
int targetStep = static_cast<int>(stepsInCurrentCycle);
417409

418-
// Debug log to file
419-
std::ofstream debugFile("/tmp/rhythm_steps_debug.log", std::ios::app);
420-
debugFile << "Step calculation: currentBeat=" << currentBeat
421-
<< ", beatsPerStep=" << beatsPerStep
422-
<< ", stepsFromStart=" << stepsFromStart
423-
<< ", stepsInCurrentCycle=" << stepsInCurrentCycle
424-
<< ", targetStep=" << targetStep
425-
<< ", patternSteps=" << patternEngine.getStepCount() << std::endl;
426-
debugFile.close();
427410

428411
// Calculate the exact fractional position within the current step
429412
double stepFraction = stepsFromStart - std::floor(stepsFromStart);
@@ -585,14 +568,6 @@ void RhythmPatternExplorerAudioProcessor::updateTiming()
585568
// Example: 9 steps × 8th triplets = 9 × (1/3) = 3 beats total
586569
patternLengthInBeats = subdivisionBeatsPerStep * patternSteps;
587570

588-
// Debug log to file
589-
std::ofstream debugFile("/tmp/rhythm_steps_debug.log", std::ios::app);
590-
debugFile << "Steps mode: subdivisionIndex=" << subdivisionIndex
591-
<< ", subdivisionBeatsPerStep=" << subdivisionBeatsPerStep
592-
<< ", patternSteps=" << patternSteps
593-
<< ", result=" << patternLengthInBeats
594-
<< " (pattern length value IGNORED)" << std::endl;
595-
debugFile.close();
596571
break;
597572
}
598573
case 1: // Beats mode - pattern fits in specified number of beats
@@ -771,14 +746,6 @@ void RhythmPatternExplorerAudioProcessor::syncPositionWithHost(const juce::Audio
771746
double subdivisionBeatsPerStep = getSubdivisionInBeats(subdivisionIndex);
772747
patternLengthInBeats = subdivisionBeatsPerStep * patternSteps;
773748

774-
// Debug log to file
775-
std::ofstream debugFile("/tmp/rhythm_steps_debug.log", std::ios::app);
776-
debugFile << "Transport Steps mode: subdivisionIndex=" << subdivisionIndex
777-
<< ", subdivisionBeatsPerStep=" << subdivisionBeatsPerStep
778-
<< ", patternSteps=" << patternSteps
779-
<< ", result=" << patternLengthInBeats
780-
<< " (pattern length value IGNORED)" << std::endl;
781-
debugFile.close();
782749
break;
783750
}
784751
case 1: // Beats mode - pattern fits in specified number of beats
@@ -800,15 +767,6 @@ void RhythmPatternExplorerAudioProcessor::syncPositionWithHost(const juce::Audio
800767
double stepsInCurrentCycle = fmod(stepsFromStart, patternSteps);
801768
int targetStep = static_cast<int>(stepsInCurrentCycle);
802769

803-
// Debug log to file
804-
std::ofstream debugFile("/tmp/rhythm_steps_debug.log", std::ios::app);
805-
debugFile << "Transport step calculation: currentBeat=" << currentBeat
806-
<< ", beatsPerStep=" << beatsPerStep
807-
<< ", stepsFromStart=" << stepsFromStart
808-
<< ", stepsInCurrentCycle=" << stepsInCurrentCycle
809-
<< ", targetStep=" << targetStep
810-
<< ", patternSteps=" << patternSteps << std::endl;
811-
debugFile.close();
812770

813771
// CRITICAL FIX: Re-enable position sync for perfect DAW timing alignment
814772
// Use internal currentBPM variable

0 commit comments

Comments
 (0)