remove audio-thread file logging; guard arp against null before use

This commit is contained in:
Armin 2026-10-02 03:44:40 +02:00
commit b29e263000

View file

@ -3,16 +3,6 @@
// ---------------------------------------------------------------------------
static inline void dbgNote (const char* ev, int note, float vel)
{
juce::File (juce::File::getSpecialLocation (juce::File::userHomeDirectory)
.getChildFile ("rmx19_notes.log"))
.appendText (juce::String ("t=") + juce::String ((juce::int64) juce::Time::getMillisecondCounter())
+ " " + ev + " n=" + juce::String (note)
+ (vel >= 0.0f ? juce::String (" v=") + juce::String (vel, 2) : juce::String())
+ "\n");
}
class RMX19AudioProcessor::FxEngine
{
public:
@ -369,8 +359,9 @@ void RMX19AudioProcessor::processMidi (juce::MidiBuffer& midi, const VParams& p)
(void) p;
constexpr double bendSemis = 2.0;
bool arpOn = false;
// arp is only allocated by prepareToPlay(); treat it as off until then.
if (auto* par = apvts.getRawParameterValue ("arpon"))
arpOn = par->load() >= 0.5f;
arpOn = (arp != nullptr) && par->load() >= 0.5f;
for (const auto meta : midi)
{
@ -383,7 +374,6 @@ void RMX19AudioProcessor::processMidi (juce::MidiBuffer& midi, const VParams& p)
arp->noteOn (msg.getNoteNumber(), msg.getFloatVelocity());
else
engine.noteOn (msg.getNoteNumber(), msg.getFloatVelocity());
dbgNote ("ON", msg.getNoteNumber(), msg.getFloatVelocity());
}
else if (msg.isNoteOff())
{
@ -391,7 +381,6 @@ void RMX19AudioProcessor::processMidi (juce::MidiBuffer& midi, const VParams& p)
arp->noteOff (msg.getNoteNumber());
else
engine.noteOff (msg.getNoteNumber());
dbgNote ("OFF", msg.getNoteNumber(), -1.0f);
}
else if (msg.isPitchWheel())
{
@ -596,17 +585,6 @@ void RMX19AudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::
outMeter = juce::jmax (peak, outMeter * std::exp (-blockSec / 0.25f));
cpu = 0.7f * cpu + 0.3f * (float) (juce::Time::getMillisecondCounter() - start);
// real-time health check (offline probe + debug): flag blocks near the limit
const float blockMs = (numSamples == 0) ? 0.0f
: (float) numSamples / (float) std::max (1.0, getSampleRate()) * 1000.0f;
const float usedMs = (float) (juce::Time::getMillisecondCounter() - start);
if (usedMs > 0.5f * blockMs)
juce::File (juce::File::getSpecialLocation (juce::File::userHomeDirectory)
.getChildFile ("rmx19_notes.log"))
.appendText (juce::String ("OVER t=") + juce::String ((juce::int64) juce::Time::getMillisecondCounter())
+ " used=" + juce::String (usedMs, 2)
+ "ms budget=" + juce::String (blockMs, 2) + "ms\n");
}
void RMX19AudioProcessor::selectPatch (int i)