@@ -59,27 +59,62 @@ class AppleMIDISession
59
59
#endif
60
60
};
61
61
62
- virtual ~AppleMIDISession (){
63
- };
62
+ virtual ~AppleMIDISession (){};
64
63
65
- AppleMIDISession& setHandleConnected (void (*fptr)(const ssrc_t &, const char *)) { _connectedCallback = fptr; return *this ; }
66
- AppleMIDISession& setHandleDisconnected (void (*fptr)(const ssrc_t &)) { _disconnectedCallback = fptr; return *this ; }
64
+ AppleMIDISession &setHandleConnected (void (*fptr)(const ssrc_t &, const char *))
65
+ {
66
+ _connectedCallback = fptr;
67
+ return *this ;
68
+ }
69
+ AppleMIDISession &setHandleDisconnected (void (*fptr)(const ssrc_t &))
70
+ {
71
+ _disconnectedCallback = fptr;
72
+ return *this ;
73
+ }
67
74
#ifdef USE_EXT_CALLBACKS
68
- void setHandleException (void (*fptr)(const ssrc_t &, const Exception &, const int32_t value)) { _exceptionCallback = fptr; return *this ; }
69
- AppleMIDISession& setHandleReceivedRtp (void (*fptr)(const ssrc_t &, const Rtp_t &, const int32_t &)) { _receivedRtpCallback = fptr; return *this ;}
70
- AppleMIDISession& setHandleStartReceivedMidi (void (*fptr)(const ssrc_t &)) { _startReceivedMidiByteCallback = fptr; return *this ;}
71
- AppleMIDISession& setHandleReceivedMidi (void (*fptr)(const ssrc_t &, byte)) { _receivedMidiByteCallback = fptr; return *this ;}
72
- AppleMIDISession& setHandleEndReceivedMidi (void (*fptr)(const ssrc_t &)) { _endReceivedMidiByteCallback = fptr; return *this ;}
73
- AppleMIDISession& setHandleSentRtp (void (*fptr)(const Rtp_t &)) { _sentRtpCallback = fptr; return *this ;}
74
- AppleMIDISession& setHandleSentRtpMidi (void (*fptr)(const RtpMIDI_t &)) { _sentRtpMidiCallback = fptr; return *this ;}
75
+ void setHandleException (void (*fptr)(const ssrc_t &, const Exception &, const int32_t value))
76
+ {
77
+ _exceptionCallback = fptr;
78
+ return *this ;
79
+ }
80
+ AppleMIDISession &setHandleReceivedRtp (void (*fptr)(const ssrc_t &, const Rtp_t &, const int32_t &))
81
+ {
82
+ _receivedRtpCallback = fptr;
83
+ return *this ;
84
+ }
85
+ AppleMIDISession &setHandleStartReceivedMidi (void (*fptr)(const ssrc_t &))
86
+ {
87
+ _startReceivedMidiByteCallback = fptr;
88
+ return *this ;
89
+ }
90
+ AppleMIDISession &setHandleReceivedMidi (void (*fptr)(const ssrc_t &, byte))
91
+ {
92
+ _receivedMidiByteCallback = fptr;
93
+ return *this ;
94
+ }
95
+ AppleMIDISession &setHandleEndReceivedMidi (void (*fptr)(const ssrc_t &))
96
+ {
97
+ _endReceivedMidiByteCallback = fptr;
98
+ return *this ;
99
+ }
100
+ AppleMIDISession &setHandleSentRtp (void (*fptr)(const Rtp_t &))
101
+ {
102
+ _sentRtpCallback = fptr;
103
+ return *this ;
104
+ }
105
+ AppleMIDISession &setHandleSentRtpMidi (void (*fptr)(const RtpMIDI_t &))
106
+ {
107
+ _sentRtpMidiCallback = fptr;
108
+ return *this ;
109
+ }
75
110
#endif
76
111
77
112
#ifdef KEEP_SESSION_NAME
78
113
const char *getName () const
79
114
{
80
115
return this ->localName ;
81
116
};
82
- AppleMIDISession& setName (const char *sessionName)
117
+ AppleMIDISession & setName (const char *sessionName)
83
118
{
84
119
strncpy (this ->localName , sessionName, DefaultSettings::MaxSessionNameLen);
85
120
return *this ;
@@ -89,12 +124,20 @@ class AppleMIDISession
89
124
{
90
125
return nullptr ;
91
126
};
92
- AppleMIDISession& setName (const char *sessionName){ return *this ; };
127
+ AppleMIDISession & setName (const char *sessionName) { return *this ; };
93
128
#endif
129
+
94
130
const uint16_t getPort () const
95
131
{
96
132
return this ->port ;
97
133
};
134
+
135
+ // call this method *before* calling begin()
136
+ void setPort (const uint16_t port)
137
+ {
138
+ this ->port = port;
139
+ }
140
+
98
141
const ssrc_t getSynchronizationSource () const { return this ->ssrc ; };
99
142
100
143
#ifdef APPLEMIDI_INITIATOR
0 commit comments