Skip to content

Commit 7ad582f

Browse files
committed
small changes recommended by Soyersoyer
1 parent 21cb8f4 commit 7ad582f

4 files changed

Lines changed: 44 additions & 27 deletions

File tree

src/config.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ void CConfig::Load (void)
123123
}
124124
}
125125

126-
m_bMIDIThruBlockSpam = m_Properties.GetNumber ("MIDIThruBlockSpam", 0) != 0;
126+
m_bMIDIThruIgnoreClock = m_Properties.GetNumber ("MIDIThruIgnoreClock", 0) != 0;
127+
m_bMIDIThruIgnoreActiveSensing = m_Properties.GetNumber ("MIDIThruIgnoreActiveSensing", 0) != 0;
127128

128129
m_bMIDIRXProgramChange = m_Properties.GetNumber ("MIDIRXProgramChange", 1) != 0;
129130
m_bIgnoreAllNotesOff = m_Properties.GetNumber ("IgnoreAllNotesOff", 0) != 0;
@@ -235,8 +236,8 @@ void CConfig::Load (void)
235236
if (const u8 *pIP = m_Properties.GetIPAddress("NetworkDNSServer")) m_INetworkDNSServer.Set (pIP);
236237
m_bNetworkFTPEnabled = m_Properties.GetNumber("NetworkFTPEnabled", 0) != 0;
237238
if (const u8 *pIP = m_Properties.GetIPAddress ("NetworkSyslogServerIPAddress")) m_INetworkSyslogServerIPAddress.Set (pIP);
238-
m_bUdpMidiEnabled = m_Properties.GetNumber("UdpMidiEnabled", 0) != 0;
239-
if (const u8 *pIP = m_Properties.GetIPAddress("UdpMidiIPAddress")) m_IUdpMidiIPAddress.Set (pIP);
239+
m_bUDPMIDIEnabled = m_Properties.GetNumber("UDPMIDIEnabled", 0) != 0;
240+
if (const u8 *pIP = m_Properties.GetIPAddress("UDPMIDIIPAddress")) m_IUDPMIDIIPAddress.Set (pIP);
240241

241242
m_nMasterVolume = m_Properties.GetNumber ("MasterVolume", 64);
242243
}
@@ -363,9 +364,14 @@ const char *CConfig::GetMIDIThru2Out (void) const
363364
return m_MIDIThru2Out.c_str ();
364365
}
365366

366-
bool CConfig::GetMIDIThruBlockSpam (void) const
367+
bool CConfig::GetMIDIThruIgnoreClock (void) const
367368
{
368-
return m_bMIDIThruBlockSpam;
369+
return m_bMIDIThruIgnoreClock;
370+
}
371+
372+
bool CConfig::GetMIDIThruIgnoreActiveSensing (void) const
373+
{
374+
return m_bMIDIThruIgnoreActiveSensing;
369375
}
370376

371377
bool CConfig::GetMIDIRXProgramChange (void) const
@@ -833,12 +839,12 @@ bool CConfig::GetNetworkFTPEnabled (void) const
833839
return m_bNetworkFTPEnabled;
834840
}
835841

836-
bool CConfig::GetUdpMidiEnabled (void) const
842+
bool CConfig::GetUDPMIDIEnabled (void) const
837843
{
838-
return m_bUdpMidiEnabled;
844+
return m_bUDPMIDIEnabled;
839845
}
840846

841-
const CIPAddress& CConfig::GetUdpMidiIPAddress (void) const
847+
const CIPAddress& CConfig::GetUDPMIDIIPAddress (void) const
842848
{
843-
return m_IUdpMidiIPAddress;
849+
return m_IUDPMIDIIPAddress;
844850
}

src/config.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ class CConfig // Configuration for MiniDexed
126126
const char *GetMIDIThruOut (void) const; // "" if not specified
127127
const char *GetMIDIThru2In (void) const; // "" if not specified
128128
const char *GetMIDIThru2Out (void) const; // "" if not specified
129-
bool GetMIDIThruBlockSpam (void) const; // false if not specified
129+
bool GetMIDIThruIgnoreClock (void) const; // false if not specified
130+
bool GetMIDIThruIgnoreActiveSensing (void) const; // false if not specified
130131
bool GetMIDIRXProgramChange (void) const; // true if not specified
131132
bool GetIgnoreAllNotesOff (void) const;
132133
bool GetMIDIAutoVoiceDumpOnPC (void) const; // false if not specified
@@ -257,8 +258,8 @@ class CConfig // Configuration for MiniDexed
257258
bool GetSyslogEnabled (void) const;
258259
const CIPAddress& GetNetworkSyslogServerIPAddress (void) const;
259260
bool GetNetworkFTPEnabled (void) const;
260-
bool GetUdpMidiEnabled (void) const;
261-
const CIPAddress& GetUdpMidiIPAddress (void) const;
261+
bool GetUDPMIDIEnabled (void) const;
262+
const CIPAddress& GetUDPMIDIIPAddress (void) const;
262263

263264
private:
264265
CPropertiesFatFsFile m_Properties;
@@ -283,7 +284,8 @@ class CConfig // Configuration for MiniDexed
283284
std::string m_MIDIThruOut;
284285
std::string m_MIDIThru2In;
285286
std::string m_MIDIThru2Out;
286-
bool m_bMIDIThruBlockSpam;
287+
bool m_bMIDIThruIgnoreClock;
288+
bool m_bMIDIThruIgnoreActiveSensing;
287289
bool m_bMIDIRXProgramChange;
288290
bool m_bIgnoreAllNotesOff;
289291
bool m_bMIDIAutoVoiceDumpOnPC;
@@ -392,8 +394,8 @@ class CConfig // Configuration for MiniDexed
392394
bool m_bSyslogEnabled;
393395
CIPAddress m_INetworkSyslogServerIPAddress;
394396
bool m_bNetworkFTPEnabled;
395-
bool m_bUdpMidiEnabled;
396-
CIPAddress m_IUdpMidiIPAddress;
397+
bool m_bUDPMIDIEnabled;
398+
CIPAddress m_IUDPMIDIIPAddress;
397399
};
398400

399401
#endif

src/mididevice.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,19 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
189189
}
190190
*/
191191

192-
bool blockSpamThru = m_pConfig->GetMIDIThruBlockSpam();
193192
// Handle MIDI Thru
194-
bool canThru = ( (nLength > 1) || !blockSpamThru
195-
|| (pMessage[0] != MIDI_TIMING_CLOCK && pMessage[0] != MIDI_ACTIVE_SENSING) );
193+
bool canThru = TRUE;
194+
if (nLength == 1)
195+
{
196+
if ((pMessage[0] == MIDI_TIMING_CLOCK) && m_pConfig->GetMIDIThruIgnoreClock())
197+
{
198+
canThru = FALSE;
199+
}
200+
if ((pMessage[0] == MIDI_ACTIVE_SENSING) && m_pConfig->GetMIDIThruIgnoreActiveSensing())
201+
{
202+
canThru = FALSE;
203+
}
204+
}
196205

197206
if (canThru)
198207
{

src/udpmididevice.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ boolean CUDPMIDIDevice::Initialize (void)
5858
else
5959
LOGNOTE("RTP Listener initialized");
6060

61-
if (m_pConfig->GetUdpMidiEnabled())
61+
if (m_pConfig->GetUDPMIDIEnabled())
6262
{
6363
m_pUDPMIDIReceiver = new CUDPMIDIReceiver(this);
6464
if (!m_pUDPMIDIReceiver->Initialize())
@@ -73,9 +73,9 @@ boolean CUDPMIDIDevice::Initialize (void)
7373
// UDP MIDI send socket setup (default: broadcast 255.255.255.255:1999)
7474
m_UDPDestAddress.Set(0xFFFFFFFF); // Broadcast by default
7575
m_UDPDestPort = 1999;
76-
if (m_pConfig->GetUdpMidiIPAddress().IsSet())
76+
if (m_pConfig->GetUDPMIDIIPAddress().IsSet())
7777
{
78-
m_UDPDestAddress.Set( m_pConfig->GetUdpMidiIPAddress() );
78+
m_UDPDestAddress.Set( m_pConfig->GetUDPMIDIIPAddress() );
7979
}
8080
CString IPAddressString;
8181
m_UDPDestAddress.Format(&IPAddressString);
@@ -127,20 +127,20 @@ void CUDPMIDIDevice::OnUDPMIDIDataReceived(const u8* pData, size_t nSize)
127127
void CUDPMIDIDevice::Send(const u8 *pMessage, size_t nLength, unsigned nCable)
128128
{
129129
if (m_pAppleMIDIParticipant) {
130-
int res = m_pAppleMIDIParticipant->SendMIDIToHost(pMessage, nLength);
131-
if (res < 0) {
132-
LOGERR("Failed to send %u bytes to RTP-MIDI host", nLength);
130+
bool res = m_pAppleMIDIParticipant->SendMIDIToHost(pMessage, nLength);
131+
if (!res) {
132+
LOGERR("Failed to send %u bytes to RTP-MIDI host", (unsigned long) nLength);
133133
} else {
134-
// LOGDBG("Sent %u bytes to RTP-MIDI host", nLength);
134+
// LOGDBG("Sent %u bytes to RTP-MIDI host", (unsigned long) nLength);
135135
}
136136
}
137137

138138
if (m_pUDPSendSocket) {
139139
int res = m_pUDPSendSocket->SendTo(pMessage, nLength, 0, m_UDPDestAddress, m_UDPDestPort);
140140
if (res < 0) {
141-
LOGERR("Failed to send %u bytes to UDP MIDI host", nLength);
141+
LOGERR("Failed to send %u bytes to UDP MIDI host", (unsigned long) nLength);
142142
} else {
143-
// LOGDBG("Sent %u bytes to UDP MIDI host (broadcast)", nLength);
143+
// LOGDBG("Sent %u bytes to UDP MIDI host", (unsigned long) nLength);
144144
}
145145
}
146146
}

0 commit comments

Comments
 (0)