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

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

@ -3,6 +3,9 @@
//
#include "minidexed.h"
#include <circle/devicenameservice.h>
#include <stdio.h>
#define MIDI_DUMP
#define MIDI_NOTE_OFF 0b1000
#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
// 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)
{
return;

Loading…
Cancel
Save