LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - USBMIDI_Parser.hpp (source / functions) Hit Total Coverage
Test: e224b347cd670555e44f06608ac41bd1ace9d9d8 Lines: 14 14 100.0 %
Date: 2020-09-08 17:44:46 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "MIDI_Parser.hpp"
       2             : #include "SysExBuffer.hpp"
       3             : #include <AH/Containers/Array.hpp>
       4             : 
       5             : #ifdef MIDI_NUM_CABLES
       6             : #define USB_MIDI_NUMBER_OF_CABLES MIDI_NUM_CABLES
       7             : #elif defined(USB_MIDI4_SERIAL) || defined(USB_MIDI4)
       8             : #define USB_MIDI_NUMBER_OF_CABLES 4
       9             : #elif defined(USB_MIDI16_AUDIO_SERIAL) || defined(USB_MIDI16_SERIAL) ||        \
      10             :     defined(USB_MIDI16)
      11             : // TODO: || defined(USB_EVERYTHING)
      12             : #define USB_MIDI_NUMBER_OF_CABLES 16
      13             : #else
      14             : #define USB_MIDI_NUMBER_OF_CABLES 1
      15             : #endif
      16             : 
      17             : BEGIN_CS_NAMESPACE
      18             : 
      19          80 : class USBMIDI_Parser : public MIDI_Parser {
      20             :   public:
      21             :     MIDIReadEvent parse(uint8_t *packet);
      22             : 
      23             : #if !IGNORE_SYSEX
      24          29 :     SysExMessage getSysExMessage() const override {
      25          58 :         return {sysexbuffers[activeSysExCN].getBuffer(),
      26          29 :                 sysexbuffers[activeSysExCN].getLength(), activeSysExCN};
      27             :     }
      28             : #endif
      29             : 
      30             :   protected:
      31             : #if !IGNORE_SYSEX
      32          11 :     void startSysEx(uint8_t CN) { sysexbuffers[CN].start(); }
      33          11 :     void endSysEx(uint8_t CN) {
      34          11 :         sysexbuffers[CN].end();
      35          11 :         activeSysExCN = CN;
      36          11 :     }
      37          69 :     bool addSysExByte(uint8_t CN, uint8_t data) {
      38          69 :         return sysexbuffers[CN].add(data);
      39             :     }
      40          20 :     bool receivingSysEx(uint8_t CN) const {
      41          20 :         return sysexbuffers[CN].isReceiving();
      42             :     }
      43             : #endif
      44             : 
      45          40 :     uint8_t activeSysExCN = 0;
      46             : 
      47             :   private:
      48             : #if !IGNORE_SYSEX
      49             :     Array<SysExBuffer, USB_MIDI_NUMBER_OF_CABLES> sysexbuffers;
      50             : #endif
      51             : };
      52             : 
      53             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-6-g40580cd