diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2016-02-11 10:58:57 -0500 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2016-02-11 10:58:57 -0500 |
| commit | fb24c2f884a1f88a60ae818d88e3782498b59351 (patch) | |
| tree | f92eb7d0b81418407ffb4b0c65452912eaaf4d96 /RtMidi.h | |
| parent | 32ccbf50a028826574f0dc1ad0c5dd3fab650c9a (diff) | |
Release 2.1.1 tarballreleases
Diffstat (limited to 'RtMidi.h')
| -rw-r--r-- | RtMidi.h | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -8,7 +8,7 @@ RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/ RtMidi: realtime MIDI i/o C++ classes - Copyright (c) 2003-2014 Gary P. Scavone + Copyright (c) 2003-2016 Gary P. Scavone Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -43,7 +43,7 @@ #ifndef RTMIDI_H #define RTMIDI_H -#define RTMIDI_VERSION "2.1.0" +#define RTMIDI_VERSION "2.1.1" #include <exception> #include <iostream> @@ -109,7 +109,7 @@ class RtMidiError : public std::exception Note that class behaviour is undefined after a critical error (not a warning) is reported. */ -typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText ); +typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &errorText, void *userData ); class MidiApi; @@ -161,7 +161,7 @@ class RtMidi The callback function will be called whenever an error has occured. It is best to set the error callback function before opening a port. */ - virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ) = 0; + virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ) = 0; protected: @@ -322,7 +322,7 @@ class RtMidiIn : public RtMidi The callback function will be called whenever an error has occured. It is best to set the error callback function before opening a port. */ - virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ); + virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ); protected: void openMidiApi( RtMidi::Api api, const std::string clientName, unsigned int queueSizeLimit ); @@ -413,7 +413,7 @@ class RtMidiOut : public RtMidi The callback function will be called whenever an error has occured. It is best to set the error callback function before opening a port. */ - virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL ); + virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ); protected: void openMidiApi( RtMidi::Api api, const std::string clientName ); @@ -448,7 +448,7 @@ class MidiApi virtual std::string getPortName( unsigned int portNumber ) = 0; inline bool isPortOpen() const { return connected_; } - void setErrorCallback( RtMidiErrorCallback errorCallback ); + void setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ); //! A basic error reporting function for RtMidi classes. void error( RtMidiError::Type type, std::string errorString ); @@ -460,6 +460,8 @@ protected: bool connected_; std::string errorString_; RtMidiErrorCallback errorCallback_; + bool firstErrorOccurred_; + void *errorCallbackUserData_; }; class MidiInApi : public MidiApi @@ -547,7 +549,7 @@ inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCou inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); } inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { ((MidiInApi *)rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); } inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return ((MidiInApi *)rtapi_)->getMessage( message ); } -inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback ) { rtapi_->setErrorCallback(errorCallback); } +inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); } inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); } @@ -557,7 +559,7 @@ inline bool RtMidiOut :: isPortOpen() const { return rtapi_->isPortOpen(); } inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); } inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); } inline void RtMidiOut :: sendMessage( std::vector<unsigned char> *message ) { ((MidiOutApi *)rtapi_)->sendMessage( message ); } -inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback ) { rtapi_->setErrorCallback(errorCallback); } +inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); } // **************************************************************** // // |
