LCOV - code coverage report
Current view: top level - src - MidiManager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-03-03 00:31:37 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /*
       2              :   ==============================================================================
       3              :     MidiManager — owns all MIDI atomic state and processBlock logic.
       4              :   ==============================================================================
       5              : */
       6              : 
       7              : #pragma once
       8              : #include <JuceHeader.h>
       9              : #include <atomic>
      10              : #include <set>
      11              : #include "VoiceManager.h"
      12              : 
      13            7 : class MidiManager {
      14              : public:
      15              :     explicit MidiManager(VoiceManager& voiceManager);
      16              : 
      17              :     // Call from AudioProcessor::processBlock — audio thread only.
      18              :     void processBlock(MidiBuffer& midiMessages);
      19              : 
      20              :     // ── Shared atomic state — written on audio thread, read on UI thread ──────
      21              :     std::atomic<int> drumVoiceHitCount[4]{0, 0, 0, 0};
      22              : 
      23              :     // Raw drum tracking: fires on ANY matched drum note-on, for logging.
      24              :     std::atomic<int> ch10RawHitCount{0};
      25              :     std::atomic<int> ch10RawHitNote{-1};
      26              : 
      27              :     // Note-on event log for melodic tracks (indices 1-3).
      28              :     std::atomic<int> channelNoteOnCount[4]{0, 0, 0, 0};
      29              :     std::atomic<int> channelNoteOnNote[4]{-1, -1, -1, -1};
      30              : 
      31              :     // Highest active MIDI note per melodic track (indices 1-3), -1 = none.
      32              :     std::atomic<int> channelHighestNote[4]{-1, -1, -1, -1};
      33              : 
      34              :     // MIDI clock: counts every incoming clock pulse (24 per quarter note).
      35              :     std::atomic<int> midiClockPulse{0};
      36              : 
      37              : private:
      38              :     VoiceManager& voiceManager;
      39              :     std::set<int> activeNotes[4]; // audio-thread only; indices 1–3 used
      40              : };
        

Generated by: LCOV version 2.4-0