summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Scavone <gary@music.mcgill.ca>2014-03-14 12:07:35 -0400
committerGary Scavone <gary@music.mcgill.ca>2014-03-14 12:07:35 -0400
commitcfb945a9c2aa53b631a0790f9554704e9e520aa6 (patch)
treebc41879b1ee801260660a5cbba83ef73376b296f
parent112baabce3f4a0ef5968097e986896d098dacc36 (diff)
Fixes for previous error hook and isPortOpen() function commit.
-rw-r--r--RtMidi.cpp13
-rw-r--r--RtMidi.h9
-rw-r--r--tests/Makefile.in1
3 files changed, 10 insertions, 13 deletions
diff --git a/RtMidi.cpp b/RtMidi.cpp
index d97d8d8..18da68f 100644
--- a/RtMidi.cpp
+++ b/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 );
}
}
diff --git a/RtMidi.h b/RtMidi.h
index 9530089..39f030a 100644
--- a/RtMidi.h
+++ b/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 ); }
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 21d1f67..1826737 100644
--- a/tests/Makefile.in
+++ b/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