Quellcode durchsuchen

Fixes for previous error hook and isPortOpen() function commit.

Gary Scavone vor 11 Jahren
Ursprung
Commit
cfb945a9c2
3 geänderte Dateien mit 10 neuen und 13 gelöschten Zeilen
  1. 4 9
      RtMidi.cpp
  2. 5 4
      RtMidi.h
  3. 1 0
      tests/Makefile.in

+ 4 - 9
RtMidi.cpp

@@ -243,17 +243,12 @@ MidiApi :: ~MidiApi( void )
 {
 }
 
-bool MidiApi :: isPortOpen() const
-{
-    return connected_;
-}
-
 void MidiApi :: setErrorCallback( RtMidiErrorCallback errorCallback )
 {
     errorCallback_ = errorCallback;
 }
 
-void MidiApi :: error( RtError::Type type, std::string errorString )
+void MidiApi :: error( RtMidiError::Type type, std::string errorString )
 {
   if ( errorCallback_ ) {
     static bool firstErrorOccured = false;
@@ -269,17 +264,17 @@ void MidiApi :: error( RtError::Type type, std::string errorString )
     return;
   }
 
-  if ( type == RtError::WARNING ) {
+  if ( type == RtMidiError::WARNING ) {
     std::cerr << '\n' << errorString << "\n\n";
   }
-  else if ( type == RtError::DEBUG_WARNING ) {
+  else if ( type == RtMidiError::DEBUG_WARNING ) {
 #if defined(__RTMIDI_DEBUG__)
     std::cerr << '\n' << errorString << "\n\n";
 #endif
   }
   else {
     std::cerr << '\n' << errorString << "\n\n";
-    throw RtError( errorString, type );
+    throw RtMidiError( errorString, type );
   }
 }
 

+ 5 - 4
RtMidi.h

@@ -433,11 +433,11 @@ class MidiApi
   virtual unsigned int getPortCount( void ) = 0;
   virtual std::string getPortName( unsigned int portNumber ) = 0;
 
-  bool isPortOpened() const;
+  inline bool isPortOpen() const { return connected_; }
   void setErrorCallback( RtMidiErrorCallback errorCallback );
 
   //! A basic error reporting function for RtMidi classes.
-  void error( RtError::Type type, std::string errorString );
+  void error( RtMidiError::Type type, std::string errorString );
 
 protected:
   virtual void initialize( const std::string& clientName ) = 0;
@@ -446,7 +446,7 @@ protected:
   bool connected_;
   std::string errorString_;
   RtMidiErrorCallback errorCallback_;
-}
+};
 
 class MidiInApi : public MidiApi
 {
@@ -458,7 +458,6 @@ class MidiInApi : public MidiApi
   void cancelCallback( void );
   virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense );
   double getMessage( std::vector<unsigned char> *message );
-  inline bool isPortOpen() const { return connected_; }
 
   // A MIDI structure used internally by the class to store incoming
   // messages.  Each message represents one and only one MIDI message.
@@ -527,6 +526,7 @@ inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->ge
 inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); }
 inline void RtMidiIn :: openVirtualPort( const std::string portName ) { rtapi_->openVirtualPort( portName ); }
 inline void RtMidiIn :: closePort( void ) { rtapi_->closePort(); }
+inline bool RtMidiIn :: isPortOpen() const { return rtapi_->isPortOpen(); }
 inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { ((MidiInApi *)rtapi_)->setCallback( callback, userData ); }
 inline void RtMidiIn :: cancelCallback( void ) { ((MidiInApi *)rtapi_)->cancelCallback(); }
 inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); }
@@ -539,6 +539,7 @@ inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->g
 inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); }
 inline void RtMidiOut :: openVirtualPort( const std::string portName ) { rtapi_->openVirtualPort( portName ); }
 inline void RtMidiOut :: closePort( void ) { rtapi_->closePort(); }
+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 ); }

+ 1 - 0
tests/Makefile.in

@@ -40,6 +40,7 @@ clean :
 	$(RM) -f $(OBJECT_PATH)/*.o
 	$(RM) -f $(PROGRAMS) *.exe
 	$(RM) -f *~
+	$(RM) -fR *.dSYM
 
 distclean: clean
 	$(RM) -f Makefile