Output MIDI messages for debugging and development

https://github.com/probonopd/MiniDexed/issues/8#issuecomment-1050231502
Closes #8
Thanks @rsta2
pull/29/head
probonopd 3 years ago
parent e28da3de6e
commit 1617763a92
  1. 11
      src/circle_stdlib_app.h
  2. 2
      src/kernel.cpp
  3. 22
      src/minidexed.cpp

@ -22,6 +22,7 @@
#include <circle/interrupt.h> #include <circle/interrupt.h>
#include <circle/screen.h> #include <circle/screen.h>
#include <circle/serial.h> #include <circle/serial.h>
#include <circle/writebuffer.h>
#include <circle/timer.h> #include <circle/timer.h>
#include <circle/logger.h> #include <circle/logger.h>
#include <circle/usb/usbhcidevice.h> #include <circle/usb/usbhcidevice.h>
@ -94,7 +95,8 @@ class CStdlibAppScreen : public CStdlibApp
public: public:
CStdlibAppScreen(const char *kernel) CStdlibAppScreen(const char *kernel)
: CStdlibApp (kernel), : CStdlibApp (kernel),
mScreen (mOptions.GetWidth (), mOptions.GetHeight ()), mScreenUnbuffered (mOptions.GetWidth (), mOptions.GetHeight ()),
mScreen (&mScreenUnbuffered),
mTimer (&mInterrupt), mTimer (&mInterrupt),
mLogger (mOptions.GetLogLevel (), &mTimer) mLogger (mOptions.GetLogLevel (), &mTimer)
{ {
@ -107,7 +109,7 @@ public:
return false; return false;
} }
if (!mScreen.Initialize ()) if (!mScreenUnbuffered.Initialize ())
{ {
return false; return false;
} }
@ -133,8 +135,9 @@ public:
} }
protected: protected:
CScreenDevice mScreen; CScreenDevice mScreenUnbuffered;
//CSerialDevice mSerial; //CSerialDevice mSerial;
CWriteBufferDevice mScreen;
CTimer mTimer; CTimer mTimer;
CLogger mLogger; CLogger mLogger;
}; };
@ -161,7 +164,7 @@ public:
mUSBHCI (&mInterrupt, &mTimer, TRUE), mUSBHCI (&mInterrupt, &mTimer, TRUE),
mEMMC (&mInterrupt, &mTimer, &mActLED), mEMMC (&mInterrupt, &mTimer, &mActLED),
#if !defined(__aarch64__) || !defined(LEAVE_QEMU_ON_HALT) #if !defined(__aarch64__) || !defined(LEAVE_QEMU_ON_HALT)
mConsole (0, TRUE) mConsole (&mScreen, TRUE)
#else #else
mConsole (&mScreen) mConsole (&mScreen)
#endif #endif

@ -83,6 +83,8 @@ CStdlibApp::TShutdownMode CKernel::Run (void)
boolean bUpdated = mUSBHCI.UpdatePlugAndPlay (); boolean bUpdated = mUSBHCI.UpdatePlugAndPlay ();
m_pDexed->Process(bUpdated); m_pDexed->Process(bUpdated);
mScreen.Update ();
} }
return ShutdownHalt; return ShutdownHalt;

@ -3,6 +3,9 @@
// //
#include "minidexed.h" #include "minidexed.h"
#include <circle/devicenameservice.h> #include <circle/devicenameservice.h>
#include <stdio.h>
#define MIDI_DUMP
#define MIDI_NOTE_OFF 0b1000 #define MIDI_NOTE_OFF 0b1000
#define MIDI_NOTE_ON 0b1001 #define MIDI_NOTE_ON 0b1001
@ -107,6 +110,25 @@ void CMiniDexed::MIDIPacketHandler (unsigned nCable, u8 *pPacket, unsigned nLeng
// The packet contents are just normal MIDI data - see // The packet contents are just normal MIDI data - see
// https://www.midi.org/specifications/item/table-1-summary-of-midi-message // https://www.midi.org/specifications/item/table-1-summary-of-midi-message
#ifdef MIDI_DUMP
switch (nLength)
{
case 1:
printf ("MIDI %u: %02X\n", nCable, (unsigned) pPacket[0]);
break;
case 2:
printf ("MIDI %u: %02X %02X\n", nCable,
(unsigned) pPacket[0], (unsigned) pPacket[1]);
break;
case 3:
printf ("MIDI %u: %02X %02X %02X\n", nCable,
(unsigned) pPacket[0], (unsigned) pPacket[1], (unsigned) pPacket[2]);
break;
}
#endif
if (nLength < 3) if (nLength < 3)
{ {
return; return;

Loading…
Cancel
Save