@@ -59,27 +59,62 @@ class AppleMIDISession
5959#endif
6060 };
6161
62- virtual ~AppleMIDISession (){
63- };
62+ virtual ~AppleMIDISession (){};
6463
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+ }
6774#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+ }
75110#endif
76111
77112#ifdef KEEP_SESSION_NAME
78113 const char *getName () const
79114 {
80115 return this ->localName ;
81116 };
82- AppleMIDISession& setName (const char *sessionName)
117+ AppleMIDISession & setName (const char *sessionName)
83118 {
84119 strncpy (this ->localName , sessionName, DefaultSettings::MaxSessionNameLen);
85120 return *this ;
@@ -89,12 +124,20 @@ class AppleMIDISession
89124 {
90125 return nullptr ;
91126 };
92- AppleMIDISession& setName (const char *sessionName){ return *this ; };
127+ AppleMIDISession & setName (const char *sessionName) { return *this ; };
93128#endif
129+
94130 const uint16_t getPort () const
95131 {
96132 return this ->port ;
97133 };
134+
135+ // call this method *before* calling begin()
136+ void setPort (const uint16_t port)
137+ {
138+ this ->port = port;
139+ }
140+
98141 const ssrc_t getSynchronizationSource () const { return this ->ssrc ; };
99142
100143#ifdef APPLEMIDI_INITIATOR
0 commit comments