Add initial mdns responder for rtp-midi aka applemidi (#749)

Co-authored-by: Ömer Şiar Baysal <osiarbaysal@gmail.com>
pull/757/head
probonopd 2 months ago committed by GitHub
parent 0b69e35d4d
commit 084dca96f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      src/minidexed.cpp
  2. 1
      src/minidexed.h
  3. 14
      src/rtpmididevice.cpp
  4. 22
      src/rtpmididevice.h

@ -2197,7 +2197,8 @@ void CMiniDexed::UpdateNetwork()
CString IPString;
m_pNet->GetConfig()->GetIPAddress()->Format(&IPString);
LOGNOTE("Network up and running at: %s", static_cast<const char *>(IPString));
//LOGNOTE("Network up and running at: %s", static_cast<const char *>(IPString));
m_UDPMIDI.Initialize();
@ -2214,11 +2215,17 @@ void CMiniDexed::UpdateNetwork()
LOGNOTE("FTP daemon initialized");
}
m_UI.DisplayWrite ("IP",
"Network",
IPString,
0,
1);
m_UI.DisplayWrite ("IP", "Network", IPString, 0, 1);
CmDNSPublisher *pmDNSPublisher = new CmDNSPublisher (m_pNet);
assert (pmDNSPublisher);
static const char ServiceName[] = "minidexed-rtpmidi";
static const char *ppText[] = {"RTP-MIDI Receiver", nullptr}; // TXT record strings
if (!pmDNSPublisher->PublishService (ServiceName, CmDNSPublisher::ServiceTypeAppleMIDI,
5004, ppText))
{
LOGPANIC ("Cannot publish mdns service");
}
}
else if (m_bNetworkReady && !bNetIsRunning)
{

@ -43,6 +43,7 @@
#include <circle/net/netsubsystem.h>
#include <wlan/bcm4343.h>
#include <wlan/hostap/wpa_supplicant/wpasupplicant.h>
#include <circle/net/mdnspublisher.h>
#include <circle/spinlock.h>
#include "common.h"
#include "effect_mixer.hpp"

@ -26,24 +26,21 @@
#include "rtpmididevice.h"
#include <assert.h>
#define VIRTUALCABLE 24
LOGMODULE("rtpmididevice");
CRTPMIDIDevice::CRTPMIDIDevice (CMiniDexed *pSynthesizer,
CConfig *pConfig, CUserInterface *pUI)
: CMIDIDevice (pSynthesizer, pConfig, pUI),
m_pConfig (pConfig)
//m_Serial (pInterrupt, TRUE),
//m_nSerialState (0),
//m_nSysEx (0),
//m_SendBuffer (&m_Serial)
{
AddDevice ("rtpdummy");
}
CRTPMIDIDevice::~CRTPMIDIDevice (void)
{
//m_nSerialState = 255;
}
boolean CRTPMIDIDevice::Initialize (void)
@ -63,10 +60,7 @@ boolean CRTPMIDIDevice::Initialize (void)
void CRTPMIDIDevice::OnAppleMIDIDataReceived(const u8* pData, size_t nSize)
{
LOGNOTE("Recieved RTP MIDI Data");
printf ("MIDI-RTP: %02X %02X\n",
(unsigned) pData[0], (unsigned) pData[1]);
MIDIMessageHandler(pData, nSize);
MIDIMessageHandler(pData, nSize, VIRTUALCABLE);
}
void CRTPMIDIDevice::OnAppleMIDIConnect(const CIPAddress* pIPAddress, const char* pName)

@ -27,11 +27,6 @@
#include "config.h"
#include "net/applemidi.h"
#include <circle/interrupt.h>
#include <circle/serial.h>
#include <circle/writebuffer.h>
#include <circle/types.h>
class CMiniDexed;
class CRTPMIDIDevice : CAppleMIDIHandler, CMIDIDevice
@ -44,26 +39,11 @@ public:
virtual void OnAppleMIDIDataReceived(const u8* pData, size_t nSize) override;
virtual void OnAppleMIDIConnect(const CIPAddress* pIPAddress, const char* pName) override;
virtual void OnAppleMIDIDisconnect(const CIPAddress* pIPAddress, const char* pName) override;
//void OnAppleMIDIDataReceived(const u8* pData, size_t nSize);
//void OnAppleMIDIConnect(const CIPAddress* pIPAddress, const char* pName);
//void OnAppleMIDIDisconnect(const CIPAddress* pIPAddress, const char* pName);
//void Process (void);
//void Send (const u8 *pMessage, size_t nLength, unsigned nCable = 0) override;
private:
CConfig *m_pConfig;
//CSerialDevice m_Serial;
//unsigned m_nSerialState;
//unsigned m_nSysEx;
//u8 m_SerialMessage[MAX_MIDI_MESSAGE];
//CWriteBufferDevice m_SendBuffer;
CBcmRandomNumberGenerator m_Random;
//CAppleMIDIHandler* m_MIDIHandler;
CAppleMIDIParticipant* m_pAppleMIDIParticipant; // AppleMIDI participant instance
CAppleMIDIParticipant* m_pAppleMIDIParticipant;
};
#endif

Loading…
Cancel
Save