mirror of https://github.com/probonopd/MiniDexed
Step47 Network Support without mDNS (#757)
* add initial mdns responder for rtp-midi aka applemidi * do not reinitialized network * continue publishing mdns after network connection reestablishes * remote mdnsresponder and revert to step48 * disable mdns TTL patching for nowpull/761/head
parent
a95d6e0c65
commit
024d23a69d
@ -1,74 +0,0 @@ |
|||||||
//
|
|
||||||
// serialmididevice.cpp
|
|
||||||
//
|
|
||||||
// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi
|
|
||||||
// Copyright (C) 2022 The MiniDexed Team
|
|
||||||
//
|
|
||||||
// Original author of this class:
|
|
||||||
// R. Stange <rsta2@o2online.de>
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <circle/logger.h> |
|
||||||
#include <cstring> |
|
||||||
#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) |
|
||||||
{ |
|
||||||
AddDevice ("rtpdummy"); |
|
||||||
} |
|
||||||
|
|
||||||
CRTPMIDIDevice::~CRTPMIDIDevice (void) |
|
||||||
{ |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
boolean CRTPMIDIDevice::Initialize (void) |
|
||||||
{ |
|
||||||
m_pAppleMIDIParticipant = new CAppleMIDIParticipant(&m_Random, this); |
|
||||||
if (!m_pAppleMIDIParticipant->Initialize()) |
|
||||||
{ |
|
||||||
LOGERR("Failed to init RTP listener"); |
|
||||||
return false; //continue without rtp midi
|
|
||||||
} |
|
||||||
else |
|
||||||
LOGNOTE("RTP Listener initialized"); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
// Methods to handle MIDI events
|
|
||||||
|
|
||||||
void CRTPMIDIDevice::OnAppleMIDIDataReceived(const u8* pData, size_t nSize) |
|
||||||
{ |
|
||||||
MIDIMessageHandler(pData, nSize, VIRTUALCABLE); |
|
||||||
} |
|
||||||
|
|
||||||
void CRTPMIDIDevice::OnAppleMIDIConnect(const CIPAddress* pIPAddress, const char* pName) |
|
||||||
{ |
|
||||||
LOGNOTE("RTP Device connected"); |
|
||||||
} |
|
||||||
|
|
||||||
void CRTPMIDIDevice::OnAppleMIDIDisconnect(const CIPAddress* pIPAddress, const char* pName) |
|
||||||
{ |
|
||||||
// RemoveRTPDevice
|
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
//
|
|
||||||
// .h
|
|
||||||
//
|
|
||||||
// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi
|
|
||||||
// Copyright (C) 2022 The MiniDexed Team
|
|
||||||
//
|
|
||||||
// Original author of this class:
|
|
||||||
// R. Stange <rsta2@o2online.de>
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
//
|
|
||||||
#ifndef _rtpmididevice_h |
|
||||||
#define _rtpmididevice_h |
|
||||||
|
|
||||||
#include "mididevice.h" |
|
||||||
#include "config.h" |
|
||||||
#include "net/applemidi.h" |
|
||||||
|
|
||||||
class CMiniDexed; |
|
||||||
|
|
||||||
class CRTPMIDIDevice : CAppleMIDIHandler, CMIDIDevice |
|
||||||
{ |
|
||||||
public: |
|
||||||
CRTPMIDIDevice (CMiniDexed *pSynthesizer, CConfig *pConfig, CUserInterface *pUI); |
|
||||||
~CRTPMIDIDevice (void); |
|
||||||
|
|
||||||
boolean Initialize (void); |
|
||||||
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; |
|
||||||
|
|
||||||
private: |
|
||||||
CConfig *m_pConfig; |
|
||||||
CBcmRandomNumberGenerator m_Random; |
|
||||||
CAppleMIDIParticipant* m_pAppleMIDIParticipant; |
|
||||||
}; |
|
||||||
|
|
||||||
#endif |
|
Loading…
Reference in new issue