LCOV - code coverage report
Current view: top level - src/MIDI_Parsers - USBMIDI_Parser.hpp (source / functions) Hit Total Coverage
Test: 90a1b9beff85a60dc6ebcea034a947a845e56960 Lines: 11 11 100.0 %
Date: 2019-11-30 15:53:32 Functions: 7 7 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          31 : class USBMIDI_Parser : public MIDI_Parser {
      20             :   public:
      21             :     MIDI_read_t parse(uint8_t *packet);
      22             : 
      23             : #if !IGNORE_SYSEX
      24          22 :     SysExMessage getSysEx() const override {
      25          22 :         return {sysexbuffers[CN].getBuffer(), sysexbuffers[CN].getLength(), CN};
      26             :     }
      27             : #endif
      28             : 
      29           1 :     uint8_t getCN() const override { return CN; }
      30             : 
      31             :   protected:
      32             : #if !IGNORE_SYSEX
      33           8 :     void startSysEx(uint8_t CN) { sysexbuffers[CN].start(); }
      34           8 :     void endSysEx(uint8_t CN) { sysexbuffers[CN].end(); }
      35          47 :     bool addSysExByte(uint8_t CN, uint8_t data) {
      36          47 :         return sysexbuffers[CN].add(data);
      37             :     }
      38          14 :     bool receivingSysEx(uint8_t CN) const {
      39          14 :         return sysexbuffers[CN].isReceiving();
      40             :     }
      41             : #endif
      42             : 
      43          31 :     uint8_t CN = 0;
      44             : 
      45             :   private:
      46             : #if !IGNORE_SYSEX
      47             :     Array<SysExBuffer, USB_MIDI_NUMBER_OF_CABLES> sysexbuffers;
      48             : #endif
      49             : };
      50             : 
      51             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-5-g4ff2ed6