Tutorial Class/Enum List File List Compound Members

RtMidi.h
Go to the documentation of this file.
1 /**********************************************************************/
37 /**********************************************************************/
38
43 #ifndef RTMIDI_H
44 #define RTMIDI_H
45
46 #if defined _WIN32 || defined __CYGWIN__
47 #define RTMIDI_DLL_PUBLIC
48 #else
49 #if __GNUC__ >= 4
50 #define RTMIDI_DLL_PUBLIC __attribute__( (visibility( "default" )) )
51 #else
52 #define RTMIDI_DLL_PUBLIC
53 #endif
54 #endif
55
56 #define RTMIDI_VERSION "3.0.0"
57
58 #include <exception>
59 #include <iostream>
60 #include <string>
61 #include <vector>
62
63 /************************************************************************/
71 /************************************************************************/
72
73 class RtMidiError : public std::exception
74 {
75 public:
77 enum Type {
78 WARNING,
79 DEBUG_WARNING,
80 UNSPECIFIED,
81 NO_DEVICES_FOUND,
82 INVALID_DEVICE,
83 MEMORY_ERROR,
84 INVALID_PARAMETER,
85 INVALID_USE,
86 DRIVER_ERROR,
87 SYSTEM_ERROR,
88 THREAD_ERROR
89 };
90
92 RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
93
95 virtual ~RtMidiError( void ) throw() {}
96
98 virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
99
101 virtual const Type& getType(void) const throw() { return type_; }
102
104 virtual const std::string& getMessage(void) const throw() { return message_; }
105
107 virtual const char* what( void ) const throw() { return message_.c_str(); }
108
109 protected:
110 std::string message_;
111 Type type_;
112 };
113
115
122 typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText, void *userData );
123
124 class MidiApi;
125
126 class RtMidi
127 {
128 public:
129
131 enum Api {
132 UNSPECIFIED,
133 MACOSX_CORE,
134 LINUX_ALSA,
135 UNIX_JACK,
136 WINDOWS_MM,
137 RTMIDI_DUMMY
138 };
139
141 static std::string getVersion( void ) throw();
142
144
149 static void getCompiledApi( std::vector<RtMidi::Api> &apis ) throw();
150
152 virtual void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi" ) ) = 0;
153
155 virtual void openVirtualPort( const std::string &portName = std::string( "RtMidi" ) ) = 0;
156
158 virtual unsigned int getPortCount() = 0;
159
161 virtual std::string getPortName( unsigned int portNumber = 0 ) = 0;
162
164 virtual void closePort( void ) = 0;
165
167
171 virtual bool isPortOpen( void ) const = 0;
172
174
178 virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ) = 0;
179
180 protected:
181
182 RtMidi();
183 virtual ~RtMidi();
184
185 MidiApi *rtapi_;
186 };
187
188 /**********************************************************************/
204 /**********************************************************************/
205
206 // **************************************************************** //
207 //
208 // RtMidiIn and RtMidiOut class declarations.
209 //
210 // RtMidiIn / RtMidiOut are "controllers" used to select an available
211 // MIDI input or output interface. They present common APIs for the
212 // user to call but all functionality is implemented by the classes
213 // MidiInApi, MidiOutApi and their subclasses. RtMidiIn and RtMidiOut
214 // each create an instance of a MidiInApi or MidiOutApi subclass based
215 // on the user's API choice. If no choice is made, they attempt to
216 // make a "logical" API selection.
217 //
218 // **************************************************************** //
219
220 class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
221 {
222 public:
223
225 typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData);
226
228
245 RtMidiIn( RtMidi::Api api=UNSPECIFIED,
246 const std::string& clientName = "RtMidi Input Client",
247 unsigned int queueSizeLimit = 100 );
248
250 ~RtMidiIn ( void ) throw();
251
253 RtMidi::Api getCurrentApi( void ) throw();
254
256
261 void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi Input" ) );
262
264
273 void openVirtualPort( const std::string &portName = std::string( "RtMidi Input" ) );
274
276
286 void setCallback( RtMidiCallback callback, void *userData = 0 );
287
289
293 void cancelCallback();
294
296 void closePort( void );
297
299
303 virtual bool isPortOpen() const;
304
306
309 unsigned int getPortCount();
310
312
317 std::string getPortName( unsigned int portNumber = 0 );
318
320
327 void ignoreTypes( bool midiSysex = true, bool midiTime = true, bool midiSense = true );
328
330
337 double getMessage( std::vector<unsigned char> *message );
338
340
344 virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
345
346 protected:
347 void openMidiApi( RtMidi::Api api, const std::string &clientName, unsigned int queueSizeLimit );
348
349 };
350
351 /**********************************************************************/
365 /**********************************************************************/
366
367 class RTMIDI_DLL_PUBLIC RtMidiOut : public RtMidi
368 {
369 public:
370
372
379 RtMidiOut( RtMidi::Api api=UNSPECIFIED,
380 const std::string& clientName = "RtMidi Output Client" );
381
383 ~RtMidiOut( void ) throw();
384
386 RtMidi::Api getCurrentApi( void ) throw();
387
389
395 void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi Output" ) );
396
398 void closePort( void );
399
401
405 virtual bool isPortOpen() const;
406
408
416 void openVirtualPort( const std::string &portName = std::string( "RtMidi Output" ) );
417
419 unsigned int getPortCount( void );
420
422
427 std::string getPortName( unsigned int portNumber = 0 );
428
430
434 void sendMessage( const std::vector<unsigned char> *message );
435
437
444 void sendMessage( const unsigned char *message, size_t size );
445
447
451 virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
452
453 protected:
454 void openMidiApi( RtMidi::Api api, const std::string &clientName );
455 };
456
457
458 // **************************************************************** //
459 //
460 // MidiInApi / MidiOutApi class declarations.
461 //
462 // Subclasses of MidiInApi and MidiOutApi contain all API- and
463 // OS-specific code necessary to fully implement the RtMidi API.
464 //
465 // Note that MidiInApi and MidiOutApi are abstract base classes and
466 // cannot be explicitly instantiated. RtMidiIn and RtMidiOut will
467 // create instances of a MidiInApi or MidiOutApi subclass.
468 //
469 // **************************************************************** //
470
471 class MidiApi
472 {
473 public:
474
475 MidiApi();
476 virtual ~MidiApi();
477 virtual RtMidi::Api getCurrentApi( void ) = 0;
478 virtual void openPort( unsigned int portNumber, const std::string &portName ) = 0;
479 virtual void openVirtualPort( const std::string &portName ) = 0;
480 virtual void closePort( void ) = 0;
481
482 virtual unsigned int getPortCount( void ) = 0;
483 virtual std::string getPortName( unsigned int portNumber ) = 0;
484
485 inline bool isPortOpen() const { return connected_; }
486 void setErrorCallback( RtMidiErrorCallback errorCallback, void *userData );
487
489 void error( RtMidiError::Type type, std::string errorString );
490
491 protected:
492 virtual void initialize( const std::string& clientName ) = 0;
493
494 void *apiData_;
495 bool connected_;
496 std::string errorString_;
497 RtMidiErrorCallback errorCallback_;
498 bool firstErrorOccurred_;
499 void *errorCallbackUserData_;
500 };
501
502 class MidiInApi : public MidiApi
503 {
504 public:
505
506 MidiInApi( unsigned int queueSizeLimit );
507 virtual ~MidiInApi( void );
508 void setCallback( RtMidiIn::RtMidiCallback callback, void *userData );
509 void cancelCallback( void );
510 virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense );
511 double getMessage( std::vector<unsigned char> *message );
512
513 // A MIDI structure used internally by the class to store incoming
514 // messages. Each message represents one and only one MIDI message.
515 struct MidiMessage {
516 std::vector<unsigned char> bytes;
517
519 double timeStamp;
520
521 // Default constructor.
522 MidiMessage()
523 :bytes(0), timeStamp(0.0) {}
524 };
525
526 struct MidiQueue {
527 unsigned int front;
528 unsigned int back;
529 unsigned int ringSize;
530 MidiMessage *ring;
531
532 // Default constructor.
533 MidiQueue()
534 :front(0), back(0), ringSize(0), ring(0) {}
535 bool push(const MidiMessage&);
536 bool pop(std::vector<unsigned char>*, double*);
537 unsigned int size(unsigned int *back=0,
538 unsigned int *front=0);
539 };
540
541 // The RtMidiInData structure is used to pass private class data to
542 // the MIDI input handling function or thread.
543 struct RtMidiInData {
544 MidiQueue queue;
545 MidiMessage message;
546 unsigned char ignoreFlags;
547 bool doInput;
548 bool firstMessage;
549 void *apiData;
550 bool usingCallback;
551 RtMidiIn::RtMidiCallback userCallback;
552 void *userData;
553 bool continueSysex;
554
555 // Default constructor.
556 RtMidiInData()
557 : ignoreFlags(7), doInput(false), firstMessage(true),
558 apiData(0), usingCallback(false), userCallback(0), userData(0),
559 continueSysex(false) {}
560 };
561
562 protected:
563 RtMidiInData inputData_;
564 };
565
566 class MidiOutApi : public MidiApi
567 {
568 public:
569
570 MidiOutApi( void );
571 virtual ~MidiOutApi( void );
572 virtual void sendMessage( const unsigned char *message, size_t size ) = 0;
573 };
574
575 // **************************************************************** //
576 //
577 // Inline RtMidiIn and RtMidiOut definitions.
578 //
579 // **************************************************************** //
580
581 inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
582 inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }
583 inline void RtMidiIn :: openVirtualPort( const std::string &portName ) { rtapi_->openVirtualPort( portName ); }
584 inline void RtMidiIn :: closePort( void ) { rtapi_->closePort(); }
585 inline bool RtMidiIn :: isPortOpen() const { return rtapi_->isPortOpen(); }
586 inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { ((MidiInApi *)rtapi_)->setCallback( callback, userData ); }
587 inline void RtMidiIn :: cancelCallback( void ) { ((MidiInApi *)rtapi_)->cancelCallback(); }
588 inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); }
589 inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
590 inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { ((MidiInApi *)rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); }
591 inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return ((MidiInApi *)rtapi_)->getMessage( message ); }
592 inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
593
594 inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
595 inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }
596 inline void RtMidiOut :: openVirtualPort( const std::string &portName ) { rtapi_->openVirtualPort( portName ); }
597 inline void RtMidiOut :: closePort( void ) { rtapi_->closePort(); }
598 inline bool RtMidiOut :: isPortOpen() const { return rtapi_->isPortOpen(); }
599 inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); }
600 inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
601 inline void RtMidiOut :: sendMessage( const std::vector<unsigned char> *message ) { ((MidiOutApi *)rtapi_)->sendMessage( &message->at(0), message->size() ); }
602 inline void RtMidiOut :: sendMessage( const unsigned char *message, size_t size ) { ((MidiOutApi *)rtapi_)->sendMessage( message, size ); }
603 inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
604
605 // **************************************************************** //
606 //
607 // MidiInApi and MidiOutApi subclass prototypes.
608 //
609 // **************************************************************** //
610
611 #if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__)
612 #define __RTMIDI_DUMMY__
613 #endif
614
615 #if defined(__MACOSX_CORE__)
616
617 class MidiInCore: public MidiInApi
618 {
619 public:
620 MidiInCore( const std::string &clientName, unsigned int queueSizeLimit );
621 ~MidiInCore( void );
622 RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; };
623 void openPort( unsigned int portNumber, const std::string &portName );
624 void openVirtualPort( const std::string &portName );
625 void closePort( void );
626 unsigned int getPortCount( void );
627 std::string getPortName( unsigned int portNumber );
628
629 protected:
630 void initialize( const std::string& clientName );
631 };
632
633 class MidiOutCore: public MidiOutApi
634 {
635 public:
636 MidiOutCore( const std::string &clientName );
637 ~MidiOutCore( void );
638 RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; };
639 void openPort( unsigned int portNumber, const std::string &portName );
640 void openVirtualPort( const std::string &portName );
641 void closePort( void );
642 unsigned int getPortCount( void );
643 std::string getPortName( unsigned int portNumber );
644 void sendMessage( const unsigned char *message, size_t size );
645
646 protected:
647 void initialize( const std::string& clientName );
648 };
649
650 #endif
651
652 #if defined(__UNIX_JACK__)
653
654 class MidiInJack: public MidiInApi
655 {
656 public:
657 MidiInJack( const std::string &clientName, unsigned int queueSizeLimit );
658 ~MidiInJack( void );
659 RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; };
660 void openPort( unsigned int portNumber, const std::string &portName );
661 void openVirtualPort( const std::string &portName );
662 void closePort( void );
663 unsigned int getPortCount( void );
664 std::string getPortName( unsigned int portNumber );
665
666 protected:
667 std::string clientName;
668
669 void connect( void );
670 void initialize( const std::string& clientName );
671 };
672
673 class MidiOutJack: public MidiOutApi
674 {
675 public:
676 MidiOutJack( const std::string &clientName );
677 ~MidiOutJack( void );
678 RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; };
679 void openPort( unsigned int portNumber, const std::string &portName );
680 void openVirtualPort( const std::string &portName );
681 void closePort( void );
682 unsigned int getPortCount( void );
683 std::string getPortName( unsigned int portNumber );
684 void sendMessage( const unsigned char *message, size_t size );
685
686 protected:
687 std::string clientName;
688
689 void connect( void );
690 void initialize( const std::string& clientName );
691 };
692
693 #endif
694
695 #if defined(__LINUX_ALSA__)
696
697 class MidiInAlsa: public MidiInApi
698 {
699 public:
700 MidiInAlsa( const std::string &clientName, unsigned int queueSizeLimit );
701 ~MidiInAlsa( void );
702 RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; };
703 void openPort( unsigned int portNumber, const std::string &portName );
704 void openVirtualPort( const std::string &portName );
705 void closePort( void );
706 unsigned int getPortCount( void );
707 std::string getPortName( unsigned int portNumber );
708
709 protected:
710 void initialize( const std::string& clientName );
711 };
712
713 class MidiOutAlsa: public MidiOutApi
714 {
715 public:
716 MidiOutAlsa( const std::string &clientName );
717 ~MidiOutAlsa( void );
718 RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; };
719 void openPort( unsigned int portNumber, const std::string &portName );
720 void openVirtualPort( const std::string &portName );
721 void closePort( void );
722 unsigned int getPortCount( void );
723 std::string getPortName( unsigned int portNumber );
724 void sendMessage( const unsigned char *message, size_t size );
725
726 protected:
727 void initialize( const std::string& clientName );
728 };
729
730 #endif
731
732 #if defined(__WINDOWS_MM__)
733
734 class MidiInWinMM: public MidiInApi
735 {
736 public:
737 MidiInWinMM( const std::string &clientName, unsigned int queueSizeLimit );
738 ~MidiInWinMM( void );
739 RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; };
740 void openPort( unsigned int portNumber, const std::string &portName );
741 void openVirtualPort( const std::string &portName );
742 void closePort( void );
743 unsigned int getPortCount( void );
744 std::string getPortName( unsigned int portNumber );
745
746 protected:
747 void initialize( const std::string& clientName );
748 };
749
750 class MidiOutWinMM: public MidiOutApi
751 {
752 public:
753 MidiOutWinMM( const std::string &clientName );
754 ~MidiOutWinMM( void );
755 RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; };
756 void openPort( unsigned int portNumber, const std::string &portName );
757 void openVirtualPort( const std::string &portName );
758 void closePort( void );
759 unsigned int getPortCount( void );
760 std::string getPortName( unsigned int portNumber );
761 void sendMessage( const unsigned char *message, size_t size );
762
763 protected:
764 void initialize( const std::string& clientName );
765 };
766
767 #endif
768
769 #if defined(__RTMIDI_DUMMY__)
770
771 class MidiInDummy: public MidiInApi
772 {
773 public:
774 MidiInDummy( const std::string &/*clientName*/, unsigned int queueSizeLimit ) : MidiInApi( queueSizeLimit ) { errorString_ = "MidiInDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); }
775 RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }
776 void openPort( unsigned int /*portNumber*/, const std::string &/*portName*/ ) {}
777 void openVirtualPort( const std::string &/*portName*/ ) {}
778 void closePort( void ) {}
779 unsigned int getPortCount( void ) { return 0; }
780 std::string getPortName( unsigned int /*portNumber*/ ) { return ""; }
781
782 protected:
783 void initialize( const std::string& /*clientName*/ ) {}
784 };
785
786 class MidiOutDummy: public MidiOutApi
787 {
788 public:
789 MidiOutDummy( const std::string &/*clientName*/ ) { errorString_ = "MidiOutDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); }
790 RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }
791 void openPort( unsigned int /*portNumber*/, const std::string &/*portName*/ ) {}
792 void openVirtualPort( const std::string &/*portName*/ ) {}
793 void closePort( void ) {}
794 unsigned int getPortCount( void ) { return 0; }
795 std::string getPortName( unsigned int /*portNumber*/ ) { return ""; }
796 void sendMessage( const unsigned char * /*message*/, size_t /*size*/ ) {}
797
798 protected:
799 void initialize( const std::string& /*clientName*/ ) {}
800 };
801
802 #endif
803
804 #endif
RtMidiOut::setErrorCallback
virtual void setErrorCallback(RtMidiErrorCallback errorCallback=NULL, void *userData=0)
Set an error callback function to be invoked when an error has occured.
Definition: RtMidi.h:603
RtMidiIn::getCurrentApi
RtMidi::Api getCurrentApi(void)
Returns the MIDI API specifier for the current instance of RtMidiIn.
Definition: RtMidi.h:581
RtMidi::UNIX_JACK
Definition: RtMidi.h:135
RtMidiOut::getPortName
std::string getPortName(unsigned int portNumber=0)
Return a string identifier for the specified MIDI port type and number.
Definition: RtMidi.h:600
MidiOutWinMM
Definition: RtMidi.h:750
RtMidiErrorCallback
void(* RtMidiErrorCallback)(RtMidiError::Type type, const std::string &errorText, void *userData)
RtMidi error callback function prototype.
Definition: RtMidi.h:122
RtMidiIn
A realtime MIDI input class.
Definition: RtMidi.h:220
RtMidiIn::openPort
void openPort(unsigned int portNumber=0, const std::string &portName=std::string("RtMidi Input"))
Open a MIDI input connection given by enumeration number.
Definition: RtMidi.h:582
RtMidiError::RtMidiError
RtMidiError(const std::string &message, Type type=RtMidiError::UNSPECIFIED)
The constructor.
Definition: RtMidi.h:92
RtMidi::WINDOWS_MM
Definition: RtMidi.h:136
RtMidiOut::openVirtualPort
void openVirtualPort(const std::string &portName=std::string("RtMidi Output"))
Create a virtual output port, with optional name, to allow software connections (OS X...
Definition: RtMidi.h:596
RtMidiError::DEBUG_WARNING
Definition: RtMidi.h:79
RtMidi
An abstract base class for realtime MIDI input/output.
Definition: RtMidi.h:126
RtMidiError::UNSPECIFIED
Definition: RtMidi.h:80
RtMidi::MACOSX_CORE
Definition: RtMidi.h:133
RtMidiIn::ignoreTypes
void ignoreTypes(bool midiSysex=true, bool midiTime=true, bool midiSense=true)
Specify whether certain MIDI message types should be queued or ignored during input.
Definition: RtMidi.h:590
RtMidiIn::closePort
void closePort(void)
Close an open MIDI connection (if one exists).
Definition: RtMidi.h:584
RtMidi::UNSPECIFIED
Definition: RtMidi.h:132
MidiInWinMM
Definition: RtMidi.h:734
RtMidi::Api
Api
MIDI API specifier arguments.
Definition: RtMidi.h:131
RtMidiError::THREAD_ERROR
Definition: RtMidi.h:88
RtMidi::LINUX_ALSA
Definition: RtMidi.h:134
RtMidiIn::RtMidiCallback
void(* RtMidiCallback)(double timeStamp, std::vector< unsigned char > *message, void *userData)
User callback function type definition.
Definition: RtMidi.h:225
RtMidiError::INVALID_USE
Definition: RtMidi.h:85
RtMidiIn::setCallback
void setCallback(RtMidiCallback callback, void *userData=0)
Set a callback function to be invoked for incoming MIDI messages.
Definition: RtMidi.h:586
MidiApi
Definition: RtMidi.h:471
RtMidiError::Type
Type
Defined RtMidiError types.
Definition: RtMidi.h:77
RtMidiError::SYSTEM_ERROR
Definition: RtMidi.h:87
RtMidiError::getMessage
virtual const std::string & getMessage(void) const
Returns the thrown error message string.
Definition: RtMidi.h:104
MidiOutApi
Definition: RtMidi.h:566
RtMidiIn::openVirtualPort
void openVirtualPort(const std::string &portName=std::string("RtMidi Input"))
Create a virtual input port, with optional name, to allow software connections (OS X...
Definition: RtMidi.h:583
MidiInCore
Definition: RtMidi.h:617
MidiOutAlsa
Definition: RtMidi.h:713
RtMidiOut::getPortCount
unsigned int getPortCount(void)
Return the number of available MIDI output ports.
Definition: RtMidi.h:599
RtMidiIn::isPortOpen
virtual bool isPortOpen() const
Returns true if a port is open and false if not.
Definition: RtMidi.h:585
MidiOutJack
Definition: RtMidi.h:673
MidiInApi::RtMidiInData
Definition: RtMidi.h:543
MidiInJack
Definition: RtMidi.h:654
RtMidiIn::getPortCount
unsigned int getPortCount()
Return the number of available MIDI input ports.
Definition: RtMidi.h:588
RtMidiIn::cancelCallback
void cancelCallback()
Cancel use of the current callback function (if one exists).
Definition: RtMidi.h:587
RtMidiOut::closePort
void closePort(void)
Close an open MIDI connection (if one exists).
Definition: RtMidi.h:597
RtMidi::RTMIDI_DUMMY
Definition: RtMidi.h:137
MidiInAlsa
Definition: RtMidi.h:697
RtMidiIn::getPortName
std::string getPortName(unsigned int portNumber=0)
Return a string identifier for the specified MIDI input port number.
Definition: RtMidi.h:589
RtMidiOut::getCurrentApi
RtMidi::Api getCurrentApi(void)
Returns the MIDI API specifier for the current instance of RtMidiOut.
Definition: RtMidi.h:594
MidiInApi::MidiQueue
Definition: RtMidi.h:526
RtMidiError::printMessage
virtual void printMessage(void) const
Prints thrown error message to stderr.
Definition: RtMidi.h:98
RtMidiIn::setErrorCallback
virtual void setErrorCallback(RtMidiErrorCallback errorCallback=NULL, void *userData=0)
Set an error callback function to be invoked when an error has occured.
Definition: RtMidi.h:592
RtMidiError::~RtMidiError
virtual ~RtMidiError(void)
The destructor.
Definition: RtMidi.h:95
RtMidiOut::isPortOpen
virtual bool isPortOpen() const
Returns true if a port is open and false if not.
Definition: RtMidi.h:598
MidiOutCore
Definition: RtMidi.h:633
MidiInApi::MidiMessage::timeStamp
double timeStamp
Time in seconds elapsed since the previous message.
Definition: RtMidi.h:519
RtMidiError
Exception handling class for RtMidi.
Definition: RtMidi.h:73
RtMidiError::getType
virtual const Type & getType(void) const
Returns the thrown error message type.
Definition: RtMidi.h:101
RtMidiError::WARNING
Definition: RtMidi.h:78
RtMidiIn::getMessage
double getMessage(std::vector< unsigned char > *message)
Fill the user-provided vector with the data bytes for the next available MIDI message in the input qu...
Definition: RtMidi.h:591
RtMidiOut::sendMessage
void sendMessage(const std::vector< unsigned char > *message)
Immediately send a single message out an open MIDI output port.
Definition: RtMidi.h:601
RtMidiError::what
virtual const char * what(void) const
Returns the thrown error message as a c-style string.
Definition: RtMidi.h:107
RtMidiError::INVALID_PARAMETER
Definition: RtMidi.h:84
RtMidiOut
A realtime MIDI output class.
Definition: RtMidi.h:367
MidiInApi
Definition: RtMidi.h:502
RtMidiError::INVALID_DEVICE
Definition: RtMidi.h:82
RtMidiError::DRIVER_ERROR
Definition: RtMidi.h:86
RtMidiError::MEMORY_ERROR
Definition: RtMidi.h:83
RtMidiOut::openPort
void openPort(unsigned int portNumber=0, const std::string &portName=std::string("RtMidi Output"))
Open a MIDI output connection.
Definition: RtMidi.h:595
RtMidiError::NO_DEVICES_FOUND
Definition: RtMidi.h:81
MidiInApi::MidiMessage
Definition: RtMidi.h:515

| ©2003-2017 Gary P. Scavone, McGill University. All Rights Reserved. Maintained by Gary P. Scavone, gary at music.mcgill.ca