1
1
#include < Ethernet.h>
2
2
3
3
#define SerialMon Serial
4
- #include < AppleMIDI_Debug.h>
5
-
6
4
#define ONE_PARTICIPANT
7
5
#define USE_EXT_CALLBACKS
8
6
#include < AppleMIDI.h>
@@ -25,70 +23,70 @@ void OnAppleMidiException(const APPLEMIDI_NAMESPACE::ssrc_t&, const APPLEMIDI_NA
25
23
// -----------------------------------------------------------------------------
26
24
void setup ()
27
25
{
28
- DBG_SETUP (115200 );
29
- DBG ( " Das Booting" );
26
+ AM_DBG_SETUP (115200 );
27
+ AM_DBG ( F ( " Das Booting" ) );
30
28
31
29
if (Ethernet.begin (mac) == 0 ) {
32
- DBG (F (" Failed DHCP, check network cable & reboot" ));
30
+ AM_DBG (F (" Failed DHCP, check network cable & reboot" ));
33
31
for (;;);
34
32
}
35
33
36
- DBG (F (" OK, now make sure you an rtpMIDI session that is Enabled" ));
37
- DBG (F (" Add device named Arduino with Host" ), Ethernet.localIP (), " Port" , AppleMIDI.getPort (), " (Name" , AppleMIDI.getName (), " )" );
38
- DBG (F (" Select and then press the Connect button" ));
39
- DBG (F (" Then open a MIDI listener and monitor incoming notes" ));
34
+ AM_DBG (F (" OK, now make sure you an rtpMIDI session that is Enabled" ));
35
+ AM_DBG (F (" Add device named Arduino with Host" ), Ethernet.localIP (), " Port" , AppleMIDI.getPort (), " (Name" , AppleMIDI.getName (), " )" );
36
+ AM_DBG (F (" Select and then press the Connect button" ));
37
+ AM_DBG (F (" Then open a MIDI listener and monitor incoming notes" ));
40
38
41
39
MIDI.begin (MIDI_CHANNEL_OMNI);
42
40
43
41
// Normal callbacks - always available
44
42
// Stay informed on connection status
45
43
AppleMIDI.setHandleConnected ([](const APPLEMIDI_NAMESPACE::ssrc_t & ssrc, const char * name) {
46
44
isConnected++;
47
- DBG (F (" Connected to session" ), ssrc, name);
45
+ AM_DBG (F (" Connected to session" ), ssrc, name);
48
46
});
49
47
AppleMIDI.setHandleDisconnected ([](const APPLEMIDI_NAMESPACE::ssrc_t & ssrc) {
50
48
isConnected--;
51
- DBG (F (" Disconnected" ), ssrc);
49
+ AM_DBG (F (" Disconnected" ), ssrc);
52
50
});
53
51
/*
54
52
// Extended callback, only available when defining USE_EXT_CALLBACKS
55
53
AppleMIDI.setHandleSentRtp([](const APPLEMIDI_NAMESPACE::Rtp_t & rtp) {
56
- // DBG (F("an rtpMessage has been sent with sequenceNr"), rtp.sequenceNr);
54
+ // AM_DBG (F("an rtpMessage has been sent with sequenceNr"), rtp.sequenceNr);
57
55
});
58
56
AppleMIDI.setHandleSentRtpMidi([](const APPLEMIDI_NAMESPACE::RtpMIDI_t& rtpMidi) {
59
- // DBG (F("an rtpMidiMessage has been sent"), rtpMidi.flags);
57
+ // AM_DBG (F("an rtpMidiMessage has been sent"), rtpMidi.flags);
60
58
});
61
59
AppleMIDI.setHandleReceivedRtp([](const APPLEMIDI_NAMESPACE::ssrc_t & ssrc, const APPLEMIDI_NAMESPACE::Rtp_t & rtp, const int32_t& latency) {
62
- // DBG (F("setHandleReceivedRtp"), ssrc, rtp.sequenceNr , "with", latency, "ms latency");
60
+ // AM_DBG (F("setHandleReceivedRtp"), ssrc, rtp.sequenceNr , "with", latency, "ms latency");
63
61
});
64
62
AppleMIDI.setHandleStartReceivedMidi([](const APPLEMIDI_NAMESPACE::ssrc_t& ssrc) {
65
- // DBG (F("setHandleStartReceivedMidi from SSRC"), ssrc);
63
+ // AM_DBG (F("setHandleStartReceivedMidi from SSRC"), ssrc);
66
64
});
67
65
AppleMIDI.setHandleReceivedMidi([](const APPLEMIDI_NAMESPACE::ssrc_t& ssrc, byte value) {
68
- // DBG (F("setHandleReceivedMidi from SSRC"), ssrc, ", value:", value);
66
+ // AM_DBG (F("setHandleReceivedMidi from SSRC"), ssrc, ", value:", value);
69
67
});
70
68
AppleMIDI.setHandleEndReceivedMidi([](const APPLEMIDI_NAMESPACE::ssrc_t& ssrc) {
71
- // DBG (F("setHandleEndReceivedMidi from SSRC"), ssrc);
69
+ // AM_DBG (F("setHandleEndReceivedMidi from SSRC"), ssrc);
72
70
});
73
71
AppleMIDI.setHandleException(OnAppleMidiException);
74
72
75
73
MIDI.setHandleControlChange([](Channel channel, byte v1, byte v2) {
76
- DBG (F("ControlChange"), channel, v1, v2);
74
+ AM_DBG (F("ControlChange"), channel, v1, v2);
77
75
});
78
76
MIDI.setHandleProgramChange([](Channel channel, byte v1) {
79
- DBG (F("ProgramChange"), channel, v1);
77
+ AM_DBG (F("ProgramChange"), channel, v1);
80
78
});
81
79
MIDI.setHandlePitchBend([](Channel channel, int v1) {
82
- DBG (F("PitchBend"), channel, v1);
80
+ AM_DBG (F("PitchBend"), channel, v1);
83
81
});
84
82
MIDI.setHandleNoteOn([](byte channel, byte note, byte velocity) {
85
- DBG (F("NoteOn"), channel, note, velocity);
83
+ AM_DBG (F("NoteOn"), channel, note, velocity);
86
84
});
87
85
MIDI.setHandleNoteOff([](byte channel, byte note, byte velocity) {
88
- DBG (F("NoteOff"), channel, note, velocity);
86
+ AM_DBG (F("NoteOff"), channel, note, velocity);
89
87
});
90
88
*/
91
- DBG (F (" Sending MIDI messages every second" ));
89
+ AM_DBG (F (" Sending MIDI messages every second" ));
92
90
}
93
91
94
92
// -----------------------------------------------------------------------------
@@ -109,7 +107,7 @@ void loop()
109
107
byte velocity = random (55 , 100 );
110
108
byte channel = 1 ;
111
109
112
- // DBG (F("\nsendNoteOn"), note, velocity, channel);
110
+ // AM_DBG (F("\nsendNoteOn"), note, velocity, channel);
113
111
MIDI.sendNoteOn (note, velocity, channel);
114
112
// MIDI.sendNoteOff(note, velocity, channel);
115
113
}
@@ -122,43 +120,43 @@ void OnAppleMidiException(const APPLEMIDI_NAMESPACE::ssrc_t& ssrc, const APPLEMI
122
120
switch (e)
123
121
{
124
122
case APPLEMIDI_NAMESPACE::Exception::BufferFullException:
125
- DBG (F (" *** BufferFullException" ));
123
+ AM_DBG (F (" *** BufferFullException" ));
126
124
break ;
127
125
case APPLEMIDI_NAMESPACE::Exception::ParseException:
128
- DBG (F (" *** ParseException" ));
126
+ AM_DBG (F (" *** ParseException" ));
129
127
break ;
130
128
case APPLEMIDI_NAMESPACE::Exception::TooManyParticipantsException:
131
- DBG (F (" *** TooManyParticipantsException" ));
129
+ AM_DBG (F (" *** TooManyParticipantsException" ));
132
130
break ;
133
131
case APPLEMIDI_NAMESPACE::Exception::UnexpectedInviteException:
134
- DBG (F (" *** UnexpectedInviteException" ));
132
+ AM_DBG (F (" *** UnexpectedInviteException" ));
135
133
break ;
136
134
case APPLEMIDI_NAMESPACE::Exception::ParticipantNotFoundException:
137
- DBG (F (" *** ParticipantNotFoundException" ), value);
135
+ AM_DBG (F (" *** ParticipantNotFoundException" ), value);
138
136
break ;
139
137
case APPLEMIDI_NAMESPACE::Exception::ComputerNotInDirectory:
140
- DBG (F (" *** ComputerNotInDirectory" ), value);
138
+ AM_DBG (F (" *** ComputerNotInDirectory" ), value);
141
139
break ;
142
140
case APPLEMIDI_NAMESPACE::Exception::NotAcceptingAnyone:
143
- DBG (F (" *** NotAcceptingAnyone" ), value);
141
+ AM_DBG (F (" *** NotAcceptingAnyone" ), value);
144
142
break ;
145
143
case APPLEMIDI_NAMESPACE::Exception::ListenerTimeOutException:
146
- DBG (F (" *** ListenerTimeOutException" ));
144
+ AM_DBG (F (" *** ListenerTimeOutException" ));
147
145
break ;
148
146
case APPLEMIDI_NAMESPACE::Exception::MaxAttemptsException:
149
- DBG (F (" *** MaxAttemptsException" ));
147
+ AM_DBG (F (" *** MaxAttemptsException" ));
150
148
break ;
151
149
case APPLEMIDI_NAMESPACE::Exception::NoResponseFromConnectionRequestException:
152
- DBG (F (" ***:yyy did't respond to the connection request. Check the address and port, and any firewall or router settings. (time)" ));
150
+ AM_DBG (F (" ***:yyy did't respond to the connection request. Check the address and port, and any firewall or router settings. (time)" ));
153
151
break ;
154
152
case APPLEMIDI_NAMESPACE::Exception::SendPacketsDropped:
155
- DBG (F (" *** SendPacketsDropped" ), value);
153
+ AM_DBG (F (" *** SendPacketsDropped" ), value);
156
154
break ;
157
155
case APPLEMIDI_NAMESPACE::Exception::ReceivedPacketsDropped:
158
- DBG (F (" *** ReceivedPacketsDropped" ), value);
156
+ AM_DBG (F (" *** ReceivedPacketsDropped" ), value);
159
157
break ;
160
158
case APPLEMIDI_NAMESPACE::Exception::UdpBeginPacketFailed:
161
- DBG (F (" *** UdpBeginPacketFailed" ), value);
159
+ AM_DBG (F (" *** UdpBeginPacketFailed" ), value);
162
160
break ;
163
161
}
164
162
}
0 commit comments