1 /**********************************************************************/
2 /*! \class RtMidi
3     \brief An abstract base class for realtime MIDI input/output.
4 
5     This class implements some common functionality for the realtime
6     MIDI input/output subclasses RtMidiIn and RtMidiOut.
7 
8     RtMidi GitHub site: https://github.com/thestk/rtmidi
9     RtMidi WWW site: http://www.music.mcgill.ca/~gary/rtmidi/
10 
11     RtMidi: realtime MIDI i/o C++ classes
12     Copyright (c) 2003-2019 Gary P. Scavone
13 
14     Permission is hereby granted, free of charge, to any person
15     obtaining a copy of this software and associated documentation files
16     (the "Software"), to deal in the Software without restriction,
17     including without limitation the rights to use, copy, modify, merge,
18     publish, distribute, sublicense, and/or sell copies of the Software,
19     and to permit persons to whom the Software is furnished to do so,
20     subject to the following conditions:
21 
22     The above copyright notice and this permission notice shall be
23     included in all copies or substantial portions of the Software.
24 
25     Any person wishing to distribute modifications to the Software is
26     asked to send the modifications to the original developer so that
27     they can be incorporated into the canonical version.  This is,
28     however, not a binding provision of this license.
29 
30     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
34     ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
35     CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36     WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 */
38 /**********************************************************************/
39 
40 /*!
41   \file RtMidi.h
42  */
43 
44 #ifndef RTMIDI_H
45 #define RTMIDI_H
46 
47 #if defined _WIN32 || defined __CYGWIN__
48   #if defined(RTMIDI_EXPORT)
49     #define RTMIDI_DLL_PUBLIC __declspec(dllexport)
50   #else
51     #define RTMIDI_DLL_PUBLIC
52   #endif
53 #else
54   #if __GNUC__ >= 4
55     #define RTMIDI_DLL_PUBLIC __attribute__( (visibility( "default" )) )
56   #else
57     #define RTMIDI_DLL_PUBLIC
58   #endif
59 #endif
60 
61 #define RTMIDI_VERSION "4.0.0"
62 
63 #include <exception>
64 #include <iostream>
65 #include <string>
66 #include <vector>
67 
68 /************************************************************************/
69 /*! \class RtMidiError
70     \brief Exception handling class for RtMidi.
71 
72     The RtMidiError class is quite simple but it does allow errors to be
73     "caught" by RtMidiError::Type. See the RtMidi documentation to know
74     which methods can throw an RtMidiError.
75 */
76 /************************************************************************/
77 
78 class RTMIDI_DLL_PUBLIC RtMidiError : public std::exception
79 {
80  public:
81   //! Defined RtMidiError types.
82   enum Type {
83     WARNING,           /*!< A non-critical error. */
84     DEBUG_WARNING,     /*!< A non-critical error which might be useful for debugging. */
85     UNSPECIFIED,       /*!< The default, unspecified error type. */
86     NO_DEVICES_FOUND,  /*!< No devices found on system. */
87     INVALID_DEVICE,    /*!< An invalid device ID was specified. */
88     MEMORY_ERROR,      /*!< An error occured during memory allocation. */
89     INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
90     INVALID_USE,       /*!< The function was called incorrectly. */
91     DRIVER_ERROR,      /*!< A system driver error occured. */
92     SYSTEM_ERROR,      /*!< A system error occured. */
93     THREAD_ERROR       /*!< A thread error occured. */
94   };
95 
96   //! The constructor.
throw()97   RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED ) throw()
98     : message_(message), type_(type) {}
99 
100   //! The destructor.
~RtMidiError(void)101   virtual ~RtMidiError( void ) throw() {}
102 
103   //! Prints thrown error message to stderr.
printMessage(void)104   virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
105 
106   //! Returns the thrown error message type.
getType(void)107   virtual const Type& getType( void ) const throw() { return type_; }
108 
109   //! Returns the thrown error message string.
getMessage(void)110   virtual const std::string& getMessage( void ) const throw() { return message_; }
111 
112   //! Returns the thrown error message as a c-style string.
what(void)113   virtual const char* what( void ) const throw() { return message_.c_str(); }
114 
115  protected:
116   std::string message_;
117   Type type_;
118 };
119 
120 //! RtMidi error callback function prototype.
121 /*!
122     \param type Type of error.
123     \param errorText Error description.
124 
125     Note that class behaviour is undefined after a critical error (not
126     a warning) is reported.
127  */
128 typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText, void *userData );
129 
130 class MidiApi;
131 
132 class RTMIDI_DLL_PUBLIC RtMidi
133 {
134  public:
135   //! MIDI API specifier arguments.
136   enum Api {
137     UNSPECIFIED,    /*!< Search for a working compiled API. */
138     MACOSX_CORE,    /*!< Macintosh OS-X CoreMIDI API. */
139     LINUX_ALSA,     /*!< The Advanced Linux Sound Architecture API. */
140     UNIX_JACK,      /*!< The JACK Low-Latency MIDI Server API. */
141     WINDOWS_MM,     /*!< The Microsoft Multimedia MIDI API. */
142     RTMIDI_DUMMY,   /*!< A compilable but non-functional API. */
143     NUM_APIS        /*!< Number of values in this enum. */
144   };
145 
146   //! A static function to determine the current RtMidi version.
147   static std::string getVersion( void ) throw();
148 
149   //! A static function to determine the available compiled MIDI APIs.
150   /*!
151     The values returned in the std::vector can be compared against
152     the enumerated list values.  Note that there can be more than one
153     API compiled for certain operating systems.
154   */
155   static void getCompiledApi( std::vector<RtMidi::Api> &apis ) throw();
156 
157   //! Return the name of a specified compiled MIDI API.
158   /*!
159     This obtains a short lower-case name used for identification purposes.
160     This value is guaranteed to remain identical across library versions.
161     If the API is unknown, this function will return the empty string.
162   */
163   static std::string getApiName( RtMidi::Api api );
164 
165   //! Return the display name of a specified compiled MIDI API.
166   /*!
167     This obtains a long name used for display purposes.
168     If the API is unknown, this function will return the empty string.
169   */
170   static std::string getApiDisplayName( RtMidi::Api api );
171 
172   //! Return the compiled MIDI API having the given name.
173   /*!
174     A case insensitive comparison will check the specified name
175     against the list of compiled APIs, and return the one which
176     matches. On failure, the function returns UNSPECIFIED.
177   */
178   static RtMidi::Api getCompiledApiByName( const std::string &name );
179 
180   //! Pure virtual openPort() function.
181   virtual void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi" ) ) = 0;
182 
183   //! Pure virtual openVirtualPort() function.
184   virtual void openVirtualPort( const std::string &portName = std::string( "RtMidi" ) ) = 0;
185 
186   //! Pure virtual getPortCount() function.
187   virtual unsigned int getPortCount() = 0;
188 
189   //! Pure virtual getPortName() function.
190   virtual std::string getPortName( unsigned int portNumber = 0 ) = 0;
191 
192   //! Pure virtual closePort() function.
193   virtual void closePort( void ) = 0;
194 
195   void setClientName( const std::string &clientName );
196   void setPortName( const std::string &portName );
197 
198   //! Returns true if a port is open and false if not.
199   /*!
200       Note that this only applies to connections made with the openPort()
201       function, not to virtual ports.
202   */
203   virtual bool isPortOpen( void ) const = 0;
204 
205   //! Set an error callback function to be invoked when an error has occured.
206   /*!
207     The callback function will be called whenever an error has occured. It is best
208     to set the error callback function before opening a port.
209   */
210   virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ) = 0;
211 
212  protected:
213   RtMidi();
214   virtual ~RtMidi();
215   MidiApi *rtapi_;
216 };
217 
218 /**********************************************************************/
219 /*! \class RtMidiIn
220     \brief A realtime MIDI input class.
221 
222     This class provides a common, platform-independent API for
223     realtime MIDI input.  It allows access to a single MIDI input
224     port.  Incoming MIDI messages are either saved to a queue for
225     retrieval using the getMessage() function or immediately passed to
226     a user-specified callback function.  Create multiple instances of
227     this class to connect to more than one MIDI device at the same
228     time.  With the OS-X, Linux ALSA, and JACK MIDI APIs, it is also
229     possible to open a virtual input port to which other MIDI software
230     clients can connect.
231 
232     by Gary P. Scavone, 2003-2017.
233 */
234 /**********************************************************************/
235 
236 // **************************************************************** //
237 //
238 // RtMidiIn and RtMidiOut class declarations.
239 //
240 // RtMidiIn / RtMidiOut are "controllers" used to select an available
241 // MIDI input or output interface.  They present common APIs for the
242 // user to call but all functionality is implemented by the classes
243 // MidiInApi, MidiOutApi and their subclasses.  RtMidiIn and RtMidiOut
244 // each create an instance of a MidiInApi or MidiOutApi subclass based
245 // on the user's API choice.  If no choice is made, they attempt to
246 // make a "logical" API selection.
247 //
248 // **************************************************************** //
249 
250 class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
251 {
252  public:
253 
254   //! User callback function type definition.
255   typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData );
256 
257   //! Default constructor that allows an optional api, client name and queue size.
258   /*!
259     An exception will be thrown if a MIDI system initialization
260     error occurs.  The queue size defines the maximum number of
261     messages that can be held in the MIDI queue (when not using a
262     callback function).  If the queue size limit is reached,
263     incoming messages will be ignored.
264 
265     If no API argument is specified and multiple API support has been
266     compiled, the default order of use is ALSA, JACK (Linux) and CORE,
267     JACK (OS-X).
268 
269     \param api        An optional API id can be specified.
270     \param clientName An optional client name can be specified. This
271                       will be used to group the ports that are created
272                       by the application.
273     \param queueSizeLimit An optional size of the MIDI input queue can be specified.
274   */
275   RtMidiIn( RtMidi::Api api=UNSPECIFIED,
276             const std::string& clientName = "RtMidi Input Client",
277             unsigned int queueSizeLimit = 100 );
278 
279   //! If a MIDI connection is still open, it will be closed by the destructor.
280   ~RtMidiIn ( void ) throw();
281 
282   //! Returns the MIDI API specifier for the current instance of RtMidiIn.
283   RtMidi::Api getCurrentApi( void ) throw();
284 
285   //! Open a MIDI input connection given by enumeration number.
286   /*!
287     \param portNumber An optional port number greater than 0 can be specified.
288                       Otherwise, the default or first port found is opened.
289     \param portName An optional name for the application port that is used to connect to portId can be specified.
290   */
291   void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi Input" ) );
292 
293   //! Create a virtual input port, with optional name, to allow software connections (OS X, JACK and ALSA only).
294   /*!
295     This function creates a virtual MIDI input port to which other
296     software applications can connect.  This type of functionality
297     is currently only supported by the Macintosh OS-X, any JACK,
298     and Linux ALSA APIs (the function returns an error for the other APIs).
299 
300     \param portName An optional name for the application port that is
301                     used to connect to portId can be specified.
302   */
303   void openVirtualPort( const std::string &portName = std::string( "RtMidi Input" ) );
304 
305   //! Set a callback function to be invoked for incoming MIDI messages.
306   /*!
307     The callback function will be called whenever an incoming MIDI
308     message is received.  While not absolutely necessary, it is best
309     to set the callback function before opening a MIDI port to avoid
310     leaving some messages in the queue.
311 
312     \param callback A callback function must be given.
313     \param userData Optionally, a pointer to additional data can be
314                     passed to the callback function whenever it is called.
315   */
316   void setCallback( RtMidiCallback callback, void *userData = 0 );
317 
318   //! Cancel use of the current callback function (if one exists).
319   /*!
320     Subsequent incoming MIDI messages will be written to the queue
321     and can be retrieved with the \e getMessage function.
322   */
323   void cancelCallback();
324 
325   //! Close an open MIDI connection (if one exists).
326   void closePort( void );
327 
328   //! Returns true if a port is open and false if not.
329   /*!
330       Note that this only applies to connections made with the openPort()
331       function, not to virtual ports.
332   */
333   virtual bool isPortOpen() const;
334 
335   //! Return the number of available MIDI input ports.
336   /*!
337     \return This function returns the number of MIDI ports of the selected API.
338   */
339   unsigned int getPortCount();
340 
341   //! Return a string identifier for the specified MIDI input port number.
342   /*!
343     \return The name of the port with the given Id is returned.
344     \retval An empty string is returned if an invalid port specifier
345             is provided. User code should assume a UTF-8 encoding.
346   */
347   std::string getPortName( unsigned int portNumber = 0 );
348 
349   //! Specify whether certain MIDI message types should be queued or ignored during input.
350   /*!
351     By default, MIDI timing and active sensing messages are ignored
352     during message input because of their relative high data rates.
353     MIDI sysex messages are ignored by default as well.  Variable
354     values of "true" imply that the respective message type will be
355     ignored.
356   */
357   void ignoreTypes( bool midiSysex = true, bool midiTime = true, bool midiSense = true );
358 
359   //! Fill the user-provided vector with the data bytes for the next available MIDI message in the input queue and return the event delta-time in seconds.
360   /*!
361     This function returns immediately whether a new message is
362     available or not.  A valid message is indicated by a non-zero
363     vector size.  An exception is thrown if an error occurs during
364     message retrieval or an input connection was not previously
365     established.
366   */
367   double getMessage( std::vector<unsigned char> *message );
368 
369   //! Set an error callback function to be invoked when an error has occured.
370   /*!
371     The callback function will be called whenever an error has occured. It is best
372     to set the error callback function before opening a port.
373   */
374   virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
375 
376  protected:
377   void openMidiApi( RtMidi::Api api, const std::string &clientName, unsigned int queueSizeLimit );
378 };
379 
380 /**********************************************************************/
381 /*! \class RtMidiOut
382     \brief A realtime MIDI output class.
383 
384     This class provides a common, platform-independent API for MIDI
385     output.  It allows one to probe available MIDI output ports, to
386     connect to one such port, and to send MIDI bytes immediately over
387     the connection.  Create multiple instances of this class to
388     connect to more than one MIDI device at the same time.  With the
389     OS-X, Linux ALSA and JACK MIDI APIs, it is also possible to open a
390     virtual port to which other MIDI software clients can connect.
391 
392     by Gary P. Scavone, 2003-2017.
393 */
394 /**********************************************************************/
395 
396 class RTMIDI_DLL_PUBLIC RtMidiOut : public RtMidi
397 {
398  public:
399   //! Default constructor that allows an optional client name.
400   /*!
401     An exception will be thrown if a MIDI system initialization error occurs.
402 
403     If no API argument is specified and multiple API support has been
404     compiled, the default order of use is ALSA, JACK (Linux) and CORE,
405     JACK (OS-X).
406   */
407   RtMidiOut( RtMidi::Api api=UNSPECIFIED,
408              const std::string& clientName = "RtMidi Output Client" );
409 
410   //! The destructor closes any open MIDI connections.
411   ~RtMidiOut( void ) throw();
412 
413   //! Returns the MIDI API specifier for the current instance of RtMidiOut.
414   RtMidi::Api getCurrentApi( void ) throw();
415 
416   //! Open a MIDI output connection.
417   /*!
418       An optional port number greater than 0 can be specified.
419       Otherwise, the default or first port found is opened.  An
420       exception is thrown if an error occurs while attempting to make
421       the port connection.
422   */
423   void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi Output" ) );
424 
425   //! Close an open MIDI connection (if one exists).
426   void closePort( void );
427 
428   //! Returns true if a port is open and false if not.
429   /*!
430       Note that this only applies to connections made with the openPort()
431       function, not to virtual ports.
432   */
433   virtual bool isPortOpen() const;
434 
435   //! Create a virtual output port, with optional name, to allow software connections (OS X, JACK and ALSA only).
436   /*!
437       This function creates a virtual MIDI output port to which other
438       software applications can connect.  This type of functionality
439       is currently only supported by the Macintosh OS-X, Linux ALSA
440       and JACK APIs (the function does nothing with the other APIs).
441       An exception is thrown if an error occurs while attempting to
442       create the virtual port.
443   */
444   void openVirtualPort( const std::string &portName = std::string( "RtMidi Output" ) );
445 
446   //! Return the number of available MIDI output ports.
447   unsigned int getPortCount( void );
448 
449   //! Return a string identifier for the specified MIDI port type and number.
450   /*!
451     \return The name of the port with the given Id is returned.
452     \retval An empty string is returned if an invalid port specifier
453             is provided. User code should assume a UTF-8 encoding.
454   */
455   std::string getPortName( unsigned int portNumber = 0 );
456 
457   //! Immediately send a single message out an open MIDI output port.
458   /*!
459       An exception is thrown if an error occurs during output or an
460       output connection was not previously established.
461   */
462   void sendMessage( const std::vector<unsigned char> *message );
463 
464   //! Immediately send a single message out an open MIDI output port.
465   /*!
466       An exception is thrown if an error occurs during output or an
467       output connection was not previously established.
468 
469       \param message A pointer to the MIDI message as raw bytes
470       \param size    Length of the MIDI message in bytes
471   */
472   void sendMessage( const unsigned char *message, size_t size );
473 
474   //! Set an error callback function to be invoked when an error has occured.
475   /*!
476     The callback function will be called whenever an error has occured. It is best
477     to set the error callback function before opening a port.
478   */
479   virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
480 
481  protected:
482   void openMidiApi( RtMidi::Api api, const std::string &clientName );
483 };
484 
485 
486 // **************************************************************** //
487 //
488 // MidiInApi / MidiOutApi class declarations.
489 //
490 // Subclasses of MidiInApi and MidiOutApi contain all API- and
491 // OS-specific code necessary to fully implement the RtMidi API.
492 //
493 // Note that MidiInApi and MidiOutApi are abstract base classes and
494 // cannot be explicitly instantiated.  RtMidiIn and RtMidiOut will
495 // create instances of a MidiInApi or MidiOutApi subclass.
496 //
497 // **************************************************************** //
498 
499 class RTMIDI_DLL_PUBLIC MidiApi
500 {
501  public:
502 
503   MidiApi();
504   virtual ~MidiApi();
505   virtual RtMidi::Api getCurrentApi( void ) = 0;
506   virtual void openPort( unsigned int portNumber, const std::string &portName ) = 0;
507   virtual void openVirtualPort( const std::string &portName ) = 0;
508   virtual void closePort( void ) = 0;
509   virtual void setClientName( const std::string &clientName ) = 0;
510   virtual void setPortName( const std::string &portName ) = 0;
511 
512   virtual unsigned int getPortCount( void ) = 0;
513   virtual std::string getPortName( unsigned int portNumber ) = 0;
514 
isPortOpen()515   inline bool isPortOpen() const { return connected_; }
516   void setErrorCallback( RtMidiErrorCallback errorCallback, void *userData );
517 
518   //! A basic error reporting function for RtMidi classes.
519   void error( RtMidiError::Type type, std::string errorString );
520 
521 protected:
522   virtual void initialize( const std::string& clientName ) = 0;
523 
524   void *apiData_;
525   bool connected_;
526   std::string errorString_;
527   RtMidiErrorCallback errorCallback_;
528   bool firstErrorOccurred_;
529   void *errorCallbackUserData_;
530 };
531 
532 class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi
533 {
534  public:
535 
536   MidiInApi( unsigned int queueSizeLimit );
537   virtual ~MidiInApi( void );
538   void setCallback( RtMidiIn::RtMidiCallback callback, void *userData );
539   void cancelCallback( void );
540   virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense );
541   double getMessage( std::vector<unsigned char> *message );
542 
543   // A MIDI structure used internally by the class to store incoming
544   // messages.  Each message represents one and only one MIDI message.
545   struct MidiMessage {
546     std::vector<unsigned char> bytes;
547 
548     //! Time in seconds elapsed since the previous message
549     double timeStamp;
550 
551     // Default constructor.
MidiMessageMidiMessage552     MidiMessage()
553       : bytes(0), timeStamp(0.0) {}
554   };
555 
556   struct MidiQueue {
557     unsigned int front;
558     unsigned int back;
559     unsigned int ringSize;
560     MidiMessage *ring;
561 
562     // Default constructor.
MidiQueueMidiQueue563     MidiQueue()
564       : front(0), back(0), ringSize(0), ring(0) {}
565     bool push( const MidiMessage& );
566     bool pop( std::vector<unsigned char>*, double* );
567     unsigned int size( unsigned int *back=0, unsigned int *front=0 );
568   };
569 
570   // The RtMidiInData structure is used to pass private class data to
571   // the MIDI input handling function or thread.
572   struct RtMidiInData {
573     MidiQueue queue;
574     MidiMessage message;
575     unsigned char ignoreFlags;
576     bool doInput;
577     bool firstMessage;
578     void *apiData;
579     bool usingCallback;
580     RtMidiIn::RtMidiCallback userCallback;
581     void *userData;
582     bool continueSysex;
583 
584     // Default constructor.
RtMidiInDataRtMidiInData585     RtMidiInData()
586       : ignoreFlags(7), doInput(false), firstMessage(true), apiData(0), usingCallback(false),
587         userCallback(0), userData(0), continueSysex(false) {}
588   };
589 
590  protected:
591   RtMidiInData inputData_;
592 };
593 
594 class RTMIDI_DLL_PUBLIC MidiOutApi : public MidiApi
595 {
596  public:
597 
598   MidiOutApi( void );
599   virtual ~MidiOutApi( void );
600   virtual void sendMessage( const unsigned char *message, size_t size ) = 0;
601 };
602 
603 // **************************************************************** //
604 //
605 // Inline RtMidiIn and RtMidiOut definitions.
606 //
607 // **************************************************************** //
608 
getCurrentApi(void)609 inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
openPort(unsigned int portNumber,const std::string & portName)610 inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }
openVirtualPort(const std::string & portName)611 inline void RtMidiIn :: openVirtualPort( const std::string &portName ) { rtapi_->openVirtualPort( portName ); }
closePort(void)612 inline void RtMidiIn :: closePort( void ) { rtapi_->closePort(); }
isPortOpen()613 inline bool RtMidiIn :: isPortOpen() const { return rtapi_->isPortOpen(); }
setCallback(RtMidiCallback callback,void * userData)614 inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { static_cast<MidiInApi *>(rtapi_)->setCallback( callback, userData ); }
cancelCallback(void)615 inline void RtMidiIn :: cancelCallback( void ) { static_cast<MidiInApi *>(rtapi_)->cancelCallback(); }
getPortCount(void)616 inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); }
getPortName(unsigned int portNumber)617 inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
ignoreTypes(bool midiSysex,bool midiTime,bool midiSense)618 inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { static_cast<MidiInApi *>(rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); }
getMessage(std::vector<unsigned char> * message)619 inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return static_cast<MidiInApi *>(rtapi_)->getMessage( message ); }
setErrorCallback(RtMidiErrorCallback errorCallback,void * userData)620 inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
621 
getCurrentApi(void)622 inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
openPort(unsigned int portNumber,const std::string & portName)623 inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }
openVirtualPort(const std::string & portName)624 inline void RtMidiOut :: openVirtualPort( const std::string &portName ) { rtapi_->openVirtualPort( portName ); }
closePort(void)625 inline void RtMidiOut :: closePort( void ) { rtapi_->closePort(); }
isPortOpen()626 inline bool RtMidiOut :: isPortOpen() const { return rtapi_->isPortOpen(); }
getPortCount(void)627 inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); }
getPortName(unsigned int portNumber)628 inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
sendMessage(const std::vector<unsigned char> * message)629 inline void RtMidiOut :: sendMessage( const std::vector<unsigned char> *message ) { static_cast<MidiOutApi *>(rtapi_)->sendMessage( &message->at(0), message->size() ); }
sendMessage(const unsigned char * message,size_t size)630 inline void RtMidiOut :: sendMessage( const unsigned char *message, size_t size ) { static_cast<MidiOutApi *>(rtapi_)->sendMessage( message, size ); }
setErrorCallback(RtMidiErrorCallback errorCallback,void * userData)631 inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
632 
633 #endif
634